diff --git a/blocksuite/affine/blocks/callout/src/callout-block.ts b/blocksuite/affine/blocks/callout/src/callout-block.ts index 76f3415f46..34ec54ffd0 100644 --- a/blocksuite/affine/blocks/callout/src/callout-block.ts +++ b/blocksuite/affine/blocks/callout/src/callout-block.ts @@ -166,13 +166,6 @@ export class CalloutBlockComponent extends CaptionedBlockComponent 0) { return; diff --git a/blocksuite/integration-test/src/__tests__/main/editor-semantics.spec.ts b/blocksuite/integration-test/src/__tests__/main/editor-semantics.spec.ts index d245830487..fa6ae2d61b 100644 --- a/blocksuite/integration-test/src/__tests__/main/editor-semantics.spec.ts +++ b/blocksuite/integration-test/src/__tests__/main/editor-semantics.spec.ts @@ -15,6 +15,10 @@ import type { } from '@blocksuite/affine-model'; import { insertContent } from '@blocksuite/affine-rich-text'; import { REFERENCE_NODE } from '@blocksuite/affine-shared/consts'; +import { + IconPickerServiceIdentifier, + IconType, +} from '@blocksuite/affine-shared/services'; import type { AffineTextAttributes } from '@blocksuite/affine-shared/types'; import { createDefaultDoc } from '@blocksuite/affine-shared/utils'; import type { SingleViewBase } from '@blocksuite/data-view'; @@ -270,6 +274,41 @@ test('typing into a sorted database title keeps editing the same row', async () expect(titleCells[0].dataset.editing).toBe('true'); }); +test.each([ + { hasIcon: true, target: '[data-testid="callout-emoji"]', opened: true }, + { hasIcon: true, target: 'rich-text', opened: false }, + { hasIcon: false, target: 'rich-text', opened: false }, +])( + 'clicking $target in a callout (icon: $hasIcon) opens the icon picker: $opened', + async ({ hasIcon, target, opened }) => { + await setupEditor('page', [ + { + setup: di => { + di.override(IconPickerServiceIdentifier, () => ({ + iconPickerComponent: () => ({ update() {}, unmount() {} }), + })); + }, + }, + ]); + const noteId = addNote(doc); + const calloutId = doc.addBlock( + 'affine:callout', + { icon: hasIcon ? { type: IconType.Emoji, unicode: '💡' } : undefined }, + noteId + ); + doc.addBlock('affine:paragraph', { text: new Text('text') }, calloutId); + await wait(); + editor + .host!.view.getBlock(calloutId)! + .querySelector(target)! + .click(); + await wait(); + expect(editor.host!.querySelector('icon-picker-wrapper') !== null).toBe( + opened + ); + } +); + test.each(['page', 'edgeless'] as const)( 'table selection preserves its input owner in %s mode', async mode => {