mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 12:28:42 +00:00
feat(core): add page group and display properties (#6228)
close TOV-23 https://github.com/toeverything/AFFiNE/assets/102217452/c05474de-b73c-40ab-9f18-cc43bb9fd828
This commit is contained in:
@@ -15,6 +15,7 @@ import {
|
||||
import { openHomePage } from '@affine-test/kit/utils/load-page';
|
||||
import {
|
||||
clickNewPageButton,
|
||||
clickPageMoreActions,
|
||||
getBlockSuiteEditorTitle,
|
||||
waitForAllPagesLoad,
|
||||
waitForEditorLoad,
|
||||
@@ -256,3 +257,54 @@ test('select a group of items by clicking "Select All" in group header', async (
|
||||
`${selectedItemCount} doc(s) selected`
|
||||
);
|
||||
});
|
||||
|
||||
test('click display button to group pages', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitForEditorLoad(page);
|
||||
await clickNewPageButton(page);
|
||||
await getBlockSuiteEditorTitle(page).click();
|
||||
await getBlockSuiteEditorTitle(page).fill('this is a new page to favorite');
|
||||
|
||||
await clickPageMoreActions(page);
|
||||
const favoriteBtn = page.getByTestId('editor-option-menu-favorite');
|
||||
await favoriteBtn.click();
|
||||
|
||||
await clickSideBarAllPageButton(page);
|
||||
await waitForAllPagesLoad(page);
|
||||
// click the display button
|
||||
await page.locator('[data-testid="page-display-menu-button"]').click();
|
||||
await page.locator('[data-testid="page-display-grouping-menuItem"]').click();
|
||||
await page.locator('[data-testid="group-by-favourites"]').click();
|
||||
|
||||
// the group header should appear
|
||||
await expect(
|
||||
page.locator('[data-testid="group-label-favourited-1"]')
|
||||
).toBeVisible();
|
||||
|
||||
await expect(
|
||||
page.locator('[data-testid="group-label-notFavourited-1"]')
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
test('select display properties to hide bodyNotes', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitForEditorLoad(page);
|
||||
await clickNewPageButton(page);
|
||||
await getBlockSuiteEditorTitle(page).click();
|
||||
await getBlockSuiteEditorTitle(page).fill(
|
||||
'this is a new page to test display properties'
|
||||
);
|
||||
await page.keyboard.press('Enter', { delay: 10 });
|
||||
await page.keyboard.insertText('DRAGON BALL: Sparking! ZERO');
|
||||
await clickSideBarAllPageButton(page);
|
||||
await waitForAllPagesLoad(page);
|
||||
const cell = page
|
||||
.getByTestId('page-list-item')
|
||||
.getByText('DRAGON BALL: Sparking! ZERO');
|
||||
await expect(cell).toBeVisible();
|
||||
await page.locator('[data-testid="page-display-menu-button"]').click();
|
||||
await page.locator('[data-testid="property-bodyNotes"]').click();
|
||||
await expect(cell).not.toBeVisible();
|
||||
await page.locator('[data-testid="property-bodyNotes"]').click();
|
||||
await expect(cell).toBeVisible();
|
||||
});
|
||||
|
||||
@@ -226,7 +226,13 @@ export const PageListStory: StoryFn<ListProps<ListItem>> = (
|
||||
};
|
||||
|
||||
PageListStory.args = {
|
||||
groupBy: 'createDate',
|
||||
groupBy: [
|
||||
{
|
||||
id: 'all',
|
||||
label: count => `All Pages (${count})`,
|
||||
match: () => true,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
PageListStory.argTypes = {
|
||||
|
||||
Reference in New Issue
Block a user