mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-15 05:37:32 +00:00
fix(editor): incorrect height calculation of folded embed doc (#12348)
Fix [BS-3418](https://linear.app/affine-design/issue/BS-3418/折叠的embed-doc调整宽度时,会出现一个最小高度,不需要这个) This PR keeps the content of embed-synced-doc rendered (but clipped) when it is collapsed, to ensure accuracy in height calculation of content. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Improved the display logic for embedded synced document editors, ensuring the editor and overlay are always rendered regardless of the folded state. - **Tests** - Updated test assertions to more accurately check whether embedded editor content is within the viewport, enhancing reliability of visibility checks. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -88,11 +88,11 @@ test.describe('edgeless', () => {
|
||||
const content = embedBlock.locator('editor-host');
|
||||
|
||||
await expect(foldButton).toHaveAttribute('data-folded', 'false');
|
||||
await expect(content).toBeVisible();
|
||||
await expect(content).toBeInViewport();
|
||||
|
||||
await foldButton.click();
|
||||
|
||||
await expect(content).toBeHidden();
|
||||
await expect(content).not.toBeInViewport();
|
||||
await expect(foldButton).toHaveAttribute('data-folded', 'true');
|
||||
});
|
||||
|
||||
@@ -123,11 +123,11 @@ test.describe('edgeless', () => {
|
||||
const content = embedBlock.locator('editor-host');
|
||||
|
||||
await expect(foldButton).toHaveAttribute('data-folded', 'true');
|
||||
await expect(content).toBeHidden();
|
||||
await expect(content).not.toBeInViewport();
|
||||
|
||||
await foldButton.click();
|
||||
await expect(foldButton).toHaveAttribute('data-folded', 'false');
|
||||
await expect(content).toBeVisible();
|
||||
await expect(content).toBeInViewport();
|
||||
|
||||
await embedBlock.click();
|
||||
const [, , , h2] = await getSelectedXYWH(page);
|
||||
@@ -149,20 +149,20 @@ test.describe('edgeless', () => {
|
||||
await foldButton.click();
|
||||
|
||||
await resizeElementByHandle(page, [50, 0], 'bottom-right');
|
||||
await expect(content).toBeHidden();
|
||||
await expect(content).not.toBeInViewport();
|
||||
await expect(foldButton).toHaveAttribute('data-folded', 'true');
|
||||
|
||||
await resizeElementByHandle(page, [-50, 0], 'bottom-right');
|
||||
await expect(content).toBeHidden();
|
||||
await expect(content).not.toBeInViewport();
|
||||
await expect(foldButton).toHaveAttribute('data-folded', 'true');
|
||||
|
||||
await resizeElementByHandle(page, [0, 50], 'bottom-right');
|
||||
await expect(
|
||||
content,
|
||||
'should unfold the embed synced doc when adjust height to greater'
|
||||
).toBeVisible();
|
||||
).toBeInViewport();
|
||||
await expect(foldButton).toHaveAttribute('data-folded', 'false');
|
||||
await expect(content).toBeVisible();
|
||||
await expect(content).toBeInViewport();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user