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

33 lines
847 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
2019-09-13 14:09:14 +00:00
beforeEach(angular.mock.module('vnCore', $translateProvider => {
$translateProvider.translations('en', {});
}));
2018-09-19 13:05:07 +00:00
beforeEach(angular.mock.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
});
});
});