2017-10-11 10:57:13 +00:00
|
|
|
import './drop-down.js';
|
2018-03-09 13:15:30 +00:00
|
|
|
import template from './drop-down.html';
|
2017-10-11 10:57:13 +00:00
|
|
|
|
|
|
|
describe('Component vnDropDown', () => {
|
|
|
|
let $componentController;
|
|
|
|
let $timeout;
|
|
|
|
let $element;
|
2018-03-09 13:15:30 +00:00
|
|
|
let $scope;
|
|
|
|
let $httpBackend;
|
|
|
|
let $q;
|
2017-10-11 10:57:13 +00:00
|
|
|
let $filter;
|
2017-10-17 12:24:40 +00:00
|
|
|
let controller;
|
2017-10-11 10:57:13 +00:00
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
angular.mock.module('client');
|
|
|
|
});
|
|
|
|
|
2018-03-09 13:15:30 +00:00
|
|
|
beforeEach(angular.mock.inject((_$componentController_, $rootScope, _$timeout_, _$httpBackend_, _$q_, _$filter_) => {
|
2017-10-11 10:57:13 +00:00
|
|
|
$componentController = _$componentController_;
|
2018-03-09 13:15:30 +00:00
|
|
|
$element = angular.element(`<div>${template}</div>`);
|
2017-10-11 10:57:13 +00:00
|
|
|
$timeout = _$timeout_;
|
2018-03-09 13:15:30 +00:00
|
|
|
$q = _$q_;
|
2017-10-11 10:57:13 +00:00
|
|
|
$filter = _$filter_;
|
2018-03-09 13:15:30 +00:00
|
|
|
$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});
|
2017-11-22 12:10:33 +00:00
|
|
|
controller.parent = angular.element('<vn-parent></vn-parent>')[0];
|
2017-10-11 10:57:13 +00:00
|
|
|
}));
|
|
|
|
|
2018-03-09 13:15:30 +00:00
|
|
|
describe('show() method', () => {
|
2017-10-11 10:57:13 +00:00
|
|
|
it(`should define controllers _show using the value received as argument`, () => {
|
2018-03-09 13:15:30 +00:00
|
|
|
controller.show();
|
2017-10-11 10:57:13 +00:00
|
|
|
|
2018-03-09 13:15:30 +00:00
|
|
|
expect(controller.shown).toEqual(true);
|
2017-10-11 10:57:13 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2018-03-09 13:15:30 +00:00
|
|
|
describe('hide() method', () => {
|
|
|
|
it(`should define controllers _show using the value received as argument`, () => {
|
|
|
|
controller.hide();
|
2017-10-13 08:23:28 +00:00
|
|
|
|
2018-03-09 13:15:30 +00:00
|
|
|
expect(controller.shown).toEqual(false);
|
2017-10-13 08:23:28 +00:00
|
|
|
});
|
|
|
|
});
|
2017-10-11 10:57:13 +00:00
|
|
|
});
|