52 lines
1.3 KiB
JavaScript
52 lines
1.3 KiB
JavaScript
import './spinner.js';
|
|
|
|
describe('Component vnSpinner', () => {
|
|
let $element;
|
|
let controller;
|
|
|
|
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
|
$translateProvider.translations('en', {});
|
|
}));
|
|
|
|
beforeEach(angular.mock.inject(($compile, $rootScope) => {
|
|
$element = $compile(`<vn-spinner></vn-spinner>`)($rootScope);
|
|
controller = $element.controller('vnSpinner');
|
|
}));
|
|
|
|
afterEach(() => {
|
|
$element.remove();
|
|
});
|
|
|
|
describe('enable()', () => {
|
|
it(`should call start() when enable is set to true`, () => {
|
|
spyOn(controller, 'start');
|
|
controller.enable = true;
|
|
|
|
expect(controller.start).toHaveBeenCalledWith();
|
|
});
|
|
|
|
it(`should call stop() when enable is set to false`, () => {
|
|
spyOn(controller, 'stop');
|
|
controller.enable = false;
|
|
|
|
expect(controller.stop).toHaveBeenCalledWith();
|
|
});
|
|
});
|
|
|
|
describe('start()', () => {
|
|
it(`should set enable to true`, () => {
|
|
controller.start();
|
|
|
|
expect(controller.enable).toBeTruthy();
|
|
});
|
|
});
|
|
|
|
describe('stop()', () => {
|
|
it(`should set enable to false`, () => {
|
|
controller.stop();
|
|
|
|
expect(controller.enable).toBeFalsy();
|
|
});
|
|
});
|
|
});
|