diff --git a/tests/review-ui-foundation.e2e.test.mjs b/tests/review-ui-foundation.e2e.test.mjs index 15c165d..8adf743 100644 --- a/tests/review-ui-foundation.e2e.test.mjs +++ b/tests/review-ui-foundation.e2e.test.mjs @@ -46,19 +46,27 @@ test( Boolean, "Opening navigation focuses its close action", ); + const firstLink = drawer.getByRole("link", { + name: "破碎工坊首页", + exact: true, + }); + const lastLink = drawer.getByRole("link").last(); + await firstLink.focus(); await page.keyboard.press("Shift+Tab"); assert.equal( - await drawer.evaluate((element) => - element.contains(document.activeElement), + await lastLink.evaluate( + (element) => element === document.activeElement, ), true, + "Shift+Tab from the first item wraps to the last drawer action", ); await page.keyboard.press("Tab"); assert.equal( - await drawer.evaluate((element) => - element.contains(document.activeElement), + await firstLink.evaluate( + (element) => element === document.activeElement, ), true, + "Tab from the last item wraps to the first drawer action", ); await page.keyboard.press("Escape"); await drawer.waitFor({ state: "hidden" });