mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-24 22:09:08 +08:00
feat(core): outline viewer (quick toc) (#7614)
Close: [BS-949](https://linear.app/affine-design/issue/BS-949/outline-viewer-加入到affine) Details are in this PR: https://github.com/toeverything/blocksuite/pull/7704
This commit is contained in:
@@ -5,6 +5,11 @@ import {
|
||||
getBlockSuiteEditorTitle,
|
||||
waitForEditorLoad,
|
||||
} from '@affine-test/kit/utils/page-logic';
|
||||
import {
|
||||
confirmExperimentalPrompt,
|
||||
openExperimentalFeaturesPanel,
|
||||
openSettingModal,
|
||||
} from '@affine-test/kit/utils/setting';
|
||||
import type { Page } from '@playwright/test';
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
@@ -73,3 +78,45 @@ test('link page is useable', async ({ page }) => {
|
||||
page.locator('.doc-title-container:has-text("page1")')
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
test('outline viewer is useable', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitForEditorLoad(page);
|
||||
await clickNewPageButton(page);
|
||||
await waitForEditorLoad(page);
|
||||
|
||||
await openSettingModal(page);
|
||||
await openExperimentalFeaturesPanel(page);
|
||||
const prompt = page.getByTestId('experimental-prompt');
|
||||
await expect(prompt).toBeVisible();
|
||||
await confirmExperimentalPrompt(page);
|
||||
const settings = page.getByTestId('experimental-settings');
|
||||
const enableOutlineViewerSetting = settings.getByTestId(
|
||||
'outline-viewer-switch'
|
||||
);
|
||||
await expect(enableOutlineViewerSetting).toBeVisible();
|
||||
await enableOutlineViewerSetting.click();
|
||||
await page.waitForTimeout(500);
|
||||
await page.getByTestId('modal-close-button').click();
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
const title = getBlockSuiteEditorTitle(page);
|
||||
await title.pressSequentially('Title');
|
||||
await page.keyboard.press('Enter');
|
||||
expect(await title.innerText()).toBe('Title');
|
||||
await page.keyboard.type('# ');
|
||||
await page.keyboard.type('Heading 1');
|
||||
await page.keyboard.press('Enter');
|
||||
await page.keyboard.type('## ');
|
||||
await page.keyboard.type('Heading 2');
|
||||
await page.keyboard.press('Enter');
|
||||
|
||||
const indicators = page.locator('.outline-heading-indicator');
|
||||
await expect(indicators).toHaveCount(2);
|
||||
await expect(indicators.nth(0)).toBeVisible();
|
||||
await expect(indicators.nth(1)).toBeVisible();
|
||||
|
||||
const viewer = page.locator('affine-outline-panel-body');
|
||||
await indicators.first().hover();
|
||||
await expect(viewer).toBeVisible();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user