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