@@ -254,31 +254,30 @@ describe('withUndoRedo', () => {
254254 } ) ;
255255
256256 it ( 'can undo after clearing and setting the same value again' , fakeAsync ( ( ) => {
257- const recordState = { customer : { firstname : 'Santa' } } ;
258-
259257 const Store = signalStore (
260258 { providedIn : 'root' } ,
261- withState ( recordState ) ,
259+ withState ( testState ) ,
262260 withMethods ( ( store ) => ( {
263- update : ( value : typeof recordState ) => patchState ( store , value ) ,
261+ update : ( value : string ) => patchState ( store , { test : value } ) ,
264262 } ) ) ,
265- withUndoRedo ( { keys : [ 'customer' ] } )
263+ withUndoRedo ( { keys : testKeys } )
266264 ) ;
267265
268266 const store = TestBed . inject ( Store ) ;
269267
270- store . update ( { customer : { firstname : 'Alan' } } ) ;
268+ store . update ( 'Alan' ) ;
271269 tick ( 1 ) ;
272270
273- store . update ( { customer : { firstname : 'Gordon' } } ) ;
271+ store . update ( 'Gordon' ) ;
274272 tick ( 1 ) ;
275273
276274 store . clearStack ( ) ;
277275 tick ( 1 ) ;
278276
279- // After clearing the undo/redo stack, there is no previous item any more
280- // The following update is the very first value.
281- store . update ( { customer : { firstname : 'Hugh' } } ) ;
277+ // After clearing the undo/redo stack, there is no previous item anymore.
278+ // The following update becomes the first value.
279+ // Since there is no other value before, it cannot be undone.
280+ store . update ( 'Hugh' ) ;
282281 tick ( 1 ) ;
283282
284283 expect ( store . canUndo ( ) ) . toBe ( false ) ;
0 commit comments