This repository has been archived on 2024-10-24. You can view files and clone it, but cannot push or open issues or pull requests.
fradrive-old/frontend/src/utils/check-all/check-all.spec.js

35 lines
767 B
JavaScript

import { CheckAll, CHECK_ALL_INITIALIZED_CLASS } from './check-all';
const MOCK_APP = {
utilRegistry: {
initAll: () => {},
},
};
describe('CheckAll', () => {
let checkAll;
beforeEach(() => {
const element = document.createElement('table');
checkAll = new CheckAll(element, MOCK_APP);
});
it('should create', () => {
expect(checkAll).toBeTruthy();
});
it('should throw if called without an element', () => {
expect(() => {
new CheckAll();
}).toThrow();
});
it('should destroy CheckAll', () => {
checkAll.destroy();
expect(checkAll._eventManager._registeredListeners.length).toBe(0);
expect(checkAll._element.classList).not.toEqual(jasmine.arrayContaining([CHECK_ALL_INITIALIZED_CLASS]));
});
});