[UndoManager] support global undo

This commit is contained in:
Kevin Jahns
2025-03-04 14:41:44 +01:00
parent cc9a857441
commit 69d4a5c821
2 changed files with 26 additions and 11 deletions

View File

@@ -116,6 +116,19 @@ export const testEmptyTypeScope = _tc => {
t.assert(yarray.length === 0)
}
/**
* Test case to fix #241
* @param {t.TestCase} _tc
*/
export const testGlobalScope = _tc => {
const ydoc = new Y.Doc()
const um = new Y.UndoManager(ydoc)
const yarray = ydoc.getArray()
yarray.insert(0, [1])
um.undo()
t.assert(yarray.length === 0)
}
/**
* Test case to fix #241
* @param {t.TestCase} _tc