mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-29 00:06:09 +08:00
fix(editor): add hoverable container for image and surface-ref (#11458)
Closes: [BS-3012](https://linear.app/affine-design/issue/BS-3012/hover-yuan素时冲突)
This commit is contained in:
@@ -5,7 +5,12 @@ import {
|
||||
locateToolbar,
|
||||
setEdgelessTool,
|
||||
} from '@affine-test/kit/utils/editor';
|
||||
import { selectAllByKeyboard } from '@affine-test/kit/utils/keyboard';
|
||||
import { importImage } from '@affine-test/kit/utils/image';
|
||||
import {
|
||||
pasteByKeyboard,
|
||||
selectAllByKeyboard,
|
||||
writeTextToClipboard,
|
||||
} from '@affine-test/kit/utils/keyboard';
|
||||
import { openHomePage } from '@affine-test/kit/utils/load-page';
|
||||
import {
|
||||
clickNewPageButton,
|
||||
@@ -232,3 +237,39 @@ test('should not show inner toolbar of surface-ref in note under edgeless', asyn
|
||||
|
||||
await expect(toolbar).toBeHidden();
|
||||
});
|
||||
|
||||
test('should show toolbar when inline link is preceded by image or surface-ref', async ({
|
||||
page,
|
||||
}) => {
|
||||
await page.keyboard.press('Enter');
|
||||
|
||||
await importImage(page, 'affine-preview.png');
|
||||
|
||||
const image = page.locator('affine-image');
|
||||
await image.click();
|
||||
|
||||
await page.keyboard.press('Enter');
|
||||
|
||||
const url = new URL(page.url());
|
||||
|
||||
await writeTextToClipboard(page, url.toString());
|
||||
await pasteByKeyboard(page);
|
||||
|
||||
const toolbar = locateToolbar(page);
|
||||
|
||||
const inlineLink = page.locator('affine-reference');
|
||||
|
||||
await inlineLink.hover();
|
||||
await expect(toolbar).toBeVisible();
|
||||
|
||||
await toolbar.hover();
|
||||
await expect(toolbar).toBeVisible();
|
||||
|
||||
await image.hover();
|
||||
await expect(toolbar).toBeVisible();
|
||||
await expect(toolbar).toHaveAttribute('data-placement', 'inner');
|
||||
|
||||
await inlineLink.hover();
|
||||
await expect(toolbar).toBeVisible();
|
||||
await expect(toolbar).not.toHaveAttribute('data-placement', 'inner');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user