@@ -10,6 +10,7 @@ import {
1010} from "../../utils/editor.js" ;
1111import { mouseSequence , moveMouseOverElement } from "../../utils/mouse.js" ;
1212import { executeSlashCommand } from "../../utils/slashmenu.js" ;
13+ import { insertParagraph } from "../../utils/copypaste.js" ;
1314
1415beforeEach ( async ( ) => {
1516 await render ( < App /> ) ;
@@ -40,6 +41,32 @@ describe("Check Table interactions", () => {
4041
4142 await compareDocToSnapshot ( "tabCells" ) ;
4243 } ) ;
44+ test ( "Tab in last cell should be a no-op" , async ( ) => {
45+ await focusOnEditor ( ) ;
46+
47+ await insertParagraph ( ) ;
48+ await executeSlashCommand ( "table" ) ;
49+
50+ for ( let i = 0 ; i < 6 ; i ++ ) {
51+ await userEvent . keyboard ( "{Tab}" ) ;
52+ }
53+
54+ // Only top level block group should exist.
55+ expect ( document . querySelectorAll ( ".bn-block-group" ) . length ) . toBe ( 1 ) ;
56+ } ) ;
57+ test ( "Shift+Tab in first should be a no-op" , async ( ) => {
58+ await focusOnEditor ( ) ;
59+
60+ await insertParagraph ( ) ;
61+ await userEvent . keyboard ( "{Enter}" ) ;
62+ await userEvent . keyboard ( "{Tab}" ) ;
63+ await executeSlashCommand ( "table" ) ;
64+
65+ await userEvent . keyboard ( "{Shift>}{Tab}{/Shift}" ) ;
66+
67+ // Block group containing table should exist as well as top level group.
68+ expect ( document . querySelectorAll ( ".bn-block-group" ) . length ) . toBe ( 2 ) ;
69+ } ) ;
4370 test ( "Arrow keys should move cells" , async ( ) => {
4471 await focusOnEditor ( ) ;
4572 await executeSlashCommand ( "table" ) ;
0 commit comments