diff --git a/ng2-components/ng2-activiti-tasklist/src/components/activiti-apps.component.spec.ts b/ng2-components/ng2-activiti-tasklist/src/components/activiti-apps.component.spec.ts index a7649b665a..250b9b7421 100644 --- a/ng2-components/ng2-activiti-tasklist/src/components/activiti-apps.component.spec.ts +++ b/ng2-components/ng2-activiti-tasklist/src/components/activiti-apps.component.spec.ts @@ -67,6 +67,12 @@ describe('ActivitiApps', () => { window['componentHandler'] = componentHandler; }); + it('should define layoutType with the default value', () => { + component.layoutType = ''; + fixture.detectChanges(); + expect(component.isGrid()).toBe(true); + }); + it('should load apps on init', () => { fixture.detectChanges(); expect(getAppsSpy).toHaveBeenCalled(); diff --git a/ng2-components/ng2-activiti-tasklist/src/components/activiti-apps.component.ts b/ng2-components/ng2-activiti-tasklist/src/components/activiti-apps.component.ts index a0db97ca53..5d5e54cf81 100644 --- a/ng2-components/ng2-activiti-tasklist/src/components/activiti-apps.component.ts +++ b/ng2-components/ng2-activiti-tasklist/src/components/activiti-apps.component.ts @@ -77,7 +77,7 @@ export class ActivitiApps implements OnInit { ngOnInit() { if (!this.isValidType()) { - throw( new Error(`LayoutType property allowed values: ${ActivitiApps.LAYOUT_LIST} - ${ActivitiApps.LAYOUT_GRID}`)); + this.setDefaultLayoutType(); } this.apps$.subscribe((app: any) => { @@ -136,6 +136,13 @@ export class ActivitiApps implements OnInit { return false; } + /** + * Assign the default value to LayoutType + */ + setDefaultLayoutType(): void { + this.layoutType = ActivitiApps.LAYOUT_GRID; + } + /** * Return true if the layout type is LIST * @returns {boolean}