Fixed problems test e2e

This commit is contained in:
Jorge Padawan 2021-02-02 10:17:13 +01:00
parent 94897a830a
commit 9d96a4a6a1
3 changed files with 14 additions and 9 deletions

View File

@ -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">
</vn-searchbar>
</vn-portal>

View File

@ -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) {

View File

@ -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');
});
});
});