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

33 lines
847 B
JavaScript

import './index.js';
describe('Component vnInputTime', () => {
let $filter;
let $element;
let $ctrl;
beforeEach(angular.mock.module('vnCore', $translateProvider => {
$translateProvider.translations('en', {});
}));
beforeEach(angular.mock.inject(($compile, $rootScope, _$filter_) => {
$filter = _$filter_;
$element = $compile(`<vn-input-time></vn-input-time>`)($rootScope);
$ctrl = $element.controller('vnInputTime');
}));
afterEach(() => {
$element.remove();
});
describe('field() setter', () => {
it(`should display the formated the date`, () => {
let date = new Date();
$ctrl.field = date;
let displayed = $filter('date')(date, 'HH:mm');
expect($ctrl.value).toEqual(displayed);
});
});
});