fix(web): minor bug fixes (#9696)
Co-authored-by: Mirone <Saul-Mirone@outlook.com>
This commit is contained in:
@@ -30,11 +30,6 @@ export const BRACKET_PAIRS: BracketPair[] = [
|
|||||||
left: '"',
|
left: '"',
|
||||||
right: '"',
|
right: '"',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: 'angle bracket',
|
|
||||||
left: '<',
|
|
||||||
right: '>',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: 'fullwidth single quote',
|
name: 'fullwidth single quote',
|
||||||
left: '‘',
|
left: '‘',
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ async function exportDocs(collection: Workspace, docs: Store[]) {
|
|||||||
snapshots
|
snapshots
|
||||||
.filter((snapshot): snapshot is DocSnapshot => !!snapshot)
|
.filter((snapshot): snapshot is DocSnapshot => !!snapshot)
|
||||||
.map(async 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));
|
await zip.file(snapshotName, JSON.stringify(snapshot, null, 2));
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -153,6 +153,8 @@ export const EditDocPropertyMenuItems = ({
|
|||||||
onChange={handleNameChange}
|
onChange={handleNameChange}
|
||||||
placeholder={t['unnamed']()}
|
placeholder={t['unnamed']()}
|
||||||
onKeyDown={onKeyDown}
|
onKeyDown={onKeyDown}
|
||||||
|
size="large"
|
||||||
|
style={{ borderRadius: 4 }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
14
tests/affine-local/e2e/blocksuite/code/crud.spec.ts
Normal file
14
tests/affine-local/e2e/blocksuite/code/crud.spec.ts
Normal file
@@ -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('<');
|
||||||
|
});
|
||||||
|
});
|
||||||
23
tests/affine-local/e2e/blocksuite/code/utils.ts
Normal file
23
tests/affine-local/e2e/blocksuite/code/utils.ts
Normal file
@@ -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);
|
||||||
|
};
|
||||||
@@ -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) => {
|
export const addDatabaseRow = async (page: Page, databaseTitle: string) => {
|
||||||
const db = page.locator(`affine-database-table`, {
|
const db = page.locator(`affine-database-table`, {
|
||||||
has: page.locator(`affine-database-title:has-text("${databaseTitle}")`),
|
has: page.locator(`affine-database-title:has-text("${databaseTitle}")`),
|
||||||
|
|||||||
Reference in New Issue
Block a user