Commit ba30e5de authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'winh-autosave_spec-sync' into 'master'

Make native event test in autosave_spec.js synchronous

See merge request gitlab-org/gitlab-ce!32003
parents 3ac4a298 208cc38d
......@@ -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