distinguish duplicate site names (#71)

This commit is contained in:
Cilibiu Bogdan
2017-11-21 11:20:51 +02:00
committed by Denys Vuika
parent f9f98bd09c
commit f9ecc83152
2 changed files with 14 additions and 8 deletions

View File

@@ -101,10 +101,12 @@ describe('Libraries Routed Component', () => {
it('sets title with id when duplicate nodes title exists in list', () => { it('sets title with id when duplicate nodes title exists in list', () => {
node.title = 'title'; node.title = 'title';
component.documentList.node = { component.documentList.data = {
page: {
list: { list: {
entries: [<any>{ entry: { id: 'some-id', title: 'title' } }] entries: [<any>{ entry: { id: 'some-id', title: 'title' } }]
} }
}
}; };
const title = component.makeLibraryTitle(node); const title = component.makeLibraryTitle(node);
@@ -115,10 +117,12 @@ describe('Libraries Routed Component', () => {
it('sets title when no duplicate nodes title exists in list', () => { it('sets title when no duplicate nodes title exists in list', () => {
node.title = 'title'; node.title = 'title';
component.paging = { component.documentList.data = {
page: {
list: { list: {
entries: [<any>{ entry: { id: 'some-id', title: 'title-some-id' } }] entries: [<any>{ entry: { id: 'some-id', title: 'title-some-id' } }]
} }
}
}; };
const title = component.makeLibraryTitle(node); const title = component.makeLibraryTitle(node);

View File

@@ -45,9 +45,11 @@ export class LibrariesComponent extends PageComponent {
makeLibraryTitle(library: any): string { makeLibraryTitle(library: any): string {
const { title, id } = library; const { title, id } = library;
const { entries } = this.documentList.data.page.list;
let isDuplicate = false; let isDuplicate = false;
if (this.documentList.node) {
isDuplicate = this.documentList.node.list.entries if (entries) {
isDuplicate = entries
.some(({ entry }: any) => { .some(({ entry }: any) => {
return (entry.id !== id && entry.title === title); return (entry.id !== id && entry.title === title);
}); });