@@ -659,5 +659,34 @@ suite('DataScience Native Editor', () => {
659
659
assert . equal ( wrapper . find ( NativeCell ) . at ( 1 ) . find ( CellOutput ) . length , 0 ) ;
660
660
assert . equal ( wrapper . find ( NativeCell ) . at ( 1 ) . find ( MonacoEditor ) . length , 1 ) ;
661
661
} ) ;
662
+
663
+ test ( 'Test undo using the key \'z\'' , async ( ) => {
664
+ clickCell ( 0 ) ;
665
+
666
+ // Add, then undo, keep doing at least 3 times and confirm it works as expected.
667
+ for ( let i = 0 ; i < 3 ; i += 1 ) {
668
+ // Add a new cell
669
+ let update = waitForUpdate ( wrapper , NativeEditor , 1 ) ;
670
+ simulateKeyPressOnCell ( 0 , { code : 'a' } ) ;
671
+ await update ;
672
+
673
+ // There should be 4 cells and first cell is selected & nothing focused.
674
+ assert . equal ( isCellSelected ( wrapper , 'NativeCell' , 0 ) , true ) ;
675
+ assert . equal ( isCellSelected ( wrapper , 'NativeCell' , 1 ) , false ) ;
676
+ assert . equal ( isCellFocused ( wrapper , 'NativeCell' , 0 ) , false ) ;
677
+ assert . equal ( isCellFocused ( wrapper , 'NativeCell' , 1 ) , false ) ;
678
+ assert . equal ( wrapper . find ( 'NativeCell' ) . length , 4 ) ;
679
+
680
+ // Press 'z' to undo.
681
+ update = waitForUpdate ( wrapper , NativeEditor , 1 ) ;
682
+ simulateKeyPressOnCell ( 0 , { code : 'z' } ) ;
683
+ await update ;
684
+
685
+ // There should be 3 cells and first cell is selected & nothing focused.
686
+ assert . equal ( isCellSelected ( wrapper , 'NativeCell' , 0 ) , true ) ;
687
+ assert . equal ( isCellSelected ( wrapper , 'NativeCell' , 1 ) , false ) ;
688
+ assert . equal ( wrapper . find ( 'NativeCell' ) . length , 3 ) ;
689
+ }
690
+ } ) ;
662
691
} ) ;
663
692
} ) ;
0 commit comments