Merge pull request #822 from toeverything/fix/lost-entrance-of-quick-search
fix: retrieve lost entrance of quick search
This commit is contained in:
@@ -7,7 +7,7 @@ export const NotfoundPage = () => {
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
return (
|
return (
|
||||||
<PageContainer>
|
<PageContainer>
|
||||||
<NotFoundTitle>
|
<NotFoundTitle data-testid="notFound">
|
||||||
{t('404 - Page Not Found')}
|
{t('404 - Page Not Found')}
|
||||||
<p>
|
<p>
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { PropsWithChildren, ReactNode } from 'react';
|
import { PropsWithChildren, ReactNode } from 'react';
|
||||||
import Header from './Header';
|
import Header from './Header';
|
||||||
|
import QuickSearchButton from './QuickSearchButton';
|
||||||
import { StyledPageListTittleWrapper } from './styles';
|
import { StyledPageListTittleWrapper } from './styles';
|
||||||
// import QuickSearchButton from './QuickSearchButton';
|
// import QuickSearchButton from './QuickSearchButton';
|
||||||
|
|
||||||
@@ -12,7 +13,7 @@ export const PageListHeader = ({ icon, children }: PageListHeaderProps) => {
|
|||||||
<StyledPageListTittleWrapper>
|
<StyledPageListTittleWrapper>
|
||||||
{icon}
|
{icon}
|
||||||
{children}
|
{children}
|
||||||
{/* <QuickSearchButton style={{ marginLeft: '5px' }} /> */}
|
<QuickSearchButton />
|
||||||
</StyledPageListTittleWrapper>
|
</StyledPageListTittleWrapper>
|
||||||
</Header>
|
</Header>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
import { FC, SVGProps } from 'react';
|
import { FC, SVGProps } from 'react';
|
||||||
import { AllPagesIcon, FavouritesIcon, TrashIcon } from '@blocksuite/icons';
|
import {
|
||||||
|
AllPagesIcon,
|
||||||
|
FavouritesIcon,
|
||||||
|
TrashIcon,
|
||||||
|
SettingsIcon,
|
||||||
|
} from '@blocksuite/icons';
|
||||||
import { useTranslation } from '@affine/i18n';
|
import { useTranslation } from '@affine/i18n';
|
||||||
|
|
||||||
export const useSwitchToConfig = (
|
export const useSwitchToConfig = (
|
||||||
@@ -23,6 +28,13 @@ export const useSwitchToConfig = (
|
|||||||
: '',
|
: '',
|
||||||
icon: FavouritesIcon,
|
icon: FavouritesIcon,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: t('Settings'),
|
||||||
|
href: currentWorkspaceId
|
||||||
|
? `/workspace/${currentWorkspaceId}/setting`
|
||||||
|
: '',
|
||||||
|
icon: SettingsIcon,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: t('Trash'),
|
title: t('Trash'),
|
||||||
href: currentWorkspaceId ? `/workspace/${currentWorkspaceId}/trash` : '',
|
href: currentWorkspaceId ? `/workspace/${currentWorkspaceId}/trash` : '',
|
||||||
|
|||||||
@@ -8,8 +8,7 @@ loadPage();
|
|||||||
test.describe('exception page', () => {
|
test.describe('exception page', () => {
|
||||||
test('visit 404 page', async ({ page }) => {
|
test('visit 404 page', async ({ page }) => {
|
||||||
await page.goto('http://localhost:8080/404');
|
await page.goto('http://localhost:8080/404');
|
||||||
await page.waitForTimeout(1000);
|
const notFoundTip = page.locator('[data-testid=notFound]');
|
||||||
const notFoundTip = page.getByText('404 - Page Not Found');
|
await expect(notFoundTip).toBeVisible();
|
||||||
expect(await notFoundTip.isVisible()).toBe(true);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ const openQuickSearchByShortcut = async (page: Page) =>
|
|||||||
await withCtrlOrMeta(page, () => page.keyboard.press('k', { delay: 50 }));
|
await withCtrlOrMeta(page, () => page.keyboard.press('k', { delay: 50 }));
|
||||||
|
|
||||||
async function assertTitleTexts(page: Page, texts: string) {
|
async function assertTitleTexts(page: Page, texts: string) {
|
||||||
|
await page.title();
|
||||||
const actual = await page.evaluate(() => {
|
const actual = await page.evaluate(() => {
|
||||||
const titleElement = <HTMLTextAreaElement>(
|
const titleElement = <HTMLTextAreaElement>(
|
||||||
document.querySelector('.affine-default-page-block-title')
|
document.querySelector('.affine-default-page-block-title')
|
||||||
@@ -58,7 +59,7 @@ test.describe('Add new page in quick search', () => {
|
|||||||
await openQuickSearchByShortcut(page);
|
await openQuickSearchByShortcut(page);
|
||||||
const addNewPage = page.locator('[data-testid=quickSearch-addNewPage]');
|
const addNewPage = page.locator('[data-testid=quickSearch-addNewPage]');
|
||||||
await addNewPage.click();
|
await addNewPage.click();
|
||||||
await page.waitForTimeout(200);
|
await page.waitForTimeout(300);
|
||||||
await assertTitleTexts(page, '');
|
await assertTitleTexts(page, '');
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -68,7 +69,7 @@ test.describe('Add new page in quick search', () => {
|
|||||||
await page.keyboard.insertText('test123456');
|
await page.keyboard.insertText('test123456');
|
||||||
const addNewPage = page.locator('[data-testid=quickSearch-addNewPage]');
|
const addNewPage = page.locator('[data-testid=quickSearch-addNewPage]');
|
||||||
await addNewPage.click();
|
await addNewPage.click();
|
||||||
await page.waitForTimeout(200);
|
await page.waitForTimeout(300);
|
||||||
await assertTitleTexts(page, 'test123456');
|
await assertTitleTexts(page, 'test123456');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -80,9 +81,11 @@ test.describe('Search and select', () => {
|
|||||||
await page.keyboard.insertText('test123456');
|
await page.keyboard.insertText('test123456');
|
||||||
const addNewPage = page.locator('[data-testid=quickSearch-addNewPage]');
|
const addNewPage = page.locator('[data-testid=quickSearch-addNewPage]');
|
||||||
await addNewPage.click();
|
await addNewPage.click();
|
||||||
await page.waitForTimeout(200);
|
await page.waitForTimeout(300);
|
||||||
|
await assertTitleTexts(page, 'test123456');
|
||||||
|
await page.waitForTimeout(100);
|
||||||
await openQuickSearchByShortcut(page);
|
await openQuickSearchByShortcut(page);
|
||||||
await page.keyboard.insertText('test123456');
|
await page.keyboard.type('test123456');
|
||||||
await assertResultList(page, ['test123456']);
|
await assertResultList(page, ['test123456']);
|
||||||
await page.keyboard.press('Enter', { delay: 50 });
|
await page.keyboard.press('Enter', { delay: 50 });
|
||||||
await assertTitleTexts(page, 'test123456');
|
await assertTitleTexts(page, 'test123456');
|
||||||
|
|||||||
Reference in New Issue
Block a user