2019-10-04 10:33:16 +00:00
|
|
|
describe('Component vnRadio', () => {
|
2019-02-19 06:04:56 +00:00
|
|
|
let $element;
|
2019-09-30 18:46:22 +00:00
|
|
|
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) => {
|
2019-10-04 10:33:16 +00:00
|
|
|
$element = $compile(`<vn-radio val="myVal"></vn-radio`)($rootScope);
|
|
|
|
$ctrl = $element.controller('vnRadio');
|
2019-09-30 18:46:22 +00:00
|
|
|
element = $element[0];
|
2019-02-19 06:04:56 +00:00
|
|
|
}));
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
$element.remove();
|
|
|
|
});
|
|
|
|
|
2019-09-30 18:46:22 +00:00
|
|
|
describe('field() setter', () => {
|
2019-10-04 10:33:16 +00:00
|
|
|
it(`should change field value when clicked`, () => {
|
2019-09-30 18:46:22 +00:00
|
|
|
element.click();
|
2019-02-19 06:04:56 +00:00
|
|
|
|
2019-10-04 10:33:16 +00:00
|
|
|
expect($ctrl.field).toEqual('myVal');
|
2019-02-19 06:04:56 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|