mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-2589] conditional visibility for DL/DT components (#3223)
* watch data columns and update layout if needed * update docs * support DataTable, docs and tests
This commit is contained in:
committed by
Eugenio Romano
parent
382ea3c1b3
commit
edee2f12b6
@@ -15,9 +15,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { CUSTOM_ELEMENTS_SCHEMA, SimpleChange, TemplateRef } from '@angular/core';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { CUSTOM_ELEMENTS_SCHEMA, SimpleChange, TemplateRef, QueryList } from '@angular/core';
|
||||
import { ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testing';
|
||||
import { AlfrescoApiService, DataColumnListComponent, DataColumnComponent } from '@alfresco/adf-core';
|
||||
import { DataColumn, DataTableComponent } from '@alfresco/adf-core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { Subject } from 'rxjs/Subject';
|
||||
@@ -74,6 +74,24 @@ describe('DocumentList', () => {
|
||||
fixture.destroy();
|
||||
});
|
||||
|
||||
it('should update schema if columns change', fakeAsync(() => {
|
||||
|
||||
documentList.ngOnInit();
|
||||
|
||||
documentList.columnList = new DataColumnListComponent();
|
||||
documentList.columnList.columns = new QueryList<DataColumnComponent>();
|
||||
|
||||
spyOn(documentList.data, 'setColumns').and.callThrough();
|
||||
|
||||
documentList.ngAfterContentInit();
|
||||
documentList.columnList.columns.reset([new DataColumnComponent()]);
|
||||
documentList.columnList.columns.notifyOnChanges();
|
||||
|
||||
tick(100);
|
||||
|
||||
expect(documentList.data.setColumns).toHaveBeenCalled();
|
||||
}));
|
||||
|
||||
it('should setup default columns', () => {
|
||||
fixture.detectChanges();
|
||||
documentList.ngAfterContentInit();
|
||||
|
Reference in New Issue
Block a user