mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-10-01 14:41:14 +00:00
imporove sorting management and reduce repetitive code (#381)
* rework sorting management * remove fdescribe * test fixes * unified desctructor * unified page reload * test fixes * code fixes * test fixes * test fixes
This commit is contained in:
committed by
Cilibiu Bogdan
parent
0ac33f820b
commit
7bb0905045
@@ -62,7 +62,6 @@ describe('FilesComponent', () => {
|
||||
let router: Router;
|
||||
let browsingFilesService: BrowsingFilesService;
|
||||
let nodeActionsService: NodeActionsService;
|
||||
let preferenceService: UserPreferencesService;
|
||||
let notificationService: NotificationService;
|
||||
|
||||
beforeEach(async(() => {
|
||||
@@ -89,8 +88,8 @@ describe('FilesComponent', () => {
|
||||
],
|
||||
providers: [
|
||||
{ provide: ActivatedRoute, useValue: {
|
||||
params: Observable.of({ folderId: 'someId' }),
|
||||
snapshot: { data: { preferencePrefix: 'prefix' } }
|
||||
snapshot: { data: { preferencePrefix: 'prefix' } },
|
||||
params: Observable.of({ folderId: 'someId' })
|
||||
} } ,
|
||||
{ provide: TranslationService, useClass: TranslationMock },
|
||||
AuthenticationService,
|
||||
@@ -125,7 +124,6 @@ describe('FilesComponent', () => {
|
||||
browsingFilesService = TestBed.get(BrowsingFilesService);
|
||||
notificationService = TestBed.get(NotificationService);
|
||||
nodeActionsService = TestBed.get(NodeActionsService);
|
||||
preferenceService = TestBed.get(UserPreferencesService);
|
||||
});
|
||||
}));
|
||||
|
||||
@@ -454,37 +452,6 @@ describe('FilesComponent', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('onSortingChanged', () => {
|
||||
it('should save sorting input', () => {
|
||||
spyOn(preferenceService, 'set');
|
||||
|
||||
const event = <any>{
|
||||
detail: {
|
||||
key: 'some-name',
|
||||
direction: 'some-direction'
|
||||
}
|
||||
};
|
||||
|
||||
component.onSortingChanged(event);
|
||||
|
||||
expect(preferenceService.set).toHaveBeenCalledWith('prefix.sorting.key', 'some-name');
|
||||
expect(preferenceService.set).toHaveBeenCalledWith('prefix.sorting.direction', 'some-direction');
|
||||
});
|
||||
|
||||
it('should save default sorting when no input', () => {
|
||||
spyOn(preferenceService, 'set');
|
||||
|
||||
const event = <any>{
|
||||
detail: {}
|
||||
};
|
||||
|
||||
component.onSortingChanged(event);
|
||||
|
||||
expect(preferenceService.set).toHaveBeenCalledWith('prefix.sorting.key', 'modifiedAt');
|
||||
expect(preferenceService.set).toHaveBeenCalledWith('prefix.sorting.direction', 'desc');
|
||||
});
|
||||
});
|
||||
|
||||
describe('openSnackMessage', () => {
|
||||
it('should call notification service', () => {
|
||||
const message = 'notification message';
|
||||
|
Reference in New Issue
Block a user