mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-09-09 14:40:41 +02:00
Update benchmark to use Value (#1420)
This commit is contained in:
committed by
Ian Storm Taylor
parent
0d43d26f91
commit
aec62f06ba
@@ -35,7 +35,7 @@ export default function (state) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const input = (
|
export const input = (
|
||||||
<state>
|
<value>
|
||||||
<document>
|
<document>
|
||||||
{Array.from(Array(10)).map(() => (
|
{Array.from(Array(10)).map(() => (
|
||||||
<quote>
|
<quote>
|
||||||
@@ -45,5 +45,5 @@ export const input = (
|
|||||||
</quote>
|
</quote>
|
||||||
))}
|
))}
|
||||||
</document>
|
</document>
|
||||||
</state>
|
</value>
|
||||||
)
|
)
|
||||||
|
@@ -9,7 +9,7 @@ export default function (state) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const input = (
|
export const input = (
|
||||||
<state>
|
<value>
|
||||||
<document>
|
<document>
|
||||||
{Array.from(Array(10)).map(() => (
|
{Array.from(Array(10)).map(() => (
|
||||||
<quote>
|
<quote>
|
||||||
@@ -21,5 +21,5 @@ export const input = (
|
|||||||
</quote>
|
</quote>
|
||||||
))}
|
))}
|
||||||
</document>
|
</document>
|
||||||
</state>
|
</value>
|
||||||
)
|
)
|
||||||
|
@@ -6,13 +6,13 @@ import ReactDOM from 'react-dom/server'
|
|||||||
import h from '../../test/helpers/h'
|
import h from '../../test/helpers/h'
|
||||||
import { Editor } from '../..'
|
import { Editor } from '../..'
|
||||||
|
|
||||||
export default function (state) {
|
export default function (value) {
|
||||||
const el = React.createElement(Editor, { state })
|
const el = React.createElement(Editor, { value })
|
||||||
ReactDOM.renderToStaticMarkup(el)
|
ReactDOM.renderToStaticMarkup(el)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const input = (
|
export const input = (
|
||||||
<state>
|
<value>
|
||||||
<document>
|
<document>
|
||||||
{Array.from(Array(10)).map(() => (
|
{Array.from(Array(10)).map(() => (
|
||||||
<quote>
|
<quote>
|
||||||
@@ -24,5 +24,5 @@ export const input = (
|
|||||||
</quote>
|
</quote>
|
||||||
))}
|
))}
|
||||||
</document>
|
</document>
|
||||||
</state>
|
</value>
|
||||||
)
|
)
|
||||||
|
@@ -7,13 +7,13 @@ export default function (change) {
|
|||||||
change.deleteBackward()
|
change.deleteBackward()
|
||||||
}
|
}
|
||||||
|
|
||||||
export function before(state) {
|
export function before(value) {
|
||||||
const change = state.change()
|
const change = value.change()
|
||||||
return change
|
return change
|
||||||
}
|
}
|
||||||
|
|
||||||
export const input = (
|
export const input = (
|
||||||
<state>
|
<value>
|
||||||
<document>
|
<document>
|
||||||
{Array.from(Array(10)).map((v, i) => (
|
{Array.from(Array(10)).map((v, i) => (
|
||||||
<quote>
|
<quote>
|
||||||
@@ -26,5 +26,5 @@ export const input = (
|
|||||||
</quote>
|
</quote>
|
||||||
))}
|
))}
|
||||||
</document>
|
</document>
|
||||||
</state>
|
</value>
|
||||||
)
|
)
|
||||||
|
@@ -7,13 +7,13 @@ export default function (change) {
|
|||||||
change.deleteForward()
|
change.deleteForward()
|
||||||
}
|
}
|
||||||
|
|
||||||
export function before(state) {
|
export function before(value) {
|
||||||
const change = state.change()
|
const change = value.change()
|
||||||
return change
|
return change
|
||||||
}
|
}
|
||||||
|
|
||||||
export const input = (
|
export const input = (
|
||||||
<state>
|
<value>
|
||||||
<document>
|
<document>
|
||||||
{Array.from(Array(10)).map((v, i) => (
|
{Array.from(Array(10)).map((v, i) => (
|
||||||
<quote>
|
<quote>
|
||||||
@@ -26,5 +26,5 @@ export const input = (
|
|||||||
</quote>
|
</quote>
|
||||||
))}
|
))}
|
||||||
</document>
|
</document>
|
||||||
</state>
|
</value>
|
||||||
)
|
)
|
||||||
|
@@ -10,15 +10,15 @@ export default function ({ change, keys }) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function before(state) {
|
export function before(value) {
|
||||||
const change = state.change()
|
const change = value.change()
|
||||||
const keys = state.document.getTexts().toArray().map(t => t.key)
|
const keys = value.document.getTexts().toArray().map(t => t.key)
|
||||||
__clear()
|
__clear()
|
||||||
return { change, keys }
|
return { change, keys }
|
||||||
}
|
}
|
||||||
|
|
||||||
export const input = (
|
export const input = (
|
||||||
<state>
|
<value>
|
||||||
<document>
|
<document>
|
||||||
{Array.from(Array(10)).map((v, i) => (
|
{Array.from(Array(10)).map((v, i) => (
|
||||||
<quote>
|
<quote>
|
||||||
@@ -31,5 +31,5 @@ export const input = (
|
|||||||
</quote>
|
</quote>
|
||||||
))}
|
))}
|
||||||
</document>
|
</document>
|
||||||
</state>
|
</value>
|
||||||
)
|
)
|
||||||
|
@@ -8,15 +8,15 @@ export default function ({ change, text }) {
|
|||||||
change.insertTextByKey(text.key, 0, 'a')
|
change.insertTextByKey(text.key, 0, 'a')
|
||||||
}
|
}
|
||||||
|
|
||||||
export function before(state) {
|
export function before(value) {
|
||||||
const change = state.change()
|
const change = value.change()
|
||||||
const text = state.document.getLastText()
|
const text = value.document.getLastText()
|
||||||
__clear()
|
__clear()
|
||||||
return { change, text }
|
return { change, text }
|
||||||
}
|
}
|
||||||
|
|
||||||
export const input = (
|
export const input = (
|
||||||
<state>
|
<value>
|
||||||
<document>
|
<document>
|
||||||
{Array.from(Array(10)).map((v, i) => (
|
{Array.from(Array(10)).map((v, i) => (
|
||||||
<quote>
|
<quote>
|
||||||
@@ -29,5 +29,5 @@ export const input = (
|
|||||||
</quote>
|
</quote>
|
||||||
))}
|
))}
|
||||||
</document>
|
</document>
|
||||||
</state>
|
</value>
|
||||||
)
|
)
|
||||||
|
@@ -7,13 +7,13 @@ export default function (change) {
|
|||||||
change.insertText('a')
|
change.insertText('a')
|
||||||
}
|
}
|
||||||
|
|
||||||
export function before(state) {
|
export function before(value) {
|
||||||
const change = state.change()
|
const change = value.change()
|
||||||
return change
|
return change
|
||||||
}
|
}
|
||||||
|
|
||||||
export const input = (
|
export const input = (
|
||||||
<state>
|
<value>
|
||||||
<document>
|
<document>
|
||||||
{Array.from(Array(10)).map((v, i) => (
|
{Array.from(Array(10)).map((v, i) => (
|
||||||
<quote>
|
<quote>
|
||||||
@@ -26,5 +26,5 @@ export const input = (
|
|||||||
</quote>
|
</quote>
|
||||||
))}
|
))}
|
||||||
</document>
|
</document>
|
||||||
</state>
|
</value>
|
||||||
)
|
)
|
||||||
|
@@ -3,14 +3,16 @@
|
|||||||
|
|
||||||
import h from '../../test/helpers/h'
|
import h from '../../test/helpers/h'
|
||||||
|
|
||||||
export default function (state) {
|
export default function (change) {
|
||||||
state
|
change.normalize()
|
||||||
.change()
|
}
|
||||||
.normalize()
|
|
||||||
|
export function before(value) {
|
||||||
|
return value.change()
|
||||||
}
|
}
|
||||||
|
|
||||||
export const input = (
|
export const input = (
|
||||||
<state>
|
<value>
|
||||||
<document>
|
<document>
|
||||||
{Array.from(Array(10)).map((v, i) => (
|
{Array.from(Array(10)).map((v, i) => (
|
||||||
<quote>
|
<quote>
|
||||||
@@ -23,5 +25,5 @@ export const input = (
|
|||||||
</quote>
|
</quote>
|
||||||
))}
|
))}
|
||||||
</document>
|
</document>
|
||||||
</state>
|
</value>
|
||||||
)
|
)
|
||||||
|
@@ -7,13 +7,13 @@ export default function (change) {
|
|||||||
change.splitBlock()
|
change.splitBlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
export function before(state) {
|
export function before(value) {
|
||||||
const change = state.change()
|
const change = value.change()
|
||||||
return change
|
return change
|
||||||
}
|
}
|
||||||
|
|
||||||
export const input = (
|
export const input = (
|
||||||
<state>
|
<value>
|
||||||
<document>
|
<document>
|
||||||
{Array.from(Array(10)).map((v, i) => (
|
{Array.from(Array(10)).map((v, i) => (
|
||||||
<quote>
|
<quote>
|
||||||
@@ -26,5 +26,5 @@ export const input = (
|
|||||||
</quote>
|
</quote>
|
||||||
))}
|
))}
|
||||||
</document>
|
</document>
|
||||||
</state>
|
</value>
|
||||||
)
|
)
|
||||||
|
@@ -1,11 +1,9 @@
|
|||||||
/** @jsx h */
|
|
||||||
/* eslint-disable react/jsx-key */
|
/* eslint-disable react/jsx-key */
|
||||||
|
|
||||||
import h from '../../test/helpers/h'
|
import { Value } from '../..'
|
||||||
import { State } from '../..'
|
|
||||||
|
|
||||||
export default function (json) {
|
export default function (json) {
|
||||||
State.fromJSON(json)
|
Value.fromJSON(json)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const input = {
|
export const input = {
|
||||||
|
@@ -3,19 +3,19 @@
|
|||||||
|
|
||||||
import h from '../../test/helpers/h'
|
import h from '../../test/helpers/h'
|
||||||
|
|
||||||
export default function (state) {
|
export default function (value) {
|
||||||
state.document.getBlocksAtRange(state.selection)
|
value.document.getBlocksAtRange(value.selection)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function before(state) {
|
export function before(value) {
|
||||||
return state
|
return value
|
||||||
.change()
|
.change()
|
||||||
.selectAll()
|
.selectAll()
|
||||||
.state
|
.value
|
||||||
}
|
}
|
||||||
|
|
||||||
export const input = (
|
export const input = (
|
||||||
<state>
|
<value>
|
||||||
<document>
|
<document>
|
||||||
{Array.from(Array(10)).map(() => (
|
{Array.from(Array(10)).map(() => (
|
||||||
<quote>
|
<quote>
|
||||||
@@ -27,5 +27,5 @@ export const input = (
|
|||||||
</quote>
|
</quote>
|
||||||
))}
|
))}
|
||||||
</document>
|
</document>
|
||||||
</state>
|
</value>
|
||||||
)
|
)
|
||||||
|
@@ -3,12 +3,12 @@
|
|||||||
|
|
||||||
import h from '../../test/helpers/h'
|
import h from '../../test/helpers/h'
|
||||||
|
|
||||||
export default function (state) {
|
export default function (value) {
|
||||||
state.document.getBlocks()
|
value.document.getBlocks()
|
||||||
}
|
}
|
||||||
|
|
||||||
export const input = (
|
export const input = (
|
||||||
<state>
|
<value>
|
||||||
<document>
|
<document>
|
||||||
{Array.from(Array(10)).map(() => (
|
{Array.from(Array(10)).map(() => (
|
||||||
<quote>
|
<quote>
|
||||||
@@ -20,5 +20,5 @@ export const input = (
|
|||||||
</quote>
|
</quote>
|
||||||
))}
|
))}
|
||||||
</document>
|
</document>
|
||||||
</state>
|
</value>
|
||||||
)
|
)
|
||||||
|
@@ -3,19 +3,19 @@
|
|||||||
|
|
||||||
import h from '../../test/helpers/h'
|
import h from '../../test/helpers/h'
|
||||||
|
|
||||||
export default function (state) {
|
export default function (value) {
|
||||||
state.document.getCharactersAtRange(state.selection)
|
value.document.getCharactersAtRange(value.selection)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function before(state) {
|
export function before(value) {
|
||||||
return state
|
return value
|
||||||
.change()
|
.change()
|
||||||
.selectAll()
|
.selectAll()
|
||||||
.state
|
.value
|
||||||
}
|
}
|
||||||
|
|
||||||
export const input = (
|
export const input = (
|
||||||
<state>
|
<value>
|
||||||
<document>
|
<document>
|
||||||
{Array.from(Array(10)).map(() => (
|
{Array.from(Array(10)).map(() => (
|
||||||
<quote>
|
<quote>
|
||||||
@@ -27,5 +27,5 @@ export const input = (
|
|||||||
</quote>
|
</quote>
|
||||||
))}
|
))}
|
||||||
</document>
|
</document>
|
||||||
</state>
|
</value>
|
||||||
)
|
)
|
||||||
|
@@ -3,12 +3,12 @@
|
|||||||
|
|
||||||
import h from '../../test/helpers/h'
|
import h from '../../test/helpers/h'
|
||||||
|
|
||||||
export default function (state) {
|
export default function (value) {
|
||||||
state.document.getCharacters()
|
value.document.getCharacters()
|
||||||
}
|
}
|
||||||
|
|
||||||
export const input = (
|
export const input = (
|
||||||
<state>
|
<value>
|
||||||
<document>
|
<document>
|
||||||
{Array.from(Array(10)).map(() => (
|
{Array.from(Array(10)).map(() => (
|
||||||
<quote>
|
<quote>
|
||||||
@@ -20,5 +20,5 @@ export const input = (
|
|||||||
</quote>
|
</quote>
|
||||||
))}
|
))}
|
||||||
</document>
|
</document>
|
||||||
</state>
|
</value>
|
||||||
)
|
)
|
||||||
|
@@ -3,19 +3,19 @@
|
|||||||
|
|
||||||
import h from '../../test/helpers/h'
|
import h from '../../test/helpers/h'
|
||||||
|
|
||||||
export default function (state) {
|
export default function (value) {
|
||||||
state.document.getInlinesAtRange(state.selection)
|
value.document.getInlinesAtRange(value.selection)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function before(state) {
|
export function before(value) {
|
||||||
return state
|
return value
|
||||||
.change()
|
.change()
|
||||||
.selectAll()
|
.selectAll()
|
||||||
.state
|
.value
|
||||||
}
|
}
|
||||||
|
|
||||||
export const input = (
|
export const input = (
|
||||||
<state>
|
<value>
|
||||||
<document>
|
<document>
|
||||||
{Array.from(Array(10)).map(() => (
|
{Array.from(Array(10)).map(() => (
|
||||||
<quote>
|
<quote>
|
||||||
@@ -27,5 +27,5 @@ export const input = (
|
|||||||
</quote>
|
</quote>
|
||||||
))}
|
))}
|
||||||
</document>
|
</document>
|
||||||
</state>
|
</value>
|
||||||
)
|
)
|
||||||
|
@@ -3,12 +3,12 @@
|
|||||||
|
|
||||||
import h from '../../test/helpers/h'
|
import h from '../../test/helpers/h'
|
||||||
|
|
||||||
export default function (state) {
|
export default function (value) {
|
||||||
state.document.getInlines()
|
value.document.getInlines()
|
||||||
}
|
}
|
||||||
|
|
||||||
export const input = (
|
export const input = (
|
||||||
<state>
|
<value>
|
||||||
<document>
|
<document>
|
||||||
{Array.from(Array(10)).map(() => (
|
{Array.from(Array(10)).map(() => (
|
||||||
<quote>
|
<quote>
|
||||||
@@ -20,5 +20,5 @@ export const input = (
|
|||||||
</quote>
|
</quote>
|
||||||
))}
|
))}
|
||||||
</document>
|
</document>
|
||||||
</state>
|
</value>
|
||||||
)
|
)
|
||||||
|
@@ -8,14 +8,14 @@ export default function (text) {
|
|||||||
text.getLeaves()
|
text.getLeaves()
|
||||||
}
|
}
|
||||||
|
|
||||||
export function before(state) {
|
export function before(value) {
|
||||||
const text = state.document.getFirstText()
|
const text = value.document.getFirstText()
|
||||||
__clear()
|
__clear()
|
||||||
return text
|
return text
|
||||||
}
|
}
|
||||||
|
|
||||||
export const input = (
|
export const input = (
|
||||||
<state>
|
<value>
|
||||||
<document>
|
<document>
|
||||||
{Array.from(Array(10)).map(() => (
|
{Array.from(Array(10)).map(() => (
|
||||||
<quote>
|
<quote>
|
||||||
@@ -27,5 +27,5 @@ export const input = (
|
|||||||
</quote>
|
</quote>
|
||||||
))}
|
))}
|
||||||
</document>
|
</document>
|
||||||
</state>
|
</value>
|
||||||
)
|
)
|
||||||
|
@@ -3,19 +3,19 @@
|
|||||||
|
|
||||||
import h from '../../test/helpers/h'
|
import h from '../../test/helpers/h'
|
||||||
|
|
||||||
export default function (state) {
|
export default function (value) {
|
||||||
state.document.getMarksAtRange(state.selection)
|
value.document.getMarksAtRange(value.selection)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function before(state) {
|
export function before(value) {
|
||||||
return state
|
return value
|
||||||
.change()
|
.change()
|
||||||
.selectAll()
|
.selectAll()
|
||||||
.state
|
.value
|
||||||
}
|
}
|
||||||
|
|
||||||
export const input = (
|
export const input = (
|
||||||
<state>
|
<value>
|
||||||
<document>
|
<document>
|
||||||
{Array.from(Array(10)).map(() => (
|
{Array.from(Array(10)).map(() => (
|
||||||
<quote>
|
<quote>
|
||||||
@@ -27,5 +27,5 @@ export const input = (
|
|||||||
</quote>
|
</quote>
|
||||||
))}
|
))}
|
||||||
</document>
|
</document>
|
||||||
</state>
|
</value>
|
||||||
)
|
)
|
||||||
|
@@ -3,12 +3,12 @@
|
|||||||
|
|
||||||
import h from '../../test/helpers/h'
|
import h from '../../test/helpers/h'
|
||||||
|
|
||||||
export default function (state) {
|
export default function (value) {
|
||||||
state.document.getMarks()
|
value.document.getMarks()
|
||||||
}
|
}
|
||||||
|
|
||||||
export const input = (
|
export const input = (
|
||||||
<state>
|
<value>
|
||||||
<document>
|
<document>
|
||||||
{Array.from(Array(10)).map(() => (
|
{Array.from(Array(10)).map(() => (
|
||||||
<quote>
|
<quote>
|
||||||
@@ -20,5 +20,5 @@ export const input = (
|
|||||||
</quote>
|
</quote>
|
||||||
))}
|
))}
|
||||||
</document>
|
</document>
|
||||||
</state>
|
</value>
|
||||||
)
|
)
|
||||||
|
@@ -4,18 +4,18 @@
|
|||||||
import h from '../../test/helpers/h'
|
import h from '../../test/helpers/h'
|
||||||
import { __clear } from '../../lib/utils/memoize'
|
import { __clear } from '../../lib/utils/memoize'
|
||||||
|
|
||||||
export default function ({ state, text }) {
|
export default function ({ value, text }) {
|
||||||
state.document.getPath(text.key)
|
value.document.getPath(text.key)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function before(state) {
|
export function before(value) {
|
||||||
const text = state.document.getLastText()
|
const text = value.document.getLastText()
|
||||||
__clear()
|
__clear()
|
||||||
return { state, text }
|
return { value, text }
|
||||||
}
|
}
|
||||||
|
|
||||||
export const input = (
|
export const input = (
|
||||||
<state>
|
<value>
|
||||||
<document>
|
<document>
|
||||||
{Array.from(Array(10)).map(() => (
|
{Array.from(Array(10)).map(() => (
|
||||||
<quote>
|
<quote>
|
||||||
@@ -27,5 +27,5 @@ export const input = (
|
|||||||
</quote>
|
</quote>
|
||||||
))}
|
))}
|
||||||
</document>
|
</document>
|
||||||
</state>
|
</value>
|
||||||
)
|
)
|
||||||
|
@@ -3,19 +3,19 @@
|
|||||||
|
|
||||||
import h from '../../test/helpers/h'
|
import h from '../../test/helpers/h'
|
||||||
|
|
||||||
export default function (state) {
|
export default function (value) {
|
||||||
state.document.getTextsAtRange(state.selection)
|
value.document.getTextsAtRange(value.selection)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function before(state) {
|
export function before(value) {
|
||||||
return state
|
return value
|
||||||
.change()
|
.change()
|
||||||
.selectAll()
|
.selectAll()
|
||||||
.state
|
.value
|
||||||
}
|
}
|
||||||
|
|
||||||
export const input = (
|
export const input = (
|
||||||
<state>
|
<value>
|
||||||
<document>
|
<document>
|
||||||
{Array.from(Array(10)).map(() => (
|
{Array.from(Array(10)).map(() => (
|
||||||
<quote>
|
<quote>
|
||||||
@@ -27,5 +27,5 @@ export const input = (
|
|||||||
</quote>
|
</quote>
|
||||||
))}
|
))}
|
||||||
</document>
|
</document>
|
||||||
</state>
|
</value>
|
||||||
)
|
)
|
||||||
|
@@ -3,12 +3,12 @@
|
|||||||
|
|
||||||
import h from '../../test/helpers/h'
|
import h from '../../test/helpers/h'
|
||||||
|
|
||||||
export default function (state) {
|
export default function (value) {
|
||||||
state.document.getTexts()
|
value.document.getTexts()
|
||||||
}
|
}
|
||||||
|
|
||||||
export const input = (
|
export const input = (
|
||||||
<state>
|
<value>
|
||||||
<document>
|
<document>
|
||||||
{Array.from(Array(10)).map(() => (
|
{Array.from(Array(10)).map(() => (
|
||||||
<quote>
|
<quote>
|
||||||
@@ -20,5 +20,5 @@ export const input = (
|
|||||||
</quote>
|
</quote>
|
||||||
))}
|
))}
|
||||||
</document>
|
</document>
|
||||||
</state>
|
</value>
|
||||||
)
|
)
|
||||||
|
@@ -4,20 +4,20 @@
|
|||||||
import h from '../../test/helpers/h'
|
import h from '../../test/helpers/h'
|
||||||
import { __clear } from '../../lib/utils/memoize'
|
import { __clear } from '../../lib/utils/memoize'
|
||||||
|
|
||||||
export default function ({ state, keys }) {
|
export default function ({ value, keys }) {
|
||||||
keys.forEach((key) => {
|
keys.forEach((key) => {
|
||||||
state.document.hasNode(key)
|
value.document.hasNode(key)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function before(state) {
|
export function before(value) {
|
||||||
const keys = state.document.getTexts().toArray().map(t => t.key)
|
const keys = value.document.getTexts().toArray().map(t => t.key)
|
||||||
__clear()
|
__clear()
|
||||||
return { state, keys }
|
return { value, keys }
|
||||||
}
|
}
|
||||||
|
|
||||||
export const input = (
|
export const input = (
|
||||||
<state>
|
<value>
|
||||||
<document>
|
<document>
|
||||||
{Array.from(Array(10)).map(() => (
|
{Array.from(Array(10)).map(() => (
|
||||||
<quote>
|
<quote>
|
||||||
@@ -29,5 +29,5 @@ export const input = (
|
|||||||
</quote>
|
</quote>
|
||||||
))}
|
))}
|
||||||
</document>
|
</document>
|
||||||
</state>
|
</value>
|
||||||
)
|
)
|
||||||
|
@@ -4,18 +4,18 @@
|
|||||||
import h from '../../test/helpers/h'
|
import h from '../../test/helpers/h'
|
||||||
import { __clear } from '../../lib/utils/memoize'
|
import { __clear } from '../../lib/utils/memoize'
|
||||||
|
|
||||||
export default function ({ state, text }) {
|
export default function ({ value, text }) {
|
||||||
state.document.hasNode(text.key)
|
value.document.hasNode(text.key)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function before(state) {
|
export function before(value) {
|
||||||
const text = state.document.getLastText()
|
const text = value.document.getLastText()
|
||||||
__clear()
|
__clear()
|
||||||
return { state, text }
|
return { value, text }
|
||||||
}
|
}
|
||||||
|
|
||||||
export const input = (
|
export const input = (
|
||||||
<state>
|
<value>
|
||||||
<document>
|
<document>
|
||||||
{Array.from(Array(10)).map(() => (
|
{Array.from(Array(10)).map(() => (
|
||||||
<quote>
|
<quote>
|
||||||
@@ -27,5 +27,5 @@ export const input = (
|
|||||||
</quote>
|
</quote>
|
||||||
))}
|
))}
|
||||||
</document>
|
</document>
|
||||||
</state>
|
</value>
|
||||||
)
|
)
|
||||||
|
@@ -3,12 +3,12 @@
|
|||||||
|
|
||||||
import h from '../../test/helpers/h'
|
import h from '../../test/helpers/h'
|
||||||
|
|
||||||
export default function (state) {
|
export default function (value) {
|
||||||
state.toJSON()
|
value.toJSON()
|
||||||
}
|
}
|
||||||
|
|
||||||
export const input = (
|
export const input = (
|
||||||
<state>
|
<value>
|
||||||
<document>
|
<document>
|
||||||
{Array.from(Array(10)).map(() => (
|
{Array.from(Array(10)).map(() => (
|
||||||
<quote>
|
<quote>
|
||||||
@@ -20,5 +20,5 @@ export const input = (
|
|||||||
</quote>
|
</quote>
|
||||||
))}
|
))}
|
||||||
</document>
|
</document>
|
||||||
</state>
|
</value>
|
||||||
)
|
)
|
||||||
|
@@ -4,21 +4,21 @@
|
|||||||
import h from '../../test/helpers/h'
|
import h from '../../test/helpers/h'
|
||||||
import { __clear } from '../../lib/utils/memoize'
|
import { __clear } from '../../lib/utils/memoize'
|
||||||
|
|
||||||
export default function ({ state, next }) {
|
export default function ({ value, next }) {
|
||||||
state.document.updateNode(next)
|
value.document.updateNode(next)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function before(state) {
|
export function before(value) {
|
||||||
const texts = state.document.getTexts()
|
const texts = value.document.getTexts()
|
||||||
const { size } = texts
|
const { size } = texts
|
||||||
const text = texts.get(Math.round(size / 2))
|
const text = texts.get(Math.round(size / 2))
|
||||||
const next = text.insertText(0, 'some text')
|
const next = text.insertText(0, 'some text')
|
||||||
__clear()
|
__clear()
|
||||||
return { state, next }
|
return { value, next }
|
||||||
}
|
}
|
||||||
|
|
||||||
export const input = (
|
export const input = (
|
||||||
<state>
|
<value>
|
||||||
<document>
|
<document>
|
||||||
{Array.from(Array(10)).map(() => (
|
{Array.from(Array(10)).map(() => (
|
||||||
<quote>
|
<quote>
|
||||||
@@ -30,5 +30,5 @@ export const input = (
|
|||||||
</quote>
|
</quote>
|
||||||
))}
|
))}
|
||||||
</document>
|
</document>
|
||||||
</state>
|
</value>
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user