From 2f5e801097953997a06aab6f3a24e24cef0b2497 Mon Sep 17 00:00:00 2001 From: Saul-Mirone Date: Sun, 16 Mar 2025 16:09:35 +0000 Subject: [PATCH] fix(editor): missing export (#10893) --- blocksuite/affine/all/package.json | 1 - .../tests-legacy/e2e/slash-menu.spec.ts | 21 ++++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/blocksuite/affine/all/package.json b/blocksuite/affine/all/package.json index 83691a1342..7eff18a93e 100644 --- a/blocksuite/affine/all/package.json +++ b/blocksuite/affine/all/package.json @@ -146,7 +146,6 @@ "./shared/theme": "./src/shared/theme.ts", "./shared/types": "./src/shared/types.ts", "./shared/utils": "./src/shared/utils.ts", - "./shared/viewport-renderer": "./src/shared/viewport-renderer.ts", "./schemas": "./src/schemas.ts", "./model": "./src/model/index.ts", "./sync": "./src/sync/index.ts", diff --git a/blocksuite/tests-legacy/e2e/slash-menu.spec.ts b/blocksuite/tests-legacy/e2e/slash-menu.spec.ts index ad55906dff..512ea680aa 100644 --- a/blocksuite/tests-legacy/e2e/slash-menu.spec.ts +++ b/blocksuite/tests-legacy/e2e/slash-menu.spec.ts @@ -36,6 +36,14 @@ import { } from './utils/asserts.js'; import { test } from './utils/playwright.js'; +function formatWithTimezone(date: Date, timeZone: string = 'Asia/Tokyo') { + const tokyoDate = date.toLocaleString('en-US', { timeZone }); + const year = tokyoDate.split(',')[0].split('/')[2]; + const month = tokyoDate.split(',')[0].split('/')[0].padStart(2, '0'); + const day = tokyoDate.split(',')[0].split('/')[1]; + return `${year}-${month}-${day}`; +} + test.describe('slash menu should show and hide correctly', () => { test.beforeEach(async ({ page }) => { await enterPlaygroundRoom(page); @@ -681,9 +689,8 @@ test.describe('slash menu with date & time', () => { await expect(slashMenu).toBeHidden(); const date = new Date(); - const strTime = date.toISOString().split('T')[0]; - - await assertRichTexts(page, [strTime]); + const formattedDate = formatWithTimezone(date); + await assertRichTexts(page, [formattedDate]); }); test("should create Tomorrow's time string", async ({ page }) => { @@ -701,9 +708,9 @@ test.describe('slash menu with date & time', () => { const date = new Date(); date.setDate(date.getDate() + 1); - const strTime = date.toISOString().split('T')[0]; + const formattedDate = formatWithTimezone(date); - await assertRichTexts(page, [strTime]); + await assertRichTexts(page, [formattedDate]); }); test("should insert Yesterday's time string", async ({ page }) => { @@ -721,9 +728,9 @@ test.describe('slash menu with date & time', () => { const date = new Date(); date.setDate(date.getDate() - 1); - const strTime = date.toISOString().split('T')[0]; + const formattedDate = formatWithTimezone(date); - await assertRichTexts(page, [strTime]); + await assertRichTexts(page, [formattedDate]); }); });