import './drop-down.js'; import template from './drop-down.html'; describe('Component vnDropDown', () => { let $componentController; let $timeout; let $element; let $scope; let $httpBackend; let $q; let $filter; let controller; beforeEach(() => { angular.mock.module('client'); }); beforeEach(angular.mock.inject((_$componentController_, $rootScope, _$timeout_, _$httpBackend_, _$q_, _$filter_) => { $componentController = _$componentController_; $element = angular.element(`
${template}
`); $timeout = _$timeout_; $q = _$q_; $filter = _$filter_; $scope = $rootScope.$new(); $httpBackend = _$httpBackend_; $httpBackend.when('GET', /\/locale\/\w+\/[a-z]{2}\.json/).respond({}); $scope.model = $componentController('vnModel', {$httpBackend, $q, $filter}); controller = $componentController('vnDropDown', {$element, $scope, $transclude: null, $timeout, $httpBackend, $translate: null}); controller.parent = angular.element('')[0]; })); describe('show() method', () => { it(`should define controllers _show using the value received as argument`, () => { controller.show(); expect(controller.shown).toEqual(true); }); }); describe('hide() method', () => { it(`should define controllers _show using the value received as argument`, () => { controller.hide(); expect(controller.shown).toEqual(false); }); }); });