40 lines
1.1 KiB
JavaScript
40 lines
1.1 KiB
JavaScript
|
import './index.js';
|
||
|
|
||
|
describe('Component vnTextarea', () => {
|
||
|
let $element;
|
||
|
let $ctrl;
|
||
|
|
||
|
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||
|
$translateProvider.translations('en', {});
|
||
|
}));
|
||
|
|
||
|
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);
|
||
|
});
|
||
|
});
|
||
|
});
|