Update browser/component-tests to use `await raf()`
nojvek opened this issue · 1 comments
nojvek commented
Currently we use done()
and callbacks but async would be better style
window.requestAnimationFrame(() => {
childEl = el.getElementsByTagName(`nested-child`)[0];
done();
});
Example: test/server/component.js
it('applies only the last state in a given frame', async function() {
...
expect(domPatcher.el.textContent).to.eql('Value of foo: bar');
await raf();
expect(domPatcher.el.textContent).to.eql('Value of foo: whew');
});
tdumitrescu commented
Yup, see https://github.com/mixpanel/panel/blob/2c1ff8f1f99cb873aca1d49aa20f9e08c760f7f7/test/server/component.js for existing usage examples from the server-side tests that we can also use client-side now that browser test modules are transpiled for all supported browsers.