From ff031332778e70a0fea612270d138d455964080f Mon Sep 17 00:00:00 2001 From: jgallego Date: Tue, 19 May 2020 12:21:02 +0200 Subject: [PATCH 1/3] test --- modules/item/front/diary/index.spec.js | 20 +++++++++++++++++++ .../front/upcoming-deliveries/index.spec.js | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/modules/item/front/diary/index.spec.js b/modules/item/front/diary/index.spec.js index ccf7ac1a1..269e7f78a 100644 --- a/modules/item/front/diary/index.spec.js +++ b/modules/item/front/diary/index.spec.js @@ -40,6 +40,26 @@ describe('Item', () => { expect(controller.item.id).toEqual(1); }); }); + + describe('scrollToLine ()', () => { + it('should assign $location then call anchorScroll using controller value', () => { + jest.spyOn(controller, '$anchorScroll'); + controller.ticketFk = 1; + controller.scrollToLine('invalidValue'); + + expect(controller.$location).toEqual(`vnItemDiary-${1}`); + expect(controller.$anchorScroll).toHaveBeenCalledWith(); + }); + + it('should assign $location then call anchorScroll using received value', () => { + jest.spyOn(controller, '$anchorScroll'); + controller.ticketFk = undefined; + controller.scrollToLine(1); + + expect(controller.$location).toEqual(`vnItemDiary-${1}`); + expect(controller.$anchorScroll).toHaveBeenCalledWith(); + }); + }); }); }); diff --git a/modules/zone/front/upcoming-deliveries/index.spec.js b/modules/zone/front/upcoming-deliveries/index.spec.js index 9f5c322a4..a92056102 100644 --- a/modules/zone/front/upcoming-deliveries/index.spec.js +++ b/modules/zone/front/upcoming-deliveries/index.spec.js @@ -12,7 +12,7 @@ describe('component vnUpcomingDeliveries', () => { controller = $componentController('vnUpcomingDeliveries', {$element, $scope}); })); - fdescribe('getWeekDay()', () => { + describe('getWeekDay()', () => { it('should retrieve a weekday for a json passed', () => { let jsonDate = '1970-01-01T22:00:00.000Z'; From 529bd5673c6601fe1e06f32fd22ca1f1fb8158e5 Mon Sep 17 00:00:00 2001 From: jgallego Date: Tue, 19 May 2020 13:06:59 +0200 Subject: [PATCH 2/3] test --- modules/item/front/diary/index.js | 2 ++ modules/item/front/diary/index.spec.js | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/item/front/diary/index.js b/modules/item/front/diary/index.js index 55b63a60e..d37670b24 100644 --- a/modules/item/front/diary/index.js +++ b/modules/item/front/diary/index.js @@ -53,8 +53,10 @@ class Controller extends Section { scrollToLine(lineFk) { const hashFk = this.lineFk || lineFk; + console.log(hashFk); const hash = `vnItemDiary-${hashFk}`; this.$location.hash(hash); + console.log(this.$location); this.$anchorScroll(); } diff --git a/modules/item/front/diary/index.spec.js b/modules/item/front/diary/index.spec.js index 269e7f78a..b6e50e5c5 100644 --- a/modules/item/front/diary/index.spec.js +++ b/modules/item/front/diary/index.spec.js @@ -44,19 +44,19 @@ describe('Item', () => { describe('scrollToLine ()', () => { it('should assign $location then call anchorScroll using controller value', () => { jest.spyOn(controller, '$anchorScroll'); - controller.ticketFk = 1; + controller.lineFk = 1; controller.scrollToLine('invalidValue'); - expect(controller.$location).toEqual(`vnItemDiary-${1}`); + expect(controller.$location.hash()).toEqual(`vnItemDiary-${1}`); expect(controller.$anchorScroll).toHaveBeenCalledWith(); }); it('should assign $location then call anchorScroll using received value', () => { jest.spyOn(controller, '$anchorScroll'); - controller.ticketFk = undefined; + controller.lineFk = undefined; controller.scrollToLine(1); - expect(controller.$location).toEqual(`vnItemDiary-${1}`); + expect(controller.$location.hash()).toEqual(`vnItemDiary-${1}`); expect(controller.$anchorScroll).toHaveBeenCalledWith(); }); }); From 670c5936ce151addaa16ee6538ae79a8f9ce0b5e Mon Sep 17 00:00:00 2001 From: jgallego Date: Tue, 19 May 2020 13:11:22 +0200 Subject: [PATCH 3/3] test2 --- modules/item/front/diary/index.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/modules/item/front/diary/index.js b/modules/item/front/diary/index.js index d37670b24..55b63a60e 100644 --- a/modules/item/front/diary/index.js +++ b/modules/item/front/diary/index.js @@ -53,10 +53,8 @@ class Controller extends Section { scrollToLine(lineFk) { const hashFk = this.lineFk || lineFk; - console.log(hashFk); const hash = `vnItemDiary-${hashFk}`; this.$location.hash(hash); - console.log(this.$location); this.$anchorScroll(); }