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

38 lines
1015 B
JavaScript
Raw Normal View History

2019-10-09 22:47:29 +00:00
import './index.js';
describe('Component vnTextarea', () => {
let $element;
let $ctrl;
beforeEach(ngModule('vnCore'));
2019-10-09 22:47:29 +00:00
beforeEach(angular.mock.inject(($compile, $rootScope) => {
$element = $compile(`<vn-textarea></vn-textarea>`)($rootScope);
$ctrl = $element.controller('vnTextarea');
}));
afterEach(() => {
$element.remove();
});
describe('rows() setter', () => {
it(`should set rows property of the element to the given value if it's a valid number`, () => {
$ctrl.rows = 27;
expect($ctrl.rows).toEqual(27);
});
it(`should set rows property of the element to 3 if the given value if it's null`, () => {
$ctrl.rows = null;
expect($ctrl.rows).toEqual(3);
});
it(`should set rows property of the element to 3 if the given value if it's not a valid number`, () => {
$ctrl.rows = 'a';
expect($ctrl.rows).toEqual(3);
});
});
});