salix/front/core/components/date-picker/index.spec.js

32 lines
804 B
JavaScript

describe('Component vnDatePicker', () => {
let $filter;
let $element;
let $ctrl;
beforeEach(ngModule('vnCore'));
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`, () => {
let today;
today = new Date();
today.setHours(0, 0, 0, 0);
$ctrl.field = today;
let displayed = $filter('date')(today, 'yyyy-MM-dd');
expect($ctrl.value).toEqual(displayed);
});
});
});