mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-04 19:15:33 +08:00
8d2214424c
Close BS-3182, #12736 #### PR Dependency Tree * **PR #12787** 👈 This tree was auto-generated by [Charcoal](https://github.com/danerwilliams/charcoal) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Improved the behavior when deleting empty lines and merging blocks, ensuring more accurate handling of block deletion and cursor focus in various scenarios. - **Tests** - Added new end-to-end tests to verify correct deletion of lines in edgeless text and paragraph blocks, including checks for block removal and cursor position. - Introduced a utility function to retrieve block IDs for testing purposes. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
32 lines
664 B
TypeScript
32 lines
664 B
TypeScript
import type { Page } from '@playwright/test';
|
|
|
|
import { waitNextFrame } from './misc.js';
|
|
|
|
export async function updateBlockType(
|
|
page: Page,
|
|
flavour: string,
|
|
type?: string
|
|
) {
|
|
await page.evaluate(
|
|
([flavour, type]) => {
|
|
window.host.std.command.exec(
|
|
window.$blocksuite.blocks.note.updateBlockType,
|
|
{
|
|
flavour,
|
|
props: {
|
|
type,
|
|
},
|
|
}
|
|
);
|
|
},
|
|
[flavour, type] as [string, string?]
|
|
);
|
|
await waitNextFrame(page, 400);
|
|
}
|
|
|
|
export async function getBlockIds(page: Page) {
|
|
return page.evaluate(() => {
|
|
return window.host.std.store.getAllModels().map(m => m.id);
|
|
});
|
|
}
|