From 2680bc52ece5fd554bdf7b82fe8057eb1e8fd0ce Mon Sep 17 00:00:00 2001 From: Daniel Herrero Date: Wed, 13 Dec 2017 12:47:19 +0100 Subject: [PATCH] Test fixed for columnHeader --- client/core/src/column-header/column-header.spec.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/client/core/src/column-header/column-header.spec.js b/client/core/src/column-header/column-header.spec.js index 48954826e..2291094b3 100644 --- a/client/core/src/column-header/column-header.spec.js +++ b/client/core/src/column-header/column-header.spec.js @@ -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); });