File tree Expand file tree Collapse file tree 1 file changed +28
-1
lines changed
Expand file tree Collapse file tree 1 file changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -151,4 +151,31 @@ describe('SimpleUndo', function() {
151151 } ) ;
152152
153153 } ) ;
154- } )
154+
155+ it ( 'should reserve initial when undo position to be 0 and save' , function ( ) {
156+ var count = 0 ;
157+ var provider = function ( done ) {
158+ done ( count ++ ) ;
159+ }
160+
161+ var history = new SimpleUndo ( {
162+ provider : provider ,
163+ maxLength : 3
164+ } ) ;
165+
166+ history . initialize ( 'initial' ) ;
167+ history . save ( ) ;
168+ history . save ( ) ;
169+ history . save ( ) ;
170+ history . undo ( ) ;
171+ history . undo ( ) ;
172+ history . undo ( ) ;
173+
174+ history . canUndo ( ) . should . be . false ;
175+ history . count ( ) . should . equal ( 3 ) ;
176+ history . save ( ) ;
177+ history . stack . length . should . equal ( 2 ) ;
178+ history . stack [ 0 ] . should . equal ( 'initial' ) ;
179+ history . stack [ 1 ] . should . equal ( 3 ) ;
180+ } ) ;
181+ } )
You can’t perform that action at this time.
0 commit comments