From 9d96a4a6a1dae087adca53bf401b1bb169b87b28 Mon Sep 17 00:00:00 2001 From: Jorge Padawan Date: Tue, 2 Feb 2021 10:17:13 +0100 Subject: [PATCH] Fixed problems test e2e --- modules/route/front/main/index.html | 2 +- modules/route/front/main/index.js | 15 ++++++++++----- modules/route/front/main/index.spec.js | 6 +++--- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/modules/route/front/main/index.html b/modules/route/front/main/index.html index 7be7153af..7d4cd33ee 100644 --- a/modules/route/front/main/index.html +++ b/modules/route/front/main/index.html @@ -10,7 +10,7 @@ panel="vn-route-search-panel" info="Search routes by id" fetch-params="$ctrl.fetchParams($params)" - suggested-filter="$ctrl.filterParams" + filter="$ctrl.filterParams" model="model"> diff --git a/modules/route/front/main/index.js b/modules/route/front/main/index.js index cbebc4369..938f81bcc 100644 --- a/modules/route/front/main/index.js +++ b/modules/route/front/main/index.js @@ -2,12 +2,17 @@ import ngModule from '../module'; import ModuleMain from 'salix/components/module-main'; export default class Route extends ModuleMain { - constructor() { - super(); + $postLink() { + const to = new Date(); + to.setDate(to.getDate() + 1); + to.setHours(0, 0, 0, 0); - this.filterParams = { - scopeDays: 1 - }; + const from = new Date(); + from.setDate(from.getDate()); + from.setHours(0, 0, 0, 0); + + this.filterParams = {from, to}; + this.$.model.applyFilter(null, this.filterParams); } fetchParams($params) { diff --git a/modules/route/front/main/index.spec.js b/modules/route/front/main/index.spec.js index 8aa4b5742..51b194117 100644 --- a/modules/route/front/main/index.spec.js +++ b/modules/route/front/main/index.spec.js @@ -49,13 +49,13 @@ describe('Route Component vnRoute', () => { expect(params.scopeDays).toEqual(2); }); - it('should throw an error when scope days has a string value', () => { + it('should throw an error when scope days is not equal a number', () => { let params = controller.fetchParams({ - scopeDays: 'prueba' + scopeDays: 'ScopeDayNoNumber' }); if (typeof params.scopeDays !== 'number') - expect(params.scopeDays).toBe('prueba'); + expect(params.scopeDays).toBe('ScopeDayNoNumber'); }); }); });