mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
#1020 define a default value for layoutType
This commit is contained in:
committed by
Mario Romano
parent
55d73b8006
commit
2cb5987420
@@ -67,6 +67,12 @@ describe('ActivitiApps', () => {
|
|||||||
window['componentHandler'] = componentHandler;
|
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', () => {
|
it('should load apps on init', () => {
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
expect(getAppsSpy).toHaveBeenCalled();
|
expect(getAppsSpy).toHaveBeenCalled();
|
||||||
|
@@ -77,7 +77,7 @@ export class ActivitiApps implements OnInit {
|
|||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
if (!this.isValidType()) {
|
if (!this.isValidType()) {
|
||||||
throw( new Error(`LayoutType property allowed values: ${ActivitiApps.LAYOUT_LIST} - ${ActivitiApps.LAYOUT_GRID}`));
|
this.setDefaultLayoutType();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.apps$.subscribe((app: any) => {
|
this.apps$.subscribe((app: any) => {
|
||||||
@@ -136,6 +136,13 @@ export class ActivitiApps implements OnInit {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Assign the default value to LayoutType
|
||||||
|
*/
|
||||||
|
setDefaultLayoutType(): void {
|
||||||
|
this.layoutType = ActivitiApps.LAYOUT_GRID;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return true if the layout type is LIST
|
* Return true if the layout type is LIST
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
|
Reference in New Issue
Block a user