fix tests

This commit is contained in:
Philipp Kühn
2019-06-12 22:31:16 +02:00
parent 352e8c18a7
commit ee4f132b0f
6 changed files with 41 additions and 18 deletions

View File

@@ -1,13 +1,15 @@
export default function (css) {
const style = document.createElement('style')
style.type = 'text/css'
style.textContent = css
const { head } = document
const { firstChild } = head
if (process.env.NODE_ENV !== 'test') {
const style = document.createElement('style')
style.type = 'text/css'
style.textContent = css
const { head } = document
const { firstChild } = head
if (firstChild) {
head.insertBefore(style, firstChild)
} else {
head.appendChild(style)
if (firstChild) {
head.insertBefore(style, firstChild)
} else {
head.appendChild(style)
}
}
}

View File

@@ -1,3 +1,5 @@
// MutationObserver is not supported by JSDom
import MutationObserver from 'mutation-observer'
import Editor from '../src/Editor'
import {
@@ -19,6 +21,8 @@ import {
History,
} from '../../tiptap-extensions'
global.MutationObserver = MutationObserver
test('create editor', () => {
const editor = new Editor()