Skip to content

Commit 2ebf684

Browse files
committed
test(popover): add gutter test
1 parent ebb5b23 commit 2ebf684

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

packages/kit-headless/src/components/popover/popover.test.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,29 @@ test.describe('Mouse Behavior', () => {
131131

132132
expect(popoverBoundingBox?.y).toBeLessThan(triggerBoundingBox?.y ?? 0);
133133
});
134+
135+
test(`GIVEN a combobox with a gutter configured
136+
WHEN opening the combobox
137+
THEN the popover should be spaced 24px from the combobox`, async ({ page }) => {
138+
const { driver: d } = await setup(page, 'gutter');
139+
140+
const popover = d.getPopover();
141+
const trigger = d.getTrigger();
142+
143+
await trigger.click();
144+
145+
await expect(popover).toBeVisible();
146+
147+
const popoverBoundingBox = await popover.boundingBox();
148+
const triggerBoundingBox = await trigger.boundingBox();
149+
150+
console.log(triggerBoundingBox, popoverBoundingBox);
151+
152+
const triggerBottomAbsolutePosition =
153+
(triggerBoundingBox?.y ?? 0) + (triggerBoundingBox?.height ?? 0);
154+
155+
expect((popoverBoundingBox?.y ?? 0) - triggerBottomAbsolutePosition).toBe(24);
156+
});
134157
});
135158

136159
test.describe('Keyboard Behavior', () => {

0 commit comments

Comments
 (0)