mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
Fix the taskFilterCloud unit test and fix the coverage (#4008)
* Fix the taskFilterCloud unit test and fix the coverage * Fix the tslint * Fix e2e test * Fix unit test * Skip e2e related to taskFiltersCloud * rollback version * Rollback the change on cloud angular.json
This commit is contained in:
committed by
Eugenio Romano
parent
885b8fb8b5
commit
c873bf801f
@@ -57,8 +57,7 @@ class CustomTaskListComponent {
|
||||
|
||||
class EmptyTemplateComponent {
|
||||
}
|
||||
/*tslint:disable*/
|
||||
fdescribe('ProcessListCloudComponent', () => {
|
||||
describe('ProcessListCloudComponent', () => {
|
||||
let component: ProcessListCloudComponent;
|
||||
let fixture: ComponentFixture<ProcessListCloudComponent>;
|
||||
let appConfig: AppConfigService;
|
||||
@@ -174,7 +173,7 @@ fdescribe('ProcessListCloudComponent', () => {
|
||||
}
|
||||
});
|
||||
let rowEvent = new DataRowEvent(row, null);
|
||||
component.rowClick.subscribe(taskId => {
|
||||
component.rowClick.subscribe( (taskId) => {
|
||||
expect(taskId).toEqual('999');
|
||||
expect(component.getCurrentId()).toEqual('999');
|
||||
done();
|
||||
|
@@ -4,7 +4,7 @@
|
||||
class="adf-filters__entry" [class.active]="currentFilter === filter">
|
||||
<mat-icon *ngIf="showIcons && filter.icon" matListIcon class="adf-filters__entry-icon">{{filter.icon}}
|
||||
</mat-icon>
|
||||
<span matLine [attr.data-automation-id]="filter.name + '_filter'">{{filter.name | translate}}</span>
|
||||
<span matLine [attr.data-automation-id]="filter.key + '-filter'">{{filter.name | translate}}</span>
|
||||
</mat-list-item>
|
||||
</mat-list>
|
||||
<ng-template #loading>
|
||||
|
@@ -33,18 +33,21 @@ describe('TaskFiltersCloudComponent', () => {
|
||||
let fakeGlobalFilter = [
|
||||
new TaskFilterCloudRepresentationModel({
|
||||
name: 'FakeInvolvedTasks',
|
||||
key: 'fake-involved-tasks',
|
||||
icon: 'adjust',
|
||||
id: 10,
|
||||
filter: {state: 'open', assignment: 'fake-involved'}
|
||||
}),
|
||||
new TaskFilterCloudRepresentationModel({
|
||||
name: 'FakeMyTasks1',
|
||||
key: 'fake-my-tast1',
|
||||
icon: 'done',
|
||||
id: 11,
|
||||
filter: {state: 'open', assignment: 'fake-assignee'}
|
||||
}),
|
||||
new TaskFilterCloudRepresentationModel({
|
||||
name: 'FakeMyTasks2',
|
||||
key: 'fake-my-tast2',
|
||||
icon: 'inbox',
|
||||
id: 12,
|
||||
filter: {state: 'open', assignment: 'fake-assignee'}
|
||||
@@ -301,7 +304,7 @@ describe('TaskFiltersCloudComponent', () => {
|
||||
|
||||
fixture.detectChanges();
|
||||
spyOn(component, 'selectFilterAndEmit').and.stub();
|
||||
let filterButton = fixture.debugElement.nativeElement.querySelector('span[data-automation-id="FakeMyTasks1_filter"]');
|
||||
let filterButton = fixture.debugElement.nativeElement.querySelector('span[data-automation-id="fake-my-tast1-filter"]');
|
||||
filterButton.click();
|
||||
expect(component.selectFilterAndEmit).toHaveBeenCalledWith({id: fakeGlobalFilter[1].id});
|
||||
}));
|
||||
@@ -316,26 +319,41 @@ describe('TaskFiltersCloudComponent', () => {
|
||||
expect(component.getFilters).toHaveBeenCalledWith(appName);
|
||||
});
|
||||
|
||||
it('should not reload filters by appName null on binding changes', () => {
|
||||
spyOn(component, 'getFilters').and.stub();
|
||||
const appName = null;
|
||||
|
||||
let change = new SimpleChange(undefined, appName, true);
|
||||
component.ngOnChanges({ 'appName': change });
|
||||
|
||||
expect(component.getFilters).not.toHaveBeenCalledWith(appName);
|
||||
});
|
||||
|
||||
it('should change current filter when filterParam (name) changes', () => {
|
||||
component.filters = fakeGlobalFilter;
|
||||
component.currentFilter = null;
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
expect(component.currentFilter.name).toEqual(fakeGlobalFilter[2].name);
|
||||
});
|
||||
|
||||
const change = new SimpleChange(null, { name: fakeGlobalFilter[2].name }, true);
|
||||
const change = new SimpleChange(null, { name: fakeGlobalFilter[1].name }, true);
|
||||
component.ngOnChanges({ 'filterParam': change });
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
expect(component.currentFilter.name).toEqual(fakeGlobalFilter[1].name);
|
||||
});
|
||||
});
|
||||
|
||||
it('should change current filter when filterParam (key) changes', () => {
|
||||
component.filters = fakeGlobalFilter;
|
||||
component.currentFilter = null;
|
||||
|
||||
const change = new SimpleChange(null, { key: fakeGlobalFilter[2].key }, true);
|
||||
component.ngOnChanges({ 'filterParam': change });
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
expect(component.currentFilter.key).toEqual(fakeGlobalFilter[2].key);
|
||||
});
|
||||
});
|
||||
|
||||
it('should change current filter when filterParam (index) changes', () => {
|
||||
component.filters = fakeGlobalFilter;
|
||||
component.currentFilter = null;
|
||||
const position = 1;
|
||||
|
||||
const change = new SimpleChange(null, { index: position }, true);
|
||||
component.ngOnChanges({ 'filterParam': change });
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
expect(component.currentFilter.name).toEqual(fakeGlobalFilter[position].name);
|
||||
});
|
||||
});
|
||||
|
||||
it('should reload filters by app name on binding changes', () => {
|
||||
@@ -354,6 +372,6 @@ describe('TaskFiltersCloudComponent', () => {
|
||||
|
||||
expect(component.currentFilter).toBeUndefined();
|
||||
component.selectFilter(filter);
|
||||
expect(component.getCurrentFilter()).toBe(fakeGlobalFilter[1]);
|
||||
expect(component.getCurrentFilter()).toBe(fakeGlobalFilter[0]);
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user