1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-21 14:41:23 +02:00

Change operation tests to take a list of operations

This commit is contained in:
Justin Weiss
2018-01-10 15:36:09 -08:00
parent a6b069603f
commit 4781a0ea66
2 changed files with 9 additions and 11 deletions

View File

@@ -2,15 +2,13 @@
import h from '../../../helpers/h' import h from '../../../helpers/h'
export default function (change) { export default [{
return change.applyOperation({ type: 'remove_text',
type: 'remove_text', path: [0, 0],
path: [0, 0], offset: 2,
offset: 2, text: 'is is some text inside ',
text: 'is is some text inside ', marks: []
marks: [] }]
})
}
export const input = ( export const input = (
<value> <value>

View File

@@ -26,9 +26,9 @@ describe('operations', async () => {
it(test, async () => { it(test, async () => {
const module = require(resolve(testDir, test)) const module = require(resolve(testDir, test))
const { input, output } = module const { input, output } = module
const fn = module.default const operations = module.default
const change = input.change() const change = input.change()
fn(change) change.applyOperations(operations)
const opts = { preserveSelection: true, preserveData: true } const opts = { preserveSelection: true, preserveData: true }
const actual = change.value.toJSON(opts) const actual = change.value.toJSON(opts)
const expected = output.toJSON(opts) const expected = output.toJSON(opts)