UNPKG

siesta-lite

Version:

Stress-free JavaScript unit testing and functional testing tool, works in NodeJS and browsers

31 lines (23 loc) 728 B
StartTest(t => { t.waitForPollInterval = 10 t.chain( // wait for selector to appear { waitFor : 'Selector', args : [ '.some-css-class' ] }, next => { // Do some cool stuff, selector '.some-css-class' is now in the DOM next() }, // wait for selector to disappear { waitFor : 'SelectorNotFound', args : [ '.some-css-class' ] }, next => { // Do some cool stuff, selector '.some-css-class' is now not in the DOM next() } ); setTimeout(() => { document.body.className = 'some-css-class'; setTimeout(() => { document.body.className = ''; }, 100); }, 100) });