fix(web): minor bug fixes (#9696)

Co-authored-by: Mirone <Saul-Mirone@outlook.com>
This commit is contained in:
Oleg
2025-01-27 06:21:41 +01:00
committed by GitHub
parent 73b4437081
commit e3fac97b9b
6 changed files with 47 additions and 6 deletions
@@ -30,11 +30,6 @@ export const BRACKET_PAIRS: BracketPair[] = [
left: '"',
right: '"',
},
{
name: 'angle bracket',
left: '<',
right: '>',
},
{
name: 'fullwidth single quote',
left: '',
@@ -26,7 +26,7 @@ async function exportDocs(collection: Workspace, docs: Store[]) {
snapshots
.filter((snapshot): snapshot is DocSnapshot => !!snapshot)
.map(async snapshot => {
const snapshotName = `${snapshot.meta.id}.snapshot.json`;
const snapshotName = `${snapshot.meta.title || 'untitled'}.snapshot.json`;
await zip.file(snapshotName, JSON.stringify(snapshot, null, 2));
})
);
@@ -153,6 +153,8 @@ export const EditDocPropertyMenuItems = ({
onChange={handleNameChange}
placeholder={t['unnamed']()}
onKeyDown={onKeyDown}
size="large"
style={{ borderRadius: 4 }}
/>
)}
</div>
@@ -0,0 +1,14 @@
import { test } from '@affine-test/kit/playwright';
import { expect } from '@playwright/test';
import { initCodeBlockByOneStep } from './utils';
test.describe('Code Block Autocomplete Operations', () => {
test('angle brackets are not supported', async ({ page }) => {
// open the home page and insert the code block
await initCodeBlockByOneStep(page);
await page.keyboard.type('<');
const codeUnit = page.locator('affine-code-unit');
await expect(codeUnit).toHaveText('<');
});
});
@@ -0,0 +1,23 @@
import { openHomePage } from '@affine-test/kit/utils/load-page';
import {
addCodeBlock,
clickNewPageButton,
waitForEditorLoad,
} from '@affine-test/kit/utils/page-logic';
import type { Page } from '@playwright/test';
export const gotoContentFromTitle = async (page: Page) => {
await page.keyboard.press('Enter');
};
export const createNewPage = async (page: Page) => {
await clickNewPageButton(page);
};
export const initCodeBlockByOneStep = async (page: Page) => {
await openHomePage(page);
await createNewPage(page);
await waitForEditorLoad(page);
await gotoContentFromTitle(page);
await addCodeBlock(page);
};
+7
View File
@@ -230,6 +230,13 @@ export const addDatabase = async (page: Page, title?: string) => {
}
};
export const addCodeBlock = async (page: Page) => {
await page.keyboard.press('/');
await expect(page.locator('affine-slash-menu .slash-menu')).toBeVisible();
await page.keyboard.type('code');
await page.getByTestId('Code Block').click();
};
export const addDatabaseRow = async (page: Page, databaseTitle: string) => {
const db = page.locator(`affine-database-table`, {
has: page.locator(`affine-database-title:has-text("${databaseTitle}")`),