test case

This commit is contained in:
Ernest 2023-05-03 13:11:47 -07:00
parent 63aafba52b
commit d5602190e3
No known key found for this signature in database
GPG Key ID: B40F008396BF376F

View File

@ -1673,6 +1673,29 @@ export const testDeltaAfterConcurrentFormatting = tc => {
t.compare(deltas, [[{ retain: 3, attributes: { bold: true } }, { retain: 2, attributes: { bold: null } }]])
}
/**
* @param {t.TestCase} tc
*/
export const testDeltaAfterDelete = tc => {
const { text0, text1, testConnector } = init(tc, { users: 2 })
text0.insert(0, 'abc', {bold: true});
text0.insertEmbed(3, new Y.Map([['key', 'val']]));
testConnector.flushAllMessages()
/**
* @type {any}
*/
const deltas = []
text1.observe(event => {
if (event.delta.length > 0) {
deltas.push(event.delta)
}
})
text0.delete(0, 3);
testConnector.flushAllMessages()
console.error("The actual deltas", deltas);
t.compare(deltas, [[{ delete: 3}]])
}
/**
* @param {t.TestCase} tc
*/