mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-17 14:27:02 +08:00
feat(core): make some tabs in sidebar persistent for all docs page (#10014)
close AF-2164 
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* eslint-disable unicorn/prefer-dom-node-dataset */
|
||||
/* oxlint-disable unicorn/prefer-dom-node-dataset */
|
||||
import { test } from '@affine-test/kit/playwright';
|
||||
import {
|
||||
changeFilter,
|
||||
@@ -80,13 +80,16 @@ test('use monthpicker to modify the month of datepicker', async ({ page }) => {
|
||||
await clickDatePicker(page);
|
||||
const lastMonth = new Date();
|
||||
lastMonth.setMonth(lastMonth.getMonth() - 1);
|
||||
await selectMonthFromMonthPicker(page, lastMonth);
|
||||
await checkDatePickerMonth(page, lastMonth);
|
||||
const datePicker = page.locator(
|
||||
'[role="dialog"] [data-testid="date-picker-calendar"]'
|
||||
);
|
||||
await selectMonthFromMonthPicker(datePicker, lastMonth);
|
||||
await checkDatePickerMonth(datePicker, lastMonth);
|
||||
// change month
|
||||
const nextMonth = new Date();
|
||||
nextMonth.setMonth(nextMonth.getMonth() + 1);
|
||||
await selectMonthFromMonthPicker(page, nextMonth);
|
||||
await checkDatePickerMonth(page, nextMonth);
|
||||
await selectMonthFromMonthPicker(datePicker, nextMonth);
|
||||
await checkDatePickerMonth(datePicker, nextMonth);
|
||||
});
|
||||
|
||||
test('allow creation of filters by tags', async ({ page }) => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Page } from '@playwright/test';
|
||||
import type { Locator, Page } from '@playwright/test';
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
import { clickNewPageButton, getBlockSuiteEditorTitle } from './page-logic';
|
||||
@@ -49,7 +49,7 @@ export const getPagesCount = async (page: Page) => {
|
||||
}
|
||||
|
||||
// locator is not a HTMLElement, so we can't use dataset
|
||||
// eslint-disable-next-line unicorn/prefer-dom-node-dataset
|
||||
// oxlint-disable-next-line unicorn/prefer-dom-node-dataset
|
||||
const count = await locator.getAttribute('data-total-count');
|
||||
return count ? parseInt(count) : 0;
|
||||
};
|
||||
@@ -67,7 +67,7 @@ export const clickDatePicker = async (page: Page) => {
|
||||
await page.locator('[data-testid="filter-arg"]').locator('input').click();
|
||||
};
|
||||
|
||||
const clickMonthPicker = async (page: Page) => {
|
||||
const clickMonthPicker = async (page: Page | Locator) => {
|
||||
await page.locator('[data-testid="month-picker-button"]').click();
|
||||
};
|
||||
|
||||
@@ -78,7 +78,10 @@ export const fillDatePicker = async (page: Page, date: Date) => {
|
||||
.fill(dateFormat(date));
|
||||
};
|
||||
|
||||
export const selectMonthFromMonthPicker = async (page: Page, date: Date) => {
|
||||
export const selectMonthFromMonthPicker = async (
|
||||
page: Page | Locator,
|
||||
date: Date
|
||||
) => {
|
||||
const month = (date.getMonth() + 1).toString().padStart(2, '0');
|
||||
const year = date.getFullYear();
|
||||
// Open the month picker popup
|
||||
@@ -103,7 +106,10 @@ export const selectMonthFromMonthPicker = async (page: Page, date: Date) => {
|
||||
await selectMonth();
|
||||
};
|
||||
|
||||
export const checkDatePickerMonth = async (page: Page, date: Date) => {
|
||||
export const checkDatePickerMonth = async (
|
||||
page: Page | Locator,
|
||||
date: Date
|
||||
) => {
|
||||
expect(
|
||||
await page.getByTestId('month-picker-button').evaluate(e => e.dataset.month)
|
||||
).toBe(date.getMonth().toString());
|
||||
|
||||
Reference in New Issue
Block a user