2
0
mirror of https://github.com/iconify/iconify.git synced 2024-11-09 23:00:56 +00:00
iconify/components/svg-framework/tests/ready-test.ts
2022-05-12 22:39:56 +03:00

26 lines
616 B
TypeScript

import { cleanupGlobals, setupDOM } from './helpers';
import { onReady } from '../src/helpers/ready';
describe('Testing onReady callback', () => {
afterEach(cleanupGlobals);
it('Testing onReady before DOM is loaded', (done) => {
setupDOM('');
expect(document.readyState).toBe('loading');
onReady(() => {
done();
});
});
it('Testing onReady after DOM is loaded', (done) => {
setupDOM('');
expect(document.readyState).toBe('loading');
document.addEventListener('DOMContentLoaded', () => {
expect(document.readyState).toBe('interactive');
onReady(() => {
done();
});
});
});
});