Skip to content

Commit a78a5d8

Browse files
committed
fix: update reset zoom test to verify full update and axis state restoration
1 parent 2ad7b4b commit a78a5d8

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

tests/unit/fast-update.spec.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,17 +101,21 @@ describe('fastUpdate() — partial updateSeries fast path', () => {
101101
expect(chart.getState().maxY).toBe(9)
102102
})
103103

104-
it('reset zoom should force full update when previously zoomed', async () => {
104+
it('reset zoom should restore axis state using full update', async () => {
105105
const chart = createChart('line', [{ data: [1, 2, 3, 4, 5] }])
106106

107107
const fastUpdateSpy = vi.spyOn(chart, 'fastUpdate')
108108
const updateSpy = vi.spyOn(chart, 'update')
109109

110110
chart.zoomX(2, 4)
111+
fastUpdateSpy.mockClear()
112+
updateSpy.mockClear()
111113

112-
await chart.ctx.toolbar.handleZoomReset()
113-
114-
expect(updateSpy).toHaveBeenCalled()
114+
chart.ctx.toolbar.handleZoomReset()
115+
expect(chart.w.interact.zoomed).toBe(false)
116+
expect(chart.w.globals.minX).toBe(1)
117+
expect(chart.w.globals.maxX).toBe(5)
115118
expect(fastUpdateSpy).not.toHaveBeenCalled()
119+
expect(updateSpy).toHaveBeenCalledOnce()
116120
})
117121
})

0 commit comments

Comments
 (0)