summaryrefslogtreecommitdiff
path: root/spec/frontend/editor/utils_spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/editor/utils_spec.js')
-rw-r--r--spec/frontend/editor/utils_spec.js13
1 files changed, 11 insertions, 2 deletions
diff --git a/spec/frontend/editor/utils_spec.js b/spec/frontend/editor/utils_spec.js
index 97d3e9e081d..e561cad1086 100644
--- a/spec/frontend/editor/utils_spec.js
+++ b/spec/frontend/editor/utils_spec.js
@@ -1,4 +1,5 @@
import { editor as monacoEditor } from 'monaco-editor';
+import { setHTMLFixture, resetHTMLFixture } from 'helpers/fixtures';
import * as utils from '~/editor/utils';
import { DEFAULT_THEME } from '~/ide/lib/themes';
@@ -14,10 +15,14 @@ describe('Source Editor utils', () => {
describe('clearDomElement', () => {
beforeEach(() => {
- setFixtures('<div id="foo"><div id="bar">Foo</div></div>');
+ setHTMLFixture('<div id="foo"><div id="bar">Foo</div></div>');
el = document.getElementById('foo');
});
+ afterEach(() => {
+ resetHTMLFixture();
+ });
+
it('removes all child nodes from an element', () => {
expect(el.children.length).toBe(1);
utils.clearDomElement(el);
@@ -68,10 +73,14 @@ describe('Source Editor utils', () => {
beforeEach(() => {
jest.spyOn(monacoEditor, 'colorizeElement').mockImplementation();
jest.spyOn(monacoEditor, 'setTheme').mockImplementation();
- setFixtures('<pre id="foo"></pre>');
+ setHTMLFixture('<pre id="foo"></pre>');
el = document.getElementById('foo');
});
+ afterEach(() => {
+ resetHTMLFixture();
+ });
+
it('colorizes the element and applies the preference theme', () => {
expect(monacoEditor.colorizeElement).not.toHaveBeenCalled();
expect(monacoEditor.setTheme).not.toHaveBeenCalled();