2019-06-06 11:59:11 +00:00
|
|
|
import './index.js';
|
|
|
|
|
2019-06-07 11:07:23 +00:00
|
|
|
describe('Component vnInputFile', () => {
|
2019-06-06 11:59:11 +00:00
|
|
|
let $element;
|
2019-10-28 20:40:24 +00:00
|
|
|
let $scope;
|
2019-06-06 11:59:11 +00:00
|
|
|
let controller;
|
|
|
|
|
2019-10-24 22:53:53 +00:00
|
|
|
beforeEach(ngModule('vnCore'));
|
2019-06-06 11:59:11 +00:00
|
|
|
|
2020-07-23 14:46:16 +00:00
|
|
|
beforeEach(inject(($compile, $rootScope) => {
|
2019-06-06 11:59:11 +00:00
|
|
|
$scope = $rootScope.$new();
|
2019-10-28 20:40:24 +00:00
|
|
|
$element = $compile('<vn-input-file></vn-input-file>')($scope);
|
|
|
|
controller = $element.controller('vnInputFile');
|
2019-06-06 11:59:11 +00:00
|
|
|
}));
|
|
|
|
|
2019-10-28 20:40:24 +00:00
|
|
|
afterAll(() => {
|
|
|
|
$element.remove();
|
|
|
|
$scope.$destroy();
|
|
|
|
});
|
2019-06-06 11:59:11 +00:00
|
|
|
|
2019-10-28 20:40:24 +00:00
|
|
|
describe('field() setter', () => {
|
|
|
|
it(`should set an empty string as value when null value is set`, () => {
|
|
|
|
controller.field = null;
|
2019-06-06 11:59:11 +00:00
|
|
|
|
2019-10-28 20:40:24 +00:00
|
|
|
expect(controller.value).toBe('');
|
2019-06-06 11:59:11 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|