@@ -129,3 +129,35 @@ func TestCollapseRecursiveWithSizes(t *testing.T) {
129129 tm .Send (tea.KeyMsg {Type : tea .KeyRunes , Runes : []rune ("q" )})
130130 tm .WaitFinished (t , teatest .WithFinalTimeout (time .Second ))
131131}
132+
133+ func TestUndoRedoInteraction (t * testing.T ) {
134+ tm := prepare (t )
135+ targetKey := []byte (`"title"` )
136+
137+ // Leave root, then delete (first key)
138+ tm .Send (tea.KeyMsg {Type : tea .KeyRunes , Runes : []rune ("j" )})
139+ tm .Send (tea.KeyMsg {Type : tea .KeyRunes , Runes : []rune ("d" )})
140+ tm .Send (tea.KeyMsg {Type : tea .KeyRunes , Runes : []rune ("d" )})
141+
142+ // Verify the node is gone from the output
143+ teatest .WaitFor (t , tm .Output (), func (b []byte ) bool {
144+ return ! bytes .Contains (b , targetKey )
145+ }, teatest .WithDuration (time .Second ))
146+
147+ tm .Send (tea.KeyMsg {Type : tea .KeyRunes , Runes : []rune ("u" )})
148+
149+ // Verify the node reappeared
150+ teatest .WaitFor (t , tm .Output (), func (b []byte ) bool {
151+ return bytes .Contains (b , targetKey )
152+ }, teatest .WithDuration (time .Second ))
153+
154+ tm .Send (tea.KeyMsg {Type : tea .KeyCtrlR })
155+
156+ // Verify it is gone again
157+ teatest .WaitFor (t , tm .Output (), func (b []byte ) bool {
158+ return ! bytes .Contains (b , targetKey )
159+ }, teatest .WithDuration (time .Second ))
160+
161+ tm .Send (tea.KeyMsg {Type : tea .KeyRunes , Runes : []rune ("q" )})
162+ tm .WaitFinished (t )
163+ }
0 commit comments