From 7568a1c06663f58e9626f5b70d623db2348304b9 Mon Sep 17 00:00:00 2001 From: joan Date: Mon, 11 Jan 2021 14:54:24 +0100 Subject: [PATCH] Updated unit tests --- .../core/components/searchbar/search-panel.js | 1 + front/core/components/searchbar/style.scss | 25 ++++++++++++++- modules/ticket/front/search-panel/index.html | 8 ++--- modules/ticket/front/search-panel/index.js | 19 +++++++++++- .../ticket/front/search-panel/index.spec.js | 27 ++++++++++++++-- modules/ticket/front/search-panel/style.scss | 31 ------------------- 6 files changed, 72 insertions(+), 39 deletions(-) delete mode 100644 modules/ticket/front/search-panel/style.scss diff --git a/front/core/components/searchbar/search-panel.js b/front/core/components/searchbar/search-panel.js index f473c2b049..67fd3fae27 100644 --- a/front/core/components/searchbar/search-panel.js +++ b/front/core/components/searchbar/search-panel.js @@ -1,4 +1,5 @@ import Component from '../../lib/component'; +import './style.scss'; export default class SearchPanel extends Component { set filter(value) { diff --git a/front/core/components/searchbar/style.scss b/front/core/components/searchbar/style.scss index c1d4be21c3..eab9c126b1 100644 --- a/front/core/components/searchbar/style.scss +++ b/front/core/components/searchbar/style.scss @@ -1,4 +1,4 @@ -@import "variables"; +@import "./variables"; vn-searchbar { display: block; @@ -44,4 +44,27 @@ vn-searchbar { & > form { padding: $spacing-lg; } + + & > form#manifold-form { + padding: 0; + + .manifold-panel { + border: $border-thin-light; + border-radius: 5px; + position: relative; + text-align: right; + + .or { + font-weight: bold; + font-size: 26px; + color: $color-font-secondary + } + + vn-icon[icon="info"] { + position: absolute; + top: 2px; + right: 2px + } + } + } } \ No newline at end of file diff --git a/modules/ticket/front/search-panel/index.html b/modules/ticket/front/search-panel/index.html index 934b1fc1f5..d9ab2ee910 100644 --- a/modules/ticket/front/search-panel/index.html +++ b/modules/ticket/front/search-panel/index.html @@ -1,5 +1,5 @@
-
+
- + + on-change="$ctrl.from = value"> + on-change="$ctrl.to = value"> O { })); describe('getGroupedStates()', () => { - it('should set an array of groupedStates with the aditionof a name translation', () => { + it('should set an array of groupedStates with the adition of a name translation', () => { jest.spyOn(controller, '$t').mockReturnValue('miCodigo'); const data = [ { @@ -34,8 +34,30 @@ describe('Ticket Component vnTicketSearchPanel', () => { }); }); + describe('from() setter', () => { + it('should clear the scope days when setting the from property', () => { + controller.filter.scopeDays = 1; + + controller.from = new Date(); + + expect(controller.filter.scopeDays).toBeNull(); + expect(controller.from).toBeDefined(); + }); + }); + + describe('to() setter', () => { + it('should clear the scope days when setting the to property', () => { + controller.filter.scopeDays = 1; + + controller.to = new Date(); + + expect(controller.filter.scopeDays).toBeNull(); + expect(controller.to).toBeDefined(); + }); + }); + describe('scopeDays() setter', () => { - it('should clear the date range', () => { + it('should clear the date range when setting the scopeDays property', () => { controller.filter.from = new Date(); controller.filter.to = new Date(); @@ -43,6 +65,7 @@ describe('Ticket Component vnTicketSearchPanel', () => { expect(controller.filter.from).toBeNull(); expect(controller.filter.to).toBeNull(); + expect(controller.scopeDays).toBeDefined(); }); }); }); diff --git a/modules/ticket/front/search-panel/style.scss b/modules/ticket/front/search-panel/style.scss deleted file mode 100644 index d90c66251f..0000000000 --- a/modules/ticket/front/search-panel/style.scss +++ /dev/null @@ -1,31 +0,0 @@ -@import "./effects"; -@import "./variables"; - - -form#ticket-form { - padding: 0 -} - -.scope-days { - border: $border-thin-light; - border-radius: 5px; - position: relative; - text-align: right; - - & > p { - font-size: 1.2rem; - margin: 3px; - } - - .or { - font-weight: bold; - font-size: 26px; - color: $color-font-secondary - } - - vn-icon[icon="info"] { - position: absolute; - top: 2px; - right: 2px - } -} \ No newline at end of file