2019-10-08 21:57:02 +00:00
|
|
|
describe('Component vnDatePicker', () => {
|
|
|
|
let $filter;
|
|
|
|
let $element;
|
|
|
|
let $ctrl;
|
|
|
|
|
|
|
|
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
|
|
|
$translateProvider.translations('en', {});
|
|
|
|
}));
|
|
|
|
|
|
|
|
beforeEach(angular.mock.inject(($compile, $rootScope, _$filter_) => {
|
|
|
|
$filter = _$filter_;
|
|
|
|
|
|
|
|
$element = $compile(`<vn-date-picker></vn-date-picker>`)($rootScope);
|
|
|
|
$ctrl = $element.controller('vnDatePicker');
|
|
|
|
}));
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
$element.remove();
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('field() setter', () => {
|
|
|
|
it(`should display the formated the date`, () => {
|
2019-10-15 14:19:35 +00:00
|
|
|
let today;
|
|
|
|
today = new Date();
|
2019-10-18 23:18:25 +00:00
|
|
|
today.setHours(0, 0, 0, 0);
|
2019-10-08 21:57:02 +00:00
|
|
|
|
|
|
|
$ctrl.field = today;
|
2019-10-18 23:18:25 +00:00
|
|
|
let displayed = $filter('date')(today, 'yyyy-MM-dd');
|
2019-10-08 21:57:02 +00:00
|
|
|
|
|
|
|
expect($ctrl.value).toEqual(displayed);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|