salix/front/core/components/drop-down/drop-down.spec.js

35 lines
917 B
JavaScript

describe('Component vnDropDown', () => {
let $element;
let controller;
beforeEach(angular.mock.module('vnCore', $translateProvider => {
$translateProvider.translations('en', {});
}));
beforeEach(inject(($compile, $rootScope, $document) => {
$element = $compile(`<vn-drop-down></vn-drop-down>`)($rootScope);
$document.find('body').append($element);
controller = $element.controller('vnDropDown');
}));
afterEach(() => {
$element.remove();
});
describe('show() method', () => {
it(`should enable the show property`, () => {
controller.show();
expect(controller.shown).toEqual(true);
});
});
describe('hide() method', () => {
it(`should disable the show property`, () => {
controller.hide();
expect(controller.shown).toEqual(false);
});
});
});