Make native event test in autosave_spec.js synchronous
This commit is contained in:
parent
3ac4a2989d
commit
208cc38d98
1 changed files with 7 additions and 4 deletions
|
@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue