mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
* #1750 add ngOnchange on data input * Update datatable.component.ts
This commit is contained in:
committed by
Denys Vuika
parent
707851ce85
commit
59ed4ee65d
@@ -15,6 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { SimpleChange } from '@angular/core';
|
||||
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
|
||||
import { CoreModule } from 'ng2-alfresco-core';
|
||||
import { DataTableComponent } from './datatable.component';
|
||||
@@ -55,7 +56,8 @@ describe('DataTable', () => {
|
||||
// dataTable = new DataTableComponent();
|
||||
|
||||
eventMock = {
|
||||
preventDefault: function () {}
|
||||
preventDefault: function () {
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
@@ -95,6 +97,15 @@ describe('DataTable', () => {
|
||||
expect(table.data).toEqual(jasmine.any(ObjectDataTableAdapter));
|
||||
});
|
||||
|
||||
it('should load data table on onChange', () => {
|
||||
let table = new DataTableComponent(null);
|
||||
let data = new ObjectDataTableAdapter([], []);
|
||||
|
||||
expect(table.data).toBeUndefined();
|
||||
table.ngOnChanges({'data': new SimpleChange('123', data)});
|
||||
expect(table.data).toEqual(data);
|
||||
});
|
||||
|
||||
it('should initialize with custom data', () => {
|
||||
let data = new ObjectDataTableAdapter([], []);
|
||||
dataTable.data = data;
|
||||
|
Reference in New Issue
Block a user