Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 2295-add_quicklinks
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Carlos Jimenez Ruiz 2020-07-03 16:44:36 +02:00
commit 8794932949
1 changed files with 10 additions and 17 deletions

View File

@ -7,7 +7,7 @@ describe('Component vnInputNumber', () => {
beforeEach(ngModule('vnCore')); beforeEach(ngModule('vnCore'));
beforeEach(angular.mock.inject(($compile, $rootScope) => { beforeEach(angular.mock.inject(($compile, $rootScope) => {
$element = $compile(`<vn-input-number></vn-input-number>`)($rootScope); $element = $compile(`<vn-input-number ng-model="model" />`)($rootScope);
$ctrl = $element.controller('vnInputNumber'); $ctrl = $element.controller('vnInputNumber');
})); }));
@ -20,12 +20,10 @@ describe('Component vnInputNumber', () => {
$ctrl.field = -1; $ctrl.field = -1;
$ctrl.min = 0; $ctrl.min = 0;
// FIXME: Input validation doesn't work with Jest? expect($ctrl.shownError).toContain('Constraints not satisfied');
// expect($ctrl.shownError).toContain('Please select a value that is no less than 0');
expect($ctrl.shownError).toBeNull();
}); });
it(`should unset error property when value is upper than min`, () => { it(`should unset error property when value is greater than min`, () => {
$ctrl.field = 1; $ctrl.field = 1;
$ctrl.min = 0; $ctrl.min = 0;
@ -34,19 +32,16 @@ describe('Component vnInputNumber', () => {
}); });
describe('max() setter', () => { describe('max() setter', () => {
it(`should set error property when value is upper than max`, () => { it(`should set error property when value is greater than max`, () => {
$ctrl.field = 1; $ctrl.field = 1;
$ctrl.max = 0; $ctrl.max = 0;
// FIXME: Input validation doesn't work with Jest? expect($ctrl.shownError).toContain('Constraints not satisfied');
// expect($ctrl.shownError).toContain('Please select a value that is no more than 0');
expect($ctrl.shownError).toBeNull();
}); });
// FIXME: Input validation doesn't work with Jest?
it(`should unset error property when value is lower than max`, () => { it(`should unset error property when value is lower than max`, () => {
$ctrl.field = -1; $ctrl.field = -1;
$ctrl.min = 0; $ctrl.max = 0;
expect($ctrl.shownError).toBeNull(); expect($ctrl.shownError).toBeNull();
}); });
@ -54,14 +49,12 @@ describe('Component vnInputNumber', () => {
describe('step() setter', () => { describe('step() setter', () => {
it(`should increase value when add icon is clicked`, () => { it(`should increase value when add icon is clicked`, () => {
$ctrl.step = 1; $ctrl.input.step = 1;
$ctrl.field = 1; $ctrl.input.value = 0;
// FIXME: Doesn't work with Jest? $ctrl.stepUp();
// $ctrl.stepUp();
// $element[0].querySelector('vn-icon[icon=add]').click();
expect($ctrl.field).toBe(1); expect($ctrl.input.value).toBe('1');
}); });
}); });
}); });