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', () => { ...@@ -63,12 +63,15 @@ describe('Autosave', () => {
expect(field.trigger).toHaveBeenCalled(); expect(field.trigger).toHaveBeenCalled();
}); });
it('triggers native event', done => { it('triggers native event', () => {
autosave.field.get(0).addEventListener('change', () => { const fieldElement = autosave.field.get(0);
done(); const eventHandler = jest.fn();
}); fieldElement.addEventListener('change', eventHandler);
Autosave.prototype.restore.call(autosave); 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