fix(core): add shortcuts to open doc dropdown menu (#11358)

Closes: [BS-2992](https://linear.app/affine-design/issue/BS-2992/走查toolbar上的open-in-button)

[Screen Recording 2025-04-01 at 16.37.57.mov <span class="graphite__hidden">(uploaded via Graphite)</span> <img class="graphite__hidden" src="https://app.graphite.dev/api/v1/graphite/video/thumbnail/8ypiIKZXudF5a0tIgIzf/cf4b1baf-aa2c-4f37-9c62-f7202d0f7c42.mov" />](https://app.graphite.dev/media/video/8ypiIKZXudF5a0tIgIzf/cf4b1baf-aa2c-4f37-9c62-f7202d0f7c42.mov)
This commit is contained in:
fundon
2025-04-01 12:39:13 +00:00
parent bd30a73db8
commit f374f2695f
8 changed files with 184 additions and 86 deletions

View File

@@ -1057,16 +1057,11 @@ test('should save open doc mode of internal links', async ({ page }) => {
const inlineLink = page.locator('affine-reference');
await inlineLink.hover();
const recentOpenModeBtn = toolbar.getByLabel(/^Open/).nth(0);
await expect(recentOpenModeBtn).toHaveAttribute(
'aria-label',
const openDocBtn = toolbar.getByLabel(/^Open doc$/);
await expect(openDocBtn).toHaveAttribute(
'data-open-doc-mode',
'Open this doc'
);
await expect(
recentOpenModeBtn.locator('span.label:has-text("Open")')
).toBeVisible();
const openDocBtn = toolbar.getByLabel(/^Open doc$/);
await openDocBtn.click();
const openDocMenu = toolbar.getByLabel('Open doc menu');
@@ -1089,8 +1084,8 @@ test('should save open doc mode of internal links', async ({ page }) => {
await inlineLink.hover();
await expect(toolbar).toBeVisible();
await expect(recentOpenModeBtn).toHaveAttribute(
'aria-label',
await expect(openDocBtn).toHaveAttribute(
'data-open-doc-mode',
'Open in center peek'
);
@@ -1098,8 +1093,8 @@ test('should save open doc mode of internal links', async ({ page }) => {
await cardViewBtn.click();
await expect(toolbar).toBeVisible();
await expect(recentOpenModeBtn).toHaveAttribute(
'aria-label',
await expect(openDocBtn).toHaveAttribute(
'data-open-doc-mode',
'Open in center peek'
);
@@ -1107,8 +1102,8 @@ test('should save open doc mode of internal links', async ({ page }) => {
await embedViewBtn.click();
await expect(toolbar).toBeVisible();
await expect(recentOpenModeBtn).toHaveAttribute(
'aria-label',
await expect(openDocBtn).toHaveAttribute(
'data-open-doc-mode',
'Open in center peek'
);
@@ -1120,8 +1115,8 @@ test('should save open doc mode of internal links', async ({ page }) => {
await page.waitForTimeout(250);
await expect(toolbar).toBeVisible();
await expect(recentOpenModeBtn).toHaveAttribute(
'aria-label',
await expect(openDocBtn).toHaveAttribute(
'data-open-doc-mode',
'Open in center peek'
);
});