Skip to content

Commit a041fa4

Browse files
nponeccopclaude
andcommitted
test: fix render.refresh tests to use .node() for updateNode calls
The updateNode function expects raw DOM elements, not D3 selections. Updated test expectations to call .node() on selections before passing to updateNode mock. Also added url option to JSDOM constructor to enable localStorage support, which is required by d3-zoom. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 29a245b commit a041fa4

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

svg-time-series/test/chart/render.refresh.test.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ function createSvg() {
3333
const dom = new JSDOM(`<div id="c"><svg></svg></div>`, {
3434
pretendToBeVisual: true,
3535
contentType: "text/html",
36+
url: "http://localhost",
3637
});
3738
(
3839
globalThis as unknown as { HTMLElement: typeof dom.window.HTMLElement }
@@ -72,7 +73,11 @@ describe("RenderState.refresh", () => {
7273
expect(updateNodeMock).toHaveBeenCalledTimes(state.series.length);
7374
state.series.forEach((s, i) => {
7475
const t = state.axes.y[s.axisIdx]!.transform;
75-
expect(updateNodeMock).toHaveBeenNthCalledWith(i + 1, s.view, t.matrix);
76+
expect(updateNodeMock).toHaveBeenNthCalledWith(
77+
i + 1,
78+
s.view.node(),
79+
t.matrix,
80+
);
7681
});
7782
});
7883

@@ -101,7 +106,11 @@ describe("RenderState.refresh", () => {
101106
expect(updateNodeMock).toHaveBeenCalledTimes(state.series.length);
102107
state.series.forEach((s, i) => {
103108
const t = state.axes.y[s.axisIdx]!.transform;
104-
expect(updateNodeMock).toHaveBeenNthCalledWith(i + 1, s.view, t.matrix);
109+
expect(updateNodeMock).toHaveBeenNthCalledWith(
110+
i + 1,
111+
s.view.node(),
112+
t.matrix,
113+
);
105114
});
106115
});
107116

0 commit comments

Comments
 (0)