Skip to content

Commit d478047

Browse files
committed
fix: Correct duplicate code, remove ESLint comments, improve code quality
1 parent ecbf657 commit d478047

File tree

1 file changed

+3
-30
lines changed

1 file changed

+3
-30
lines changed

test/e2e/specs/editor/blocks/navigation.spec.js

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ test.describe( 'Navigation block', () => {
524524
await expect( navBlockInserter ).toBeFocused();
525525
} );
526526

527-
test.describe( 'Navigation block focus management', () => {
527+
test.describe( 'Focus management', () => {
528528
test.beforeEach(
529529
async ( { admin, editor, requestUtils, navigation } ) => {
530530
await admin.createNewPost();
@@ -578,7 +578,6 @@ test.describe( 'Navigation block', () => {
578578
await pageUtils.pressKeys( 'ArrowDown' );
579579
await navigation.useBlockInserter();
580580
await navigation.addPage( 'Cat' );
581-
await navigation.checkLabelFocus( 'Cat' );
582581

583582
/**
584583
* Test: We can open and close the preview with the keyboard and escape
@@ -678,10 +677,6 @@ test.describe( 'Navigation block', () => {
678677
await navigation.checkLabelFocus( 'Dog' );
679678
} );
680679

681-
/**
682-
* New test: Use the submenu nav item appender to add a custom link
683-
*/
684-
// eslint-disable-next-line playwright/expect-expect
685680
test( 'Can add submenu item(custom-link) using the keyboard', async ( {
686681
page,
687682
pageUtils,
@@ -693,7 +688,7 @@ test.describe( 'Navigation block', () => {
693688
await navigation.addPage( 'Cat' );
694689

695690
/**
696-
* Test: Can add submenu item using the keyboard
691+
* Test: Can add submenu item(custome-link) using the keyboard
697692
*/
698693
navigation.useToolbarButton( 'Add submenu' );
699694

@@ -702,26 +697,6 @@ test.describe( 'Navigation block', () => {
702697
editor.canvas.locator( 'a' ).filter( { hasText: 'Add link' } )
703698
).toBeVisible();
704699

705-
await pageUtils.pressKeys( 'ArrowDown' );
706-
// There is a bug that won't allow us to press Enter to add the link: https://github.com/WordPress/gutenberg/issues/60051
707-
// TODO: Use Enter after that bug is resolved
708-
await navigation.useLinkShortcut();
709-
710-
await navigation.addPage( 'Dog' );
711-
712-
/**
713-
* Test: We can open and close the preview with the keyboard and escape
714-
* buttons from a submenu nav item using both the shortcut and toolbar
715-
*/
716-
await navigation.useLinkShortcut();
717-
await navigation.previewIsOpenAndCloses();
718-
await navigation.checkLabelFocus( 'Dog' );
719-
/**
720-
* Test: Use the submenu nav item appender to add a custom link
721-
*/
722-
await page.keyboard.press( 'End' );
723-
await pageUtils.pressKeys( 'ArrowRight', { times: 2 } );
724-
await navigation.useBlockInserter();
725700
await navigation.addCustomURL( 'https://wordpress.org' );
726701
await navigation.expectToHaveTextSelected( 'wordpress.org' );
727702

@@ -742,7 +717,7 @@ test.describe( 'Navigation block', () => {
742717
// Exit the toolbar
743718
await page.keyboard.press( 'Escape' );
744719
// Move to the submenu item
745-
await pageUtils.pressKeys( 'ArrowUp', { times: 4 } );
720+
await pageUtils.pressKeys( 'ArrowUp', { times: 2 } );
746721
await page.keyboard.press( 'Home' );
747722

748723
// Check we're on our submenu link
@@ -759,7 +734,6 @@ test.describe( 'Navigation block', () => {
759734
await navigation.checkLabelFocus( 'Cat' );
760735
} );
761736

762-
// eslint-disable-next-line playwright/expect-expect
763737
test( 'Deleting returns items focus to its sibling', async ( {
764738
page,
765739
pageUtils,
@@ -769,7 +743,6 @@ test.describe( 'Navigation block', () => {
769743
await pageUtils.pressKeys( 'ArrowDown' );
770744
await navigation.useBlockInserter();
771745
await navigation.addPage( 'Cat' );
772-
await navigation.checkLabelFocus( 'Cat' );
773746

774747
/**
775748
* Test: We can open and close the preview with the keyboard and escape

0 commit comments

Comments
 (0)