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:
@@ -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>
|
||||||
|
@@ -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)
|
||||||
|
Reference in New Issue
Block a user