From 65053f5f28da9d81ed63f67693240c2baa886891 Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 26 Nov 2021 13:26:48 +0100 Subject: [PATCH 1/4] feat(worker_time-control): add timestamp url param --- modules/worker/front/routes.json | 2 +- modules/worker/front/time-control/index.html | 1 + modules/worker/front/time-control/index.js | 10 +++++++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/modules/worker/front/routes.json b/modules/worker/front/routes.json index 4bad33dd0..47334d841 100644 --- a/modules/worker/front/routes.json +++ b/modules/worker/front/routes.json @@ -83,7 +83,7 @@ "worker": "$ctrl.worker" } }, { - "url": "/time-control", + "url": "/time-control?timestamp", "state": "worker.card.timeControl", "component": "vn-worker-time-control", "description": "Time control", diff --git a/modules/worker/front/time-control/index.html b/modules/worker/front/time-control/index.html index 66d6f282e..170d88b21 100644 --- a/modules/worker/front/time-control/index.html +++ b/modules/worker/front/time-control/index.html @@ -91,6 +91,7 @@ diff --git a/modules/worker/front/time-control/index.js b/modules/worker/front/time-control/index.js index 96913c505..1f6251391 100644 --- a/modules/worker/front/time-control/index.js +++ b/modules/worker/front/time-control/index.js @@ -15,7 +15,15 @@ class Controller extends Section { } $postLink() { - this.date = new Date(); + const timestamp = this.$params.timestamp; + let initialDate = new Date(); + + if (timestamp) { + initialDate = new Date(timestamp * 1000); + this.$.calendar.defaultDate = initialDate; + } + + this.date = initialDate; } get worker() { From e4d7d957eb697bdb9e30e925da37835172ccf01a Mon Sep 17 00:00:00 2001 From: joan Date: Fri, 26 Nov 2021 14:48:55 +0100 Subject: [PATCH 2/4] Rectified icons --- front/core/styles/icons/salixfont.css | 16 ++++++++-------- modules/client/front/descriptor/index.html | 2 +- modules/client/front/routes.json | 2 +- modules/supplier/front/routes.json | 2 +- modules/ticket/front/index/index.html | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/front/core/styles/icons/salixfont.css b/front/core/styles/icons/salixfont.css index 8136b5fa6..1ecfe8978 100644 --- a/front/core/styles/icons/salixfont.css +++ b/front/core/styles/icons/salixfont.css @@ -129,13 +129,13 @@ .icon-columndelete:before { content: "\e91d"; } -.icon-complementos:before { +.icon-accessory:before { content: "\e91e"; } .icon-components:before { content: "\e91f"; } -.icon-confeccion:before { +.icon-handmade:before { content: "\e920"; } .icon-consignatarios:before { @@ -180,7 +180,7 @@ .icon-fixedPrice:before { content: "\e92e"; } -.icon-flor:before { +.icon-flower:before { content: "\e92f"; } .icon-frozen:before { @@ -207,7 +207,7 @@ .icon-history:before { content: "\e937"; } -.icon-Inactivo:before { +.icon-disabled:before { content: "\e938"; } .icon-info:before { @@ -285,7 +285,7 @@ .icon-photo:before { content: "\e951"; } -.icon-planta:before { +.icon-plant:before { content: "\e952"; } .icon-stowaway:before { @@ -300,13 +300,13 @@ .icon-regentry:before { content: "\e956"; } -.icon-reserva:before { +.icon-reserve:before { content: "\e957"; } .icon-revision:before { content: "\e958"; } -.icon-riesgo:before { +.icon-risk:before { content: "\e959"; } .icon-services:before { @@ -372,7 +372,7 @@ .icon-unavailable:before { content: "\e96e"; } -.icon-verde:before { +.icon-greenery:before { content: "\e96f"; } .icon-volume:before { diff --git a/modules/client/front/descriptor/index.html b/modules/client/front/descriptor/index.html index d5beca282..505a3ed0a 100644 --- a/modules/client/front/descriptor/index.html +++ b/modules/client/front/descriptor/index.html @@ -82,7 +82,7 @@ + icon="icon-invoice">
diff --git a/modules/client/front/routes.json b/modules/client/front/routes.json index ac5e78d99..765fbc637 100644 --- a/modules/client/front/routes.json +++ b/modules/client/front/routes.json @@ -16,7 +16,7 @@ {"state": "client.card.note.index", "icon": "insert_drive_file"}, {"state": "client.card.credit.index", "icon": "credit_card"}, {"state": "client.card.greuge.index", "icon": "work"}, - {"state": "client.card.balance.index", "icon": "icon-invoices"}, + {"state": "client.card.balance.index", "icon": "icon-invoice"}, {"state": "client.card.recovery.index", "icon": "icon-recovery"}, {"state": "client.card.webAccess", "icon": "cloud"}, {"state": "client.card.log", "icon": "history"}, diff --git a/modules/supplier/front/routes.json b/modules/supplier/front/routes.json index 9be6b7a85..3d3814f5d 100644 --- a/modules/supplier/front/routes.json +++ b/modules/supplier/front/routes.json @@ -13,7 +13,7 @@ {"state": "supplier.card.fiscalData", "icon": "account_balance"}, {"state": "supplier.card.billingData", "icon": "icon-payment"}, {"state": "supplier.card.address.index", "icon": "icon-delivery"}, - {"state": "supplier.card.account", "icon": "icon-accounts"}, + {"state": "supplier.card.account", "icon": "icon-account"}, {"state": "supplier.card.contact", "icon": "contact_phone"}, {"state": "supplier.card.log", "icon": "history"}, {"state": "supplier.card.consumption", "icon": "show_chart"} diff --git a/modules/ticket/front/index/index.html b/modules/ticket/front/index/index.html index 096f57e05..852675f76 100644 --- a/modules/ticket/front/index/index.html +++ b/modules/ticket/front/index/index.html @@ -167,7 +167,7 @@ tooltip-position="left"> Date: Mon, 29 Nov 2021 15:22:16 +0100 Subject: [PATCH 3/4] test(worker_time-control): tested url parameter timestamp --- e2e/helpers/puppeteer.js | 2 +- .../worker/front/time-control/index.spec.js | 23 +++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/e2e/helpers/puppeteer.js b/e2e/helpers/puppeteer.js index dace276be..abd76b434 100644 --- a/e2e/helpers/puppeteer.js +++ b/e2e/helpers/puppeteer.js @@ -27,7 +27,7 @@ export async function getBrowser() { args, defaultViewport: null, headless: headless, - slowMo: 5, // slow down by ms + slowMo: 1, // slow down by ms // ignoreDefaultArgs: ['--disable-extensions'], // executablePath: '/usr/bin/google-chrome-stable', // executablePath: '/usr/bin/firefox-developer-edition', diff --git a/modules/worker/front/time-control/index.spec.js b/modules/worker/front/time-control/index.spec.js index 920f13e7c..39a47c47f 100644 --- a/modules/worker/front/time-control/index.spec.js +++ b/modules/worker/front/time-control/index.spec.js @@ -129,5 +129,28 @@ describe('Component vnWorkerTimeControl', () => { expect(controller.fetchHours).toHaveBeenCalledWith(); }); }); + + describe('$postLink() ', () => { + it(`should set the controller date as today if no timestamp is defined`, () => { + controller.$.model = {applyFilter: jest.fn().mockReturnValue(Promise.resolve())}; + controller.$params = {timestamp: undefined}; + controller.$postLink(); + + expect(controller.date).toEqual(jasmine.any(Date)); + }); + + it(`should set the controller date using the received timestamp`, () => { + const date = 'Wed, 31 Dec 1969 23:00:00 GMT'; + const timestamp = 1; + + controller.$.model = {applyFilter: jest.fn().mockReturnValue(Promise.resolve())}; + controller.$.calendar = {}; + controller.$params = {timestamp: timestamp}; + + controller.$postLink(); + + expect(controller.date.toUTCString()).toEqual(date); + }); + }); }); }); From 594f258232435b841c11b956aaec32aa1d66a987 Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 30 Nov 2021 07:16:43 +0100 Subject: [PATCH 4/4] modify js date format --- modules/worker/front/time-control/index.spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/worker/front/time-control/index.spec.js b/modules/worker/front/time-control/index.spec.js index 39a47c47f..4f317a5e6 100644 --- a/modules/worker/front/time-control/index.spec.js +++ b/modules/worker/front/time-control/index.spec.js @@ -140,8 +140,8 @@ describe('Component vnWorkerTimeControl', () => { }); it(`should set the controller date using the received timestamp`, () => { - const date = 'Wed, 31 Dec 1969 23:00:00 GMT'; const timestamp = 1; + const date = new Date(timestamp); controller.$.model = {applyFilter: jest.fn().mockReturnValue(Promise.resolve())}; controller.$.calendar = {}; @@ -149,7 +149,7 @@ describe('Component vnWorkerTimeControl', () => { controller.$postLink(); - expect(controller.date.toUTCString()).toEqual(date); + expect(controller.date.toDateString()).toEqual(date.toDateString()); }); }); });