mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-02-01 13:18:29 +01:00
58c644323f
* Run mocha test with module alias * Running test with babel module alias * Fix model alias * Fix model alias * Resolve module alias * Running test with babel module alias * Connect to codecov * add codecov to travis * stop if yarn test has errors * Still cannot collect data from slate modules * Try to check whether it works with codecov * Move config to nycrc * Remove nyc require * Update nyc to use src * better before_script
26 lines
949 B
JavaScript
26 lines
949 B
JavaScript
import Html from 'slate-html-serializer'
|
|
import assert from 'assert'
|
|
import { JSDOM } from 'jsdom'
|
|
import { Value } from 'slate'
|
|
import { fixtures } from 'slate-dev-test-utils'
|
|
|
|
describe('slate-html-serializer', () => {
|
|
fixtures(__dirname, 'deserialize', ({ module }) => {
|
|
const { input, output, config, options } = module
|
|
const html = new Html({ parseHtml: JSDOM.fragment, ...config })
|
|
const value = html.deserialize(input, options)
|
|
const actual = Value.isValue(value) ? value.toJSON() : value
|
|
const expected = Value.isValue(output) ? output.toJSON() : output
|
|
assert.deepEqual(actual, expected)
|
|
})
|
|
|
|
fixtures(__dirname, 'serialize', ({ module }) => {
|
|
const { input, output, rules, options } = module
|
|
const html = new Html({ rules, parseHtml: JSDOM.fragment })
|
|
const string = html.serialize(input, options)
|
|
const actual = string
|
|
const expected = output
|
|
assert.deepEqual(actual, expected)
|
|
})
|
|
})
|