github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/ui/tests/helpers/codemirror.js (about)

     1  export function getCodeMirrorInstance() {
     2    return function () {
     3      return document.querySelector('.CodeMirror').CodeMirror;
     4    };
     5  }
     6  
     7  export default function setupCodeMirror(hooks) {
     8    hooks.beforeEach(function () {
     9      this.getCodeMirrorInstance = getCodeMirrorInstance(this.owner);
    10  
    11      // Expose to window for access from page objects
    12      window.getCodeMirrorInstance = this.getCodeMirrorInstance;
    13    });
    14  
    15    hooks.afterEach(function () {
    16      delete window.getCodeMirrorInstance;
    17      delete this.getCodeMirrorInstance;
    18    });
    19  }