diff --git a/blocksuite/affine/shared/src/utils/button-popper.ts b/blocksuite/affine/shared/src/utils/button-popper.ts index f95afc8f81..eab9e3d339 100644 --- a/blocksuite/affine/shared/src/utils/button-popper.ts +++ b/blocksuite/affine/shared/src/utils/button-popper.ts @@ -169,7 +169,7 @@ export function createButtonPopper(options: ButtonPopperOptions) { hide, toggle, dispose: () => { - cleanup?.(); + hide(); clickAway.dispose(); }, }; diff --git a/tests/blocksuite/e2e/format-bar.spec.ts b/tests/blocksuite/e2e/format-bar.spec.ts index 23c5781cd4..ced0f7c8a7 100644 --- a/tests/blocksuite/e2e/format-bar.spec.ts +++ b/tests/blocksuite/e2e/format-bar.spec.ts @@ -256,6 +256,17 @@ test('should format quick bar be able to change background color', async ({ .evaluate(menu => menu.matches(':popover-open')) ).toBe(true); + const highlightMenu = formatBar.locator( + 'affine-highlight-dropdown-menu editor-menu-button' + ); + await highlightMenu.evaluate(menu => { + Reflect.set(menu, 'popperOptions', { mainAxis: 1 }); + }); + await expect(highlightMenu).not.toHaveAttribute('data-open', 'true'); + + await highlight.highlightBtn.click(); + await expect(highlight.redForegroundBtn).toBeVisible(); + // TODO(@fundon): these recent settings should be added to the dropdown menu. // await expect(highlight.highlightBtn).toHaveAttribute( // 'data-last-used',