@tigerface/lwc-test-utils
Version:
A collection of helpful utility functions for unit testing LWC components with Jest.
21 lines (14 loc) • 390 B
text/typescript
import { TestUtils } from '../src/index';
function simulateAsyncDomUpdate() {
const doc = document;
process.nextTick(() => {
doc.body.style.display = 'flex';
});
}
describe('TestUtils', () => {
it('waits for async dom updates', async () => {
simulateAsyncDomUpdate()
await TestUtils.flushPromises();
expect(document.body.style.display).toBe('flex');
});
});