fix: page info ui issue on journal page (#5887)

This commit is contained in:
Peng Xiao 2024-02-23 07:55:43 +00:00
parent 3f7f78c8f4
commit 745110c799
No known key found for this signature in database
GPG Key ID: 23F23D9E8B3971ED
4 changed files with 34 additions and 5 deletions

View File

@ -1,5 +1,5 @@
import { Checkbox, DatePicker, Menu } from '@affine/component'; import { Checkbox, DatePicker, Menu } from '@affine/component';
import { useBlockSuitePageMeta } from '@affine/core/hooks/use-block-suite-page-meta'; import { useAllBlockSuitePageMeta } from '@affine/core/hooks/use-all-block-suite-page-meta';
import { WorkspaceLegacyProperties } from '@affine/core/modules/workspace'; import { WorkspaceLegacyProperties } from '@affine/core/modules/workspace';
import type { import type {
PageInfoCustomProperty, PageInfoCustomProperty,
@ -117,7 +117,7 @@ export const TagsValue = () => {
const workspace = useService(Workspace); const workspace = useService(Workspace);
const page = useService(Page); const page = useService(Page);
const blockSuiteWorkspace = workspace.blockSuiteWorkspace; const blockSuiteWorkspace = workspace.blockSuiteWorkspace;
const pageMetas = useBlockSuitePageMeta(blockSuiteWorkspace); const pageMetas = useAllBlockSuitePageMeta(blockSuiteWorkspace);
const legacyProperties = useService(WorkspaceLegacyProperties); const legacyProperties = useService(WorkspaceLegacyProperties);
const options = useLiveData(legacyProperties.tagOptions$); const options = useLiveData(legacyProperties.tagOptions$);

View File

@ -37,7 +37,12 @@ export const AppSidebarJournalButton = ({
: TodayIcon; : TodayIcon;
return ( return (
<MenuItem active={isJournalActive} onClick={openToday} icon={<Icon />}> <MenuItem
data-testid="slider-bar-journals-button"
active={isJournalActive}
onClick={openToday}
icon={<Icon />}
>
{t['com.affine.journal.app-sidebar-title']()} {t['com.affine.journal.app-sidebar-title']()}
</MenuItem> </MenuItem>
); );

View File

@ -1,7 +1,10 @@
/* eslint-disable unicorn/prefer-dom-node-dataset */ /* eslint-disable unicorn/prefer-dom-node-dataset */
import { test } from '@affine-test/kit/playwright'; import { test } from '@affine-test/kit/playwright';
import { clickPageModeButton } from '@affine-test/kit/utils/editor'; import { clickPageModeButton } from '@affine-test/kit/utils/editor';
import { openHomePage } from '@affine-test/kit/utils/load-page'; import {
openHomePage,
openJournalsPage,
} from '@affine-test/kit/utils/load-page';
import { dragTo, waitForEditorLoad } from '@affine-test/kit/utils/page-logic'; import { dragTo, waitForEditorLoad } from '@affine-test/kit/utils/page-logic';
import { import {
addCustomProperty, addCustomProperty,
@ -36,6 +39,20 @@ test('allow create tag', async ({ page }) => {
await expectTagsVisible(page, ['Test2']); await expectTagsVisible(page, ['Test2']);
}); });
test('allow create tag on journals page', async ({ page }) => {
await openJournalsPage(page);
await openTagsEditor(page);
await searchAndCreateTag(page, 'Test1');
await searchAndCreateTag(page, 'Test2');
await closeTagsEditor(page);
await expectTagsVisible(page, ['Test1', 'Test2']);
await openTagsEditor(page);
await removeSelectedTag(page, 'Test1');
await closeTagsEditor(page);
await expectTagsVisible(page, ['Test2']);
});
test('add custom property', async ({ page }) => { test('add custom property', async ({ page }) => {
await addCustomProperty(page, 'Text'); await addCustomProperty(page, 'Text');
await addCustomProperty(page, 'Number'); await addCustomProperty(page, 'Number');

View File

@ -1,4 +1,4 @@
import type { Page } from '@playwright/test'; import { expect, type Page } from '@playwright/test';
export const coreUrl = 'http://localhost:8080'; export const coreUrl = 'http://localhost:8080';
@ -9,3 +9,10 @@ export async function openHomePage(page: Page) {
export async function open404Page(page: Page) { export async function open404Page(page: Page) {
await page.goto(`${coreUrl}/404`); await page.goto(`${coreUrl}/404`);
} }
export async function openJournalsPage(page: Page) {
await page.getByTestId('slider-bar-journals-button').click();
await expect(
page.locator('.doc-title-container:has-text("Today")')
).toBeVisible();
}