Unit tests for document list component

This commit is contained in:
Denys Vuika
2016-06-30 13:39:52 +01:00
parent 8632013231
commit 258148cc1c
9 changed files with 289 additions and 11 deletions

View File

@@ -41,9 +41,24 @@ describe('ContentColumnList', () => {
it('should register column within parent document list', () => {
expect(documentList.columns.length).toBe(0);
columnList.registerColumn(new ContentColumnModel());
let result = columnList.registerColumn(new ContentColumnModel());
expect(result).toBeTruthy();
expect(documentList.columns.length).toBe(1);
});
it('should require document list instance to register action', () => {
columnList = new ContentColumnList(null);
let col = new ContentColumnModel();
expect(columnList.registerColumn(col)).toBeFalsy();
});
it('should require action instance to register', () => {
spyOn(documentList.actions, 'push').and.callThrough();
let result = columnList.registerColumn(null);
expect(result).toBeFalsy();
expect(documentList.actions.push).not.toHaveBeenCalled();
});
});