Skip to content

Commit 4be1367

Browse files
authored
[core] Fix PopoverNext fill class not applied to target wrapper (#8031)
1 parent d459ecb commit 4be1367

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

packages/core/src/components/popover-next/popoverNext.test.tsx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,30 @@ describe("<PopoverNext>", () => {
265265

266266
expect(container.querySelector("[aria-haspopup]")).not.toBeInTheDocument();
267267
});
268+
269+
it("applies FILL class to target when fill={true}", () => {
270+
const { container } = render(
271+
<PopoverNext content="content" fill={true}>
272+
<Button text="target" />
273+
</PopoverNext>,
274+
);
275+
const popoverTarget = container.querySelector(`.${Classes.POPOVER_TARGET}`);
276+
277+
expect(popoverTarget).toBeInTheDocument();
278+
expect(popoverTarget).toHaveClass(Classes.FILL);
279+
});
280+
281+
it("does not apply FILL class to target when fill={false}", () => {
282+
const { container } = render(
283+
<PopoverNext content="content" fill={false}>
284+
<Button text="target" />
285+
</PopoverNext>,
286+
);
287+
const popoverTarget = container.querySelector(`.${Classes.POPOVER_TARGET}`);
288+
289+
expect(popoverTarget).toBeInTheDocument();
290+
expect(popoverTarget).not.toHaveClass(Classes.FILL);
291+
});
268292
});
269293

270294
describe("basic functionality", () => {

packages/core/src/components/popover-next/popoverTarget.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ export const PopoverTarget = forwardRef<HTMLElement, PopoverTargetProps>((props,
9696
[Classes.POPOVER_OPEN]: isOpen,
9797
// this class is mainly useful for button targets
9898
[Classes.ACTIVE]: isOpen && !isControlled && !isHoverInteractionKind,
99+
[Classes.FILL]: fill,
99100
}),
100101
ref,
101102
...targetEventHandlers,

0 commit comments

Comments
 (0)