1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-21 06:31:28 +02:00

switch html-serializer tests to use jsdom

This commit is contained in:
Ian Storm Taylor
2018-01-04 15:20:02 -08:00
parent a6c56a2c56
commit e01a2e2dfb
3 changed files with 292 additions and 777 deletions

View File

@@ -30,9 +30,7 @@
"is-hotkey": "^0.1.1", "is-hotkey": "^0.1.1",
"is-image": "^1.0.1", "is-image": "^1.0.1",
"is-url": "^1.2.2", "is-url": "^1.2.2",
"jest": "^17.0.3", "jsdom": "^11.5.1",
"jsdom": "9.6.0",
"jsdom-global": "2.1.0",
"lerna": "^2.1.2", "lerna": "^2.1.2",
"matcha": "^0.7.0", "matcha": "^0.7.0",
"mocha": "^2.5.3", "mocha": "^2.5.3",

View File

@@ -12,7 +12,7 @@ import 'babel-polyfill' // eslint-disable-line import/no-extraneous-dependencies
import Html from '..' import Html from '..'
import assert from 'assert' import assert from 'assert'
import fs from 'fs' import fs from 'fs'
import parse5 from 'parse5' // eslint-disable-line import/no-extraneous-dependencies import { JSDOM } from 'jsdom' // eslint-disable-line import/no-extraneous-dependencies
import { Value, resetKeyGenerator } from 'slate' import { Value, resetKeyGenerator } from 'slate'
import { basename, extname, resolve } from 'path' import { basename, extname, resolve } from 'path'
@@ -37,7 +37,7 @@ describe('slate-html-serializer', () => {
it(test, async () => { it(test, async () => {
const module = require(resolve(dir, test)) const module = require(resolve(dir, test))
const { input, output, config, options } = module const { input, output, config, options } = module
const html = new Html({ parseHtml: parse5.parseFragment, ...config }) const html = new Html({ parseHtml: JSDOM.fragment, ...config })
const value = html.deserialize(input, options) const value = html.deserialize(input, options)
const actual = Value.isValue(value) ? value.toJSON() : value const actual = Value.isValue(value) ? value.toJSON() : value
const expected = Value.isValue(output) ? output.toJSON() : output const expected = Value.isValue(output) ? output.toJSON() : output
@@ -54,7 +54,7 @@ describe('slate-html-serializer', () => {
it(test, async () => { it(test, async () => {
const module = require(resolve(dir, test)) const module = require(resolve(dir, test))
const { input, output, rules, options } = module const { input, output, rules, options } = module
const html = new Html({ rules, parseHtml: parse5.parseFragment }) const html = new Html({ rules, parseHtml: JSDOM.fragment })
const string = html.serialize(input, options) const string = html.serialize(input, options)
const actual = string const actual = string
const expected = output const expected = output

1059
yarn.lock

File diff suppressed because it is too large Load Diff