open-nomad/ui/tests/helpers/codemirror.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

20 lines
528 B
JavaScript
Raw Normal View History

export function getCodeMirrorInstance() {
return function () {
return document.querySelector('.CodeMirror').CodeMirror;
};
}
export default function setupCodeMirror(hooks) {
2021-12-28 14:45:20 +00:00
hooks.beforeEach(function () {
this.getCodeMirrorInstance = getCodeMirrorInstance(this.owner);
// Expose to window for access from page objects
window.getCodeMirrorInstance = this.getCodeMirrorInstance;
});
2021-12-28 14:45:20 +00:00
hooks.afterEach(function () {
delete window.getCodeMirrorInstance;
delete this.getCodeMirrorInstance;
});
}