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-09-13 14:09:14 +00:00
|
|
|
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
|
|
|
$translateProvider.translations('en', {});
|
|
|
|
}));
|
2018-09-19 13:05:07 +00:00
|
|
|
|
2019-10-08 21:57:02 +00:00
|
|
|
beforeEach(angular.mock.inject(($compile, $rootScope, _$filter_) => {
|
|
|
|
$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
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|