salix/front/core/components/radio/index.spec.js

28 lines
697 B
JavaScript
Raw Normal View History

describe('Component vnRadio', () => {
2019-02-19 06:04:56 +00:00
let $element;
let $ctrl;
let element;
2019-02-19 06:04:56 +00:00
2019-09-13 14:09:14 +00:00
beforeEach(angular.mock.module('vnCore', $translateProvider => {
$translateProvider.translations('en', {});
}));
2019-02-19 06:04:56 +00:00
beforeEach(inject(($compile, $rootScope) => {
$element = $compile(`<vn-radio val="myVal"></vn-radio`)($rootScope);
$ctrl = $element.controller('vnRadio');
element = $element[0];
2019-02-19 06:04:56 +00:00
}));
afterEach(() => {
$element.remove();
});
describe('field() setter', () => {
it(`should change field value when clicked`, () => {
element.click();
2019-02-19 06:04:56 +00:00
expect($ctrl.field).toEqual('myVal');
2019-02-19 06:04:56 +00:00
});
});
});