basic delta implementation

This commit is contained in:
Kevin Jahns
2025-03-25 11:15:17 +01:00
parent b2b1863624
commit 05e9ba4145
2 changed files with 188 additions and 0 deletions

11
tests/delta.tests.js Normal file
View File

@@ -0,0 +1,11 @@
import * as t from 'lib0/testing'
import * as delta from '../src/utils/Delta.js'
/**
* @param {t.TestCase} _tc
*/
export const testDelta = _tc => {
const d = delta.create().insert('hello').insert(' ').useAttributes({ bold: true }).insert('world').useAttribution({ creator: 'tester' }).insert('!').done()
t.compare(d.toJSON().ops, [{ insert: 'hello' }, { insert: ' world', attributes: { bold: true } }, { insert: '!', attributes: { bold: true }, attribution: { creator: 'tester' } }])
}