2018-09-19 13:05:07 +00:00
|
|
|
import './index.js';
|
|
|
|
|
2019-09-09 08:57:10 +00:00
|
|
|
describe('Component vnInputTime', () => {
|
2019-10-08 21:57:02 +00:00
|
|
|
let $filter;
|
2018-09-19 13:05:07 +00:00
|
|
|
let $element;
|
2019-10-08 21:57:02 +00:00
|
|
|
let $ctrl;
|
2018-09-19 13:05:07 +00:00
|
|
|
|
2019-10-24 22:53:53 +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_) => {
|
2019-10-08 21:57:02 +00:00
|
|
|
$filter = _$filter_;
|
2018-09-19 13:05:07 +00:00
|
|
|
|
2019-10-08 21:57:02 +00:00
|
|
|
$element = $compile(`<vn-input-time></vn-input-time>`)($rootScope);
|
|
|
|
$ctrl = $element.controller('vnInputTime');
|
|
|
|
}));
|
2018-09-19 13:05:07 +00:00
|
|
|
|
2019-10-08 21:57:02 +00:00
|
|
|
afterEach(() => {
|
|
|
|
$element.remove();
|
|
|
|
});
|
2018-09-19 13:05:07 +00:00
|
|
|
|
2019-10-08 21:57:02 +00:00
|
|
|
describe('field() setter', () => {
|
|
|
|
it(`should display the formated the date`, () => {
|
|
|
|
let date = new Date();
|
|
|
|
$ctrl.field = date;
|
2019-10-18 23:18:25 +00:00
|
|
|
let displayed = $filter('date')(date, 'HH:mm');
|
2018-09-19 13:05:07 +00:00
|
|
|
|
2019-10-08 21:57:02 +00:00
|
|
|
expect($ctrl.value).toEqual(displayed);
|
2018-09-19 13:05:07 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|