mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
5419 Permission panel shows first and last name of users (#5448)
This commit is contained in:
@@ -141,15 +141,91 @@ export const fakeAuthorityResults: any[] = [{
|
|||||||
}];
|
}];
|
||||||
|
|
||||||
export const fakeAuthorityListResult: any = {
|
export const fakeAuthorityListResult: any = {
|
||||||
'list': {
|
'list': {
|
||||||
'pagination': {
|
'pagination': {
|
||||||
'count': 0,
|
'count': 0,
|
||||||
'hasMoreItems': false,
|
'hasMoreItems': false,
|
||||||
'totalItems': 0,
|
'totalItems': 0,
|
||||||
'skipCount': 0,
|
'skipCount': 0,
|
||||||
'maxItems': 100
|
'maxItems': 100
|
||||||
},
|
},
|
||||||
'context': {},
|
'context': {},
|
||||||
'entries': fakeAuthorityResults
|
'entries': fakeAuthorityResults
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export const fakeNameListResult: any = {
|
||||||
|
'list': {
|
||||||
|
'pagination': {
|
||||||
|
'count': 2,
|
||||||
|
'hasMoreItems': false,
|
||||||
|
'totalItems': 2,
|
||||||
|
'skipCount': 0,
|
||||||
|
'maxItems': 20
|
||||||
|
},
|
||||||
|
'context': {
|
||||||
|
'consistency': {
|
||||||
|
'lastTxId': 5496
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'entries': [{
|
||||||
|
'entry': {
|
||||||
|
'aspectNames': ['cm:ownable'],
|
||||||
|
'isFolder': false,
|
||||||
|
'search': {
|
||||||
|
'score': 1.0
|
||||||
|
},
|
||||||
|
'isFile': false,
|
||||||
|
'name': '730cd9b0-5617-4865-aee8-90de1d596997',
|
||||||
|
'location': 'nodes',
|
||||||
|
'id': '730cd9b0-5617-4865-aee8-90de1d596997',
|
||||||
|
'nodeType': 'cm:person',
|
||||||
|
'properties': {
|
||||||
|
'cm:homeFolderProvider': 'userHomesHomeFolderProvider',
|
||||||
|
'cm:authorizationStatus': 'NEVER_AUTHORIZED',
|
||||||
|
'cm:homeFolder': '277f505d-6526-45b1-a7b3-c9bdd66f17f6',
|
||||||
|
'cm:userName': 'test1',
|
||||||
|
'cm:lastName': 'lastName1',
|
||||||
|
'cm:sizeCurrent': 0,
|
||||||
|
'cm:email': 'test1@gmail.com',
|
||||||
|
'cm:sizeQuota': 1073741824,
|
||||||
|
'cm:firstName': 'firstName',
|
||||||
|
'cm:owner': {
|
||||||
|
'id': 'test1',
|
||||||
|
'displayName': 'firstName lastName1'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'parentId': '3e9ce910-a4a0-4531-8f80-7734bece6342'
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
'entry': {
|
||||||
|
'aspectNames': ['cm:ownable'],
|
||||||
|
'isFolder': false,
|
||||||
|
'search': {
|
||||||
|
'score': 1.0
|
||||||
|
},
|
||||||
|
'isFile': false,
|
||||||
|
'name': '3d1e9e57-505f-431e-bb2b-38ad8d5d2d15',
|
||||||
|
'location': 'nodes',
|
||||||
|
'id': '3d1e9e57-505f-431e-bb2b-38ad8d5d2d15',
|
||||||
|
'nodeType': 'cm:person',
|
||||||
|
'properties': {
|
||||||
|
'cm:homeFolderProvider': 'userHomesHomeFolderProvider',
|
||||||
|
'cm:authorizationStatus': 'NEVER_AUTHORIZED',
|
||||||
|
'cm:homeFolder': '81a07ff0-82fb-4bbb-b869-d5fd92e71e17',
|
||||||
|
'cm:userName': 'test11',
|
||||||
|
'cm:lastName': 'lastName2',
|
||||||
|
'cm:sizeCurrent': 0,
|
||||||
|
'cm:email': 'test2@gmail.com',
|
||||||
|
'cm:sizeQuota': -1,
|
||||||
|
'cm:firstName': 'firstName',
|
||||||
|
'cm:owner': {
|
||||||
|
'id': 'test11',
|
||||||
|
'displayName': 'firstName lastName2'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'parentId': '3e9ce910-a4a0-4531-8f80-7734bece6342'
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
@@ -56,7 +56,7 @@
|
|||||||
<p>
|
<p>
|
||||||
{{item.entry?.properties['cm:authorityName']?
|
{{item.entry?.properties['cm:authorityName']?
|
||||||
item.entry?.properties['cm:authorityName'] :
|
item.entry?.properties['cm:authorityName'] :
|
||||||
item.entry?.properties['cm:firstName']}}</p>
|
item.entry?.properties['cm:owner']?.displayName}}</p>
|
||||||
</mat-list-option>
|
</mat-list-option>
|
||||||
</mat-selection-list>
|
</mat-selection-list>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
@@ -20,7 +20,7 @@ import { AddPermissionPanelComponent } from './add-permission-panel.component';
|
|||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
import { SearchService, setupTestBed, SearchConfigurationService } from '@alfresco/adf-core';
|
import { SearchService, setupTestBed, SearchConfigurationService } from '@alfresco/adf-core';
|
||||||
import { of } from 'rxjs';
|
import { of } from 'rxjs';
|
||||||
import { fakeAuthorityListResult } from '../../../mock/add-permission.component.mock';
|
import { fakeAuthorityListResult, fakeNameListResult } from '../../../mock/add-permission.component.mock';
|
||||||
import { ContentTestingModule } from '../../../testing/content.testing.module';
|
import { ContentTestingModule } from '../../../testing/content.testing.module';
|
||||||
import { DebugElement } from '@angular/core';
|
import { DebugElement } from '@angular/core';
|
||||||
|
|
||||||
@@ -187,4 +187,22 @@ describe('AddPermissionPanelComponent', () => {
|
|||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
it('should show first and last name of users', async(() => {
|
||||||
|
searchApiService = fixture.componentRef.injector.get(SearchService);
|
||||||
|
spyOn(searchApiService, 'search').and.returnValue(of(fakeNameListResult));
|
||||||
|
component.selectedItems.push(fakeNameListResult.list.entries[0]);
|
||||||
|
component.selectedItems.push(fakeNameListResult.list.entries[1]);
|
||||||
|
|
||||||
|
typeWordIntoSearchInput('a');
|
||||||
|
fixture.detectChanges();
|
||||||
|
fixture.whenStable().then(() => {
|
||||||
|
fixture.detectChanges();
|
||||||
|
expect(element.querySelector('#result_option_0 .mat-list-text')).not.toBeNull();
|
||||||
|
expect(element.querySelector('#result_option_0 .mat-list-text')).toBeDefined();
|
||||||
|
expect(element.querySelector('#result_option_1 .mat-list-text')).not.toBeNull();
|
||||||
|
expect(element.querySelector('#result_option_1 .mat-list-text')).toBeDefined();
|
||||||
|
expect(element.querySelector('#result_option_0 .mat-list-text').innerHTML).not.toEqual(element.querySelector('#result_option_1 .mat-list-text').innerHTML);
|
||||||
|
});
|
||||||
|
}));
|
||||||
|
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user