Test fixed for columnHeader
This commit is contained in:
parent
c206977d16
commit
2680bc52ec
|
@ -3,6 +3,7 @@ import './column-header.js';
|
|||
describe('Component vnColumnHeader', () => {
|
||||
let $componentController;
|
||||
let controller;
|
||||
let $event;
|
||||
let $attrs;
|
||||
|
||||
beforeEach(() => {
|
||||
|
@ -11,6 +12,9 @@ describe('Component vnColumnHeader', () => {
|
|||
|
||||
beforeEach(angular.mock.inject(_$componentController_ => {
|
||||
$componentController = _$componentController_;
|
||||
$event = {
|
||||
preventDefault: () => {}
|
||||
};
|
||||
$attrs = {};
|
||||
controller = $componentController('vnColumnHeader', {$attrs});
|
||||
}));
|
||||
|
@ -19,7 +23,7 @@ describe('Component vnColumnHeader', () => {
|
|||
it(`should change the ordenation to DESC (descendant) if it was ASC (ascendant)`, () => {
|
||||
controller.gridHeader = {selectColum: () => {}};
|
||||
controller.order = 'ASC';
|
||||
controller.onClick();
|
||||
controller.onClick($event);
|
||||
|
||||
expect(controller.order).toEqual('DESC');
|
||||
});
|
||||
|
@ -27,7 +31,7 @@ describe('Component vnColumnHeader', () => {
|
|||
it(`should change the ordenation to ASC (ascendant) if it wasnt ASC`, () => {
|
||||
controller.gridHeader = {selectColum: () => {}};
|
||||
controller.order = 'DESC or any other value that might occur';
|
||||
controller.onClick();
|
||||
controller.onClick($event);
|
||||
|
||||
expect(controller.order).toEqual('ASC');
|
||||
});
|
||||
|
@ -36,7 +40,7 @@ describe('Component vnColumnHeader', () => {
|
|||
controller.gridHeader = {selectColum: () => {}};
|
||||
controller.order = 'Change me!';
|
||||
spyOn(controller.gridHeader, 'selectColum');
|
||||
controller.onClick();
|
||||
controller.onClick($event);
|
||||
|
||||
expect(controller.gridHeader.selectColum).toHaveBeenCalledWith(controller);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue