import { EditId } from '../Identifiers' ; import { SharedTree , SharedTreeUndoRedoHandler } from '../default-edits' ; import { runSharedTreeUndoRedoTestSuite } from './utilities/UndoRedoTests' ; import { UndoRedoStackManager } from './undoRedoStackManager' ; describe ( 'SharedTreeUndoRedoHandler' , ( ) => { let undoRedoStack ; let handler ; const undoRedoOptions = { beforeEach : ( trees ) => { undoRedoStack = new UndoRedoStackManager ( ) ; handler = new SharedTreeUndoRedoHandler ( undoRedoStack ) ; trees . forEach ( ( tree ) => handler . attachTree ( tree ) ) ; } , undo : ( tree , editId ) => { undoRedoStack . undoOperation ( ) ; return 'aa26ef18-76a9-4238-9c29-9b796d21ef5a' as EditId ; } , redo : ( tree , editId ) => { undoRedoStack . redoOperation ( ) ; return 'aa26ef18-76a9-4238-9c29-9b796d21ef5a' as EditId ; } , afterEdit : ( ) => { undoRedoStack . closeCurrentOperation ( ) ; } , testOutOfOrderRevert : false } ; runSharedTreeUndoRedoTestSuite ( { localMode : true , title : 'in local mode' , ... undoRedoOptions } ) ; runSharedTreeUndoRedoTestSuite ( { localMode : false , title : 'in connected mode' , ... undoRedoOptions } ) ; } ) ;