import './index.js'; describe('Component vnTextarea', () => { let $element; let $ctrl; beforeEach(ngModule('vnCore')); beforeEach(angular.mock.inject(($compile, $rootScope) => { $element = $compile(``)($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); }); }); });