Commit 208cc38d authored by Winnie Hellmann's avatar Winnie Hellmann Committed by Kushal Pandya

Make native event test in autosave_spec.js synchronous

parent 3ac4a298
......@@ -63,12 +63,15 @@ describe('Autosave', () => {
expect(field.trigger).toHaveBeenCalled();
});
it('triggers native event', done => {
autosave.field.get(0).addEventListener('change', () => {
done();
});
it('triggers native event', () => {
const fieldElement = autosave.field.get(0);
const eventHandler = jest.fn();
fieldElement.addEventListener('change', eventHandler);
Autosave.prototype.restore.call(autosave);
expect(eventHandler).toHaveBeenCalledTimes(1);
fieldElement.removeEventListener('change', eventHandler);
});
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment