MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / withEditor

Function withEditor

src/test/editor.tests.js:35–48  ·  view source on GitHub ↗
(test, fn, initialDoc = "", extensions = [])

Source from the content-addressed store, hash-verified

33 }
34
35 async function withEditor(test, fn, initialDoc = "", extensions = []) {
36 let view, container;
37
38 try {
39 ({ view, container } = createEditor(initialDoc, extensions));
40 test.assert(view != null, "EditorView instance should be created");
41 await new Promise((resolve) => setTimeout(resolve, 100));
42 await fn(view);
43 await new Promise((resolve) => setTimeout(resolve, 200));
44 } finally {
45 if (view) view.destroy();
46 if (container) container.remove();
47 }
48 }
49
50 // =========================================
51 // BASIC EDITOR TESTS

Callers 1

runCodeMirrorTestsFunction · 0.85

Calls 3

createEditorFunction · 0.70
destroyMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected