salix/front/core/components/input-time/index.spec.js

31 lines
741 B
JavaScript
Raw Normal View History

2018-09-19 13:05:07 +00:00
import './index.js';
2019-09-09 08:57:10 +00:00
describe('Component vnInputTime', () => {
let $filter;
2018-09-19 13:05:07 +00:00
let $element;
let $ctrl;
2018-09-19 13:05:07 +00:00
beforeEach(ngModule('vnCore'));
2018-09-19 13:05:07 +00:00
2020-07-23 14:46:16 +00:00
beforeEach(inject(($compile, $rootScope, _$filter_) => {
$filter = _$filter_;
2018-09-19 13:05:07 +00:00
$element = $compile(`<vn-input-time></vn-input-time>`)($rootScope);
$ctrl = $element.controller('vnInputTime');
}));
2018-09-19 13:05:07 +00:00
afterEach(() => {
$element.remove();
});
2018-09-19 13:05:07 +00:00
describe('field() setter', () => {
it(`should display the formated the date`, () => {
let date = new Date();
$ctrl.field = date;
let displayed = $filter('date')(date, 'HH:mm');
2018-09-19 13:05:07 +00:00
expect($ctrl.value).toEqual(displayed);
2018-09-19 13:05:07 +00:00
});
});
});