Skip to content

Commit f4824e2

Browse files
committed
Suppress floating-ui NaN warnings in tests
Stub getClientRects and getBoundingClientRect to provide valid layout dimensions in JSDOM environment, preventing NaN CSS property warnings from floating-ui's positioning calculations.
1 parent 550c7f5 commit f4824e2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

entry_types/scrolled/package/spec/frontend/inlineEditing/LinkTooltip-spec.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ describe('LinkTooltip', () => {
1717
'pageflow_scrolled.inline_editing.link_tooltip.untitled_excursion': 'Untitled Excursion'
1818
});
1919

20+
beforeEach(() => {
21+
const rect = {width: 100, height: 20, top: 100, left: 100, bottom: 120, right: 200, x: 100, y: 100};
22+
Element.prototype.getClientRects = jest.fn(() => [rect]);
23+
Element.prototype.getBoundingClientRect = jest.fn(() => rect);
24+
});
25+
2026
it('displays tooltip for external link on hover', async () => {
2127
const {getByText, queryByRole, queryByText} = render(
2228
<LinkTooltipProvider>

0 commit comments

Comments
 (0)