Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(web): minor bug fixes #9696

Merged
merged 6 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions blocksuite/affine/shared/src/consts/bracket-pairs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ export const BRACKET_PAIRS: BracketPair[] = [
left: '"',
right: '"',
},
{
name: 'angle bracket',
left: '<',
right: '>',
},
{
name: 'fullwidth single quote',
left: '‘',
Expand Down
2 changes: 1 addition & 1 deletion blocksuite/blocks/src/_common/transformers/zip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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));
})
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ export const EditDocPropertyMenuItems = ({
onChange={handleNameChange}
placeholder={t['unnamed']()}
onKeyDown={onKeyDown}
size="large"
style={{ borderRadius: 4 }}
/>
)}
</div>
Expand Down
14 changes: 14 additions & 0 deletions tests/affine-local/e2e/blocksuite/code/crud.spec.ts
Original file line number Diff line number Diff line change
@@ -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 changes: 23 additions & 0 deletions tests/affine-local/e2e/blocksuite/code/utils.ts
Original file line number Diff line number Diff line change
@@ -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 changes: 7 additions & 0 deletions tests/kit/src/utils/page-logic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,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}")`),
Expand Down
Loading