salix/client/core/src/components/drop-down/drop-down.spec.js

49 lines
1.5 KiB
JavaScript
Raw Normal View History

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