MCPcopy
hub / github.com/yjs/yjs / testInsertionsMindingAttributedContent

Function testInsertionsMindingAttributedContent

tests/attribution.tests.js:58–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56 * @param {t.TestCase} _tc
57 */
58export const testInsertionsMindingAttributedContent = _tc => {
59 const ydoc = new Y.Doc()
60 const ytext = ydoc.get()
61 ytext.insert(0, 'hello world')
62 const v1 = Y.cloneDoc(ydoc)
63 ydoc.transact(() => {
64 ytext.delete(6, 5)
65 })
66 const am = Y.createAttributionManagerFromDiff(v1, ydoc)
67 const c1 = ytext.toDelta(am)
68 t.compare(c1, delta.create().insert('hello ').insert('world', null, { delete: [] }))
69 ytext.applyDelta(delta.create().retain(11).insert('content'), am)
70 t.assert(ytext.toString() === 'hello content')
71}
72
73/**
74 * @param {t.TestCase} _tc

Callers

nothing calls this directly

Calls 7

getMethod · 0.95
transactMethod · 0.95
insertMethod · 0.80
toDeltaMethod · 0.80
applyDeltaMethod · 0.80
toStringMethod · 0.80
deleteMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…