Merge branch 'dev' of https://git.verdnatura.es/salix into dev
This commit is contained in:
commit
024aca6c17
|
@ -204,6 +204,7 @@ describe('Component vnAutocomplete', () => {
|
|||
expect(controller.getItems).toHaveBeenCalledWith();
|
||||
});
|
||||
});
|
||||
|
||||
describe('getItem()', () => {
|
||||
it(`should perfom a query to fill the items without filter`, () => {
|
||||
let controller = $componentController('vnAutocomplete', {$scope, $element, $httpBackend, $timeout}, {url: 'test.com'});
|
||||
|
|
|
@ -48,9 +48,8 @@ class DatePicker extends Component {
|
|||
this._modelView = value;
|
||||
this.input.value = value;
|
||||
this._setModel(value);
|
||||
this.$timeout(
|
||||
() => {
|
||||
this.mdlUpdate();
|
||||
this.$timeout(() => {
|
||||
this.mdlUpdate();
|
||||
}, 500);
|
||||
}
|
||||
onClear() {
|
||||
|
@ -76,9 +75,8 @@ class DatePicker extends Component {
|
|||
return `${dates} ${hours}`.trim();
|
||||
} else if (string.indexOf(':') !== -1) { // only time format
|
||||
return parts.join(':');
|
||||
} else { // only date format
|
||||
return parts.join('-');
|
||||
}
|
||||
} // only date format
|
||||
return parts.join('-');
|
||||
}
|
||||
|
||||
_setModel(value) {
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
import './datePicker.js';
|
||||
|
||||
describe('Component vnDatePicker', () => {
|
||||
let $componentController;
|
||||
let $scope;
|
||||
let $timeout;
|
||||
let $element;
|
||||
let $translate;
|
||||
|
||||
beforeEach(() => {
|
||||
angular.mock.module('client');
|
||||
});
|
||||
|
||||
beforeEach(angular.mock.inject((_$componentController_, $rootScope, _$timeout_) => {
|
||||
$componentController = _$componentController_;
|
||||
$scope = $rootScope.$new();
|
||||
$timeout = _$timeout_;
|
||||
$element = angular.element(`<div><input></div>`);
|
||||
$translate = {};
|
||||
}));
|
||||
|
||||
describe('_formatFlat2Angular()', () => {
|
||||
it(`should format date from Y-m-d to yyyy-MM-dd`, () => {
|
||||
let controller = $componentController('vnDatePicker', {$scope, $element, $translate, $timeout});
|
||||
let formatedDate = controller._formatFlat2Angular(`Y-m-d`);
|
||||
|
||||
expect(formatedDate).toBe('yyyy-MM-dd');
|
||||
});
|
||||
|
||||
it(`should format date from d-m-Y to dd-MM-yyyy`, () => {
|
||||
let controller = $componentController('vnDatePicker', {$scope, $element, $translate, $timeout});
|
||||
let formatedDate = controller._formatFlat2Angular(`d-m-Y`);
|
||||
|
||||
expect(formatedDate).toBe('dd-MM-yyyy');
|
||||
});
|
||||
|
||||
it(`should split the given string into parts`, () => {
|
||||
let controller = $componentController('vnDatePicker', {$scope, $element, $translate, $timeout});
|
||||
controller.iniOptions = {dateFormat: 'd/m/Y'};
|
||||
controller.model = '2017-12-23';
|
||||
|
||||
expect(controller.modelView).toBe('23-12-2017');
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue