50 lines
1.2 KiB
JavaScript
50 lines
1.2 KiB
JavaScript
import './spinner.js';
|
|
|
|
describe('Component vnSpinner', () => {
|
|
let $element;
|
|
let controller;
|
|
|
|
beforeEach(ngModule('vnCore'));
|
|
|
|
beforeEach(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`, () => {
|
|
jest.spyOn(controller, 'start');
|
|
controller.enable = true;
|
|
|
|
expect(controller.start).toHaveBeenCalledWith();
|
|
});
|
|
|
|
it(`should call stop() when enable is set to false`, () => {
|
|
jest.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();
|
|
});
|
|
});
|
|
});
|