@object-ui/react 3.1.5 → 3.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +28 -3
  3. package/dist/SchemaRenderer.js +2 -2
  4. package/dist/components/form/FieldFactory.js +5 -2
  5. package/dist/context/AppShellContext.d.ts +26 -0
  6. package/dist/context/AppShellContext.js +67 -0
  7. package/dist/context/index.d.ts +1 -7
  8. package/dist/context/index.js +1 -7
  9. package/dist/hooks/index.d.ts +1 -0
  10. package/dist/hooks/index.js +1 -0
  11. package/dist/hooks/useDataRefresh.d.ts +36 -0
  12. package/dist/hooks/useDataRefresh.js +50 -0
  13. package/dist/hooks/useDiscovery.d.ts +12 -0
  14. package/dist/hooks/useDiscovery.js +6 -0
  15. package/dist/hooks/usePerformanceBudget.js +1 -1
  16. package/package.json +32 -9
  17. package/.turbo/turbo-build.log +0 -4
  18. package/src/LazyPluginLoader.tsx +0 -174
  19. package/src/SchemaRenderer.tsx +0 -266
  20. package/src/__tests__/LazyPluginLoader.test.tsx +0 -176
  21. package/src/__tests__/SchemaRenderer.aria.test.tsx +0 -118
  22. package/src/__tests__/SchemaRenderer.debug.test.tsx +0 -69
  23. package/src/__tests__/SchemaRenderer.errorBoundary.test.tsx +0 -114
  24. package/src/__tests__/SchemaRenderer.expressions.test.tsx +0 -131
  25. package/src/__tests__/SchemaRendererProvider.smoke.test.tsx +0 -132
  26. package/src/__tests__/ThemeProvider.test.tsx +0 -451
  27. package/src/__tests__/useNavigationOverlay.test.ts +0 -578
  28. package/src/__tests__/useOffline.test.ts +0 -198
  29. package/src/__tests__/usePageTransition.test.ts +0 -214
  30. package/src/__tests__/usePageVariables.test.tsx +0 -334
  31. package/src/__tests__/usePerformance.test.ts +0 -137
  32. package/src/__tests__/useViewData.test.tsx +0 -422
  33. package/src/__tests__/view-switching.test.tsx +0 -456
  34. package/src/components/form/FieldFactory.tsx +0 -509
  35. package/src/components/form/FormRenderer.test.tsx +0 -744
  36. package/src/components/form/FormRenderer.tsx +0 -258
  37. package/src/components/form/README.md +0 -352
  38. package/src/components/form/index.ts +0 -12
  39. package/src/context/ActionContext.tsx +0 -213
  40. package/src/context/DndContext.tsx +0 -260
  41. package/src/context/NotificationContext.tsx +0 -280
  42. package/src/context/SchemaRendererContext.tsx +0 -48
  43. package/src/context/ThemeContext.tsx +0 -325
  44. package/src/context/__tests__/ActionContext.test.tsx +0 -174
  45. package/src/context/__tests__/DndContext.test.tsx +0 -150
  46. package/src/context/__tests__/NotificationContext.test.tsx +0 -176
  47. package/src/context/__tests__/useDataScope.test.tsx +0 -91
  48. package/src/context/index.ts +0 -13
  49. package/src/hooks/__tests__/useActionEngine.test.ts +0 -170
  50. package/src/hooks/__tests__/useActionRunner.test.ts +0 -153
  51. package/src/hooks/__tests__/useAnimation.test.ts +0 -82
  52. package/src/hooks/__tests__/useColumnSummary.test.ts +0 -93
  53. package/src/hooks/__tests__/useCrudShortcuts.test.ts +0 -85
  54. package/src/hooks/__tests__/useDebugMode.test.ts +0 -83
  55. package/src/hooks/__tests__/useDensityMode.test.ts +0 -81
  56. package/src/hooks/__tests__/useDiscovery.test.tsx +0 -149
  57. package/src/hooks/__tests__/useDynamicApp.test.ts +0 -161
  58. package/src/hooks/__tests__/useETagCache.test.ts +0 -153
  59. package/src/hooks/__tests__/useExpression.test.ts +0 -86
  60. package/src/hooks/__tests__/useFocusTrap.test.ts +0 -294
  61. package/src/hooks/__tests__/useKeyboardShortcuts.test.ts +0 -144
  62. package/src/hooks/__tests__/usePageTransition.test.ts +0 -158
  63. package/src/hooks/__tests__/usePerformanceBudget.test.ts +0 -157
  64. package/src/hooks/__tests__/useReducedMotion.test.ts +0 -104
  65. package/src/hooks/__tests__/useSchemaPersistence.test.ts +0 -220
  66. package/src/hooks/__tests__/useViewSharing.test.ts +0 -121
  67. package/src/hooks/__tests__/useViewTransition.test.ts +0 -61
  68. package/src/hooks/index.ts +0 -35
  69. package/src/hooks/useActionEngine.ts +0 -84
  70. package/src/hooks/useActionRunner.ts +0 -119
  71. package/src/hooks/useAnimation.ts +0 -117
  72. package/src/hooks/useClientNotifications.ts +0 -251
  73. package/src/hooks/useColumnSummary.ts +0 -87
  74. package/src/hooks/useCrudShortcuts.ts +0 -126
  75. package/src/hooks/useDebugMode.ts +0 -95
  76. package/src/hooks/useDensityMode.ts +0 -102
  77. package/src/hooks/useDiscovery.ts +0 -154
  78. package/src/hooks/useDynamicApp.ts +0 -142
  79. package/src/hooks/useETagCache.ts +0 -404
  80. package/src/hooks/useExpression.ts +0 -56
  81. package/src/hooks/useFocusManagement.ts +0 -248
  82. package/src/hooks/useFocusTrap.ts +0 -138
  83. package/src/hooks/useGlobalUndo.ts +0 -98
  84. package/src/hooks/useKeyboardShortcuts.ts +0 -119
  85. package/src/hooks/useNavigationOverlay.ts +0 -190
  86. package/src/hooks/useOffline.ts +0 -301
  87. package/src/hooks/usePageTransition.ts +0 -187
  88. package/src/hooks/usePageVariables.tsx +0 -157
  89. package/src/hooks/usePerformance.ts +0 -246
  90. package/src/hooks/usePerformanceBudget.ts +0 -313
  91. package/src/hooks/useReducedMotion.ts +0 -53
  92. package/src/hooks/useSchemaPersistence.ts +0 -222
  93. package/src/hooks/useViewData.ts +0 -201
  94. package/src/hooks/useViewSharing.ts +0 -140
  95. package/src/hooks/useViewTransition.ts +0 -144
  96. package/src/index.ts +0 -41
  97. package/src/spec-bridge/SpecBridge.ts +0 -64
  98. package/src/spec-bridge/__tests__/P1SpecBridge.test.ts +0 -855
  99. package/src/spec-bridge/__tests__/SpecBridge.test.ts +0 -550
  100. package/src/spec-bridge/bridges/dashboard.ts +0 -180
  101. package/src/spec-bridge/bridges/form-view.ts +0 -109
  102. package/src/spec-bridge/bridges/list-view.ts +0 -187
  103. package/src/spec-bridge/bridges/page.ts +0 -136
  104. package/src/spec-bridge/index.ts +0 -14
  105. package/src/spec-bridge/types.ts +0 -38
  106. package/src/utils/i18n.ts +0 -10
  107. package/tsconfig.json +0 -17
  108. package/tsconfig.tsbuildinfo +0 -1
  109. package/vitest.config.ts +0 -2
@@ -1,578 +0,0 @@
1
- /**
2
- * ObjectUI
3
- * Copyright (c) 2024-present ObjectStack Inc.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE file in the root directory of this source tree.
7
- */
8
-
9
- import { describe, it, expect, vi, beforeEach } from 'vitest';
10
- import { renderHook, act } from '@testing-library/react';
11
- import { useNavigationOverlay } from '../hooks/useNavigationOverlay';
12
- import type { NavigationConfig } from '../hooks/useNavigationOverlay';
13
-
14
- // Mock window.open
15
- const mockWindowOpen = vi.fn();
16
- Object.defineProperty(window, 'open', { value: mockWindowOpen, writable: true });
17
-
18
- describe('useNavigationOverlay', () => {
19
- beforeEach(() => {
20
- vi.clearAllMocks();
21
- });
22
-
23
- // ============================================================
24
- // Default behavior (no navigation config)
25
- // ============================================================
26
-
27
- describe('default behavior (no config)', () => {
28
- it('should call onNavigate with record ID when no navigation config', () => {
29
- const onNavigate = vi.fn();
30
- const { result } = renderHook(() =>
31
- useNavigationOverlay({
32
- objectName: 'contacts',
33
- onNavigate,
34
- })
35
- );
36
-
37
- act(() => {
38
- result.current.handleClick({ id: '123', name: 'Test' });
39
- });
40
-
41
- expect(onNavigate).toHaveBeenCalledWith('123', 'view');
42
- expect(result.current.isOpen).toBe(false);
43
- });
44
-
45
- it('should use _id field as fallback when id is not present', () => {
46
- const onNavigate = vi.fn();
47
- const { result } = renderHook(() =>
48
- useNavigationOverlay({
49
- objectName: 'contacts',
50
- onNavigate,
51
- })
52
- );
53
-
54
- act(() => {
55
- result.current.handleClick({ _id: '456', name: 'Test' });
56
- });
57
-
58
- expect(onNavigate).toHaveBeenCalledWith('456', 'view');
59
- });
60
-
61
- it('should do nothing when no onNavigate and no navigation config', () => {
62
- const { result } = renderHook(() =>
63
- useNavigationOverlay({ objectName: 'contacts' })
64
- );
65
-
66
- act(() => {
67
- result.current.handleClick({ id: '123' });
68
- });
69
-
70
- expect(result.current.isOpen).toBe(false);
71
- });
72
- });
73
-
74
- // ============================================================
75
- // onRowClick priority
76
- // ============================================================
77
-
78
- describe('onRowClick priority', () => {
79
- it('should call onRowClick instead of navigation when provided', () => {
80
- const onRowClick = vi.fn();
81
- const onNavigate = vi.fn();
82
- const { result } = renderHook(() =>
83
- useNavigationOverlay({
84
- navigation: { mode: 'drawer' },
85
- objectName: 'contacts',
86
- onNavigate,
87
- onRowClick,
88
- })
89
- );
90
-
91
- act(() => {
92
- result.current.handleClick({ id: '123' });
93
- });
94
-
95
- expect(onRowClick).toHaveBeenCalledWith({ id: '123' });
96
- expect(onNavigate).not.toHaveBeenCalled();
97
- expect(result.current.isOpen).toBe(false);
98
- });
99
- });
100
-
101
- // ============================================================
102
- // mode: 'none'
103
- // ============================================================
104
-
105
- describe('mode: none', () => {
106
- it('should do nothing when mode is none', () => {
107
- const onNavigate = vi.fn();
108
- const { result } = renderHook(() =>
109
- useNavigationOverlay({
110
- navigation: { mode: 'none' },
111
- objectName: 'contacts',
112
- onNavigate,
113
- })
114
- );
115
-
116
- act(() => {
117
- result.current.handleClick({ id: '123' });
118
- });
119
-
120
- expect(onNavigate).not.toHaveBeenCalled();
121
- expect(result.current.isOpen).toBe(false);
122
- });
123
-
124
- it('should do nothing when preventNavigation is true', () => {
125
- const onNavigate = vi.fn();
126
- const { result } = renderHook(() =>
127
- useNavigationOverlay({
128
- navigation: { mode: 'page', preventNavigation: true },
129
- objectName: 'contacts',
130
- onNavigate,
131
- })
132
- );
133
-
134
- act(() => {
135
- result.current.handleClick({ id: '123' });
136
- });
137
-
138
- expect(onNavigate).not.toHaveBeenCalled();
139
- });
140
- });
141
-
142
- // ============================================================
143
- // mode: 'page'
144
- // ============================================================
145
-
146
- describe('mode: page', () => {
147
- it('should call onNavigate for page mode', () => {
148
- const onNavigate = vi.fn();
149
- const { result } = renderHook(() =>
150
- useNavigationOverlay({
151
- navigation: { mode: 'page' },
152
- objectName: 'contacts',
153
- onNavigate,
154
- })
155
- );
156
-
157
- act(() => {
158
- result.current.handleClick({ id: 'abc' });
159
- });
160
-
161
- expect(onNavigate).toHaveBeenCalledWith('abc', 'view');
162
- expect(result.current.isOpen).toBe(false);
163
- });
164
- });
165
-
166
- // ============================================================
167
- // mode: 'new_window'
168
- // ============================================================
169
-
170
- describe('mode: new_window', () => {
171
- it('should open a new window for new_window mode', () => {
172
- const { result } = renderHook(() =>
173
- useNavigationOverlay({
174
- navigation: { mode: 'new_window' },
175
- objectName: 'contacts',
176
- })
177
- );
178
-
179
- act(() => {
180
- result.current.handleClick({ id: '123' });
181
- });
182
-
183
- expect(mockWindowOpen).toHaveBeenCalledWith('/contacts/123', '_blank');
184
- expect(result.current.isOpen).toBe(false);
185
- });
186
-
187
- it('should open a new window when openNewTab is true regardless of mode', () => {
188
- const { result } = renderHook(() =>
189
- useNavigationOverlay({
190
- navigation: { mode: 'page', openNewTab: true },
191
- objectName: 'users',
192
- })
193
- );
194
-
195
- act(() => {
196
- result.current.handleClick({ id: '456' });
197
- });
198
-
199
- expect(mockWindowOpen).toHaveBeenCalledWith('/users/456', '_blank');
200
- });
201
-
202
- it('should delegate to onNavigate with new_window action when onNavigate is provided', () => {
203
- const onNavigate = vi.fn();
204
- const { result } = renderHook(() =>
205
- useNavigationOverlay({
206
- navigation: { mode: 'new_window' },
207
- objectName: 'contacts',
208
- onNavigate,
209
- })
210
- );
211
-
212
- act(() => {
213
- result.current.handleClick({ id: '789' });
214
- });
215
-
216
- expect(onNavigate).toHaveBeenCalledWith('789', 'new_window');
217
- expect(mockWindowOpen).not.toHaveBeenCalled();
218
- expect(result.current.isOpen).toBe(false);
219
- });
220
-
221
- it('should fallback to window.open when onNavigate is not provided', () => {
222
- const { result } = renderHook(() =>
223
- useNavigationOverlay({
224
- navigation: { mode: 'new_window' },
225
- objectName: 'accounts',
226
- })
227
- );
228
-
229
- act(() => {
230
- result.current.handleClick({ id: '101' });
231
- });
232
-
233
- expect(mockWindowOpen).toHaveBeenCalledWith('/accounts/101', '_blank');
234
- });
235
- });
236
-
237
- // ============================================================
238
- // mode: 'drawer'
239
- // ============================================================
240
-
241
- describe('mode: drawer', () => {
242
- it('should open overlay for drawer mode', () => {
243
- const { result } = renderHook(() =>
244
- useNavigationOverlay({
245
- navigation: { mode: 'drawer' },
246
- objectName: 'contacts',
247
- })
248
- );
249
-
250
- expect(result.current.isOpen).toBe(false);
251
- expect(result.current.isOverlay).toBe(true);
252
- expect(result.current.mode).toBe('drawer');
253
-
254
- act(() => {
255
- result.current.handleClick({ id: '123', name: 'John' });
256
- });
257
-
258
- expect(result.current.isOpen).toBe(true);
259
- expect(result.current.selectedRecord).toEqual({ id: '123', name: 'John' });
260
- });
261
-
262
- it('should close the overlay', () => {
263
- const { result } = renderHook(() =>
264
- useNavigationOverlay({
265
- navigation: { mode: 'drawer' },
266
- objectName: 'contacts',
267
- })
268
- );
269
-
270
- act(() => {
271
- result.current.handleClick({ id: '123' });
272
- });
273
- expect(result.current.isOpen).toBe(true);
274
-
275
- act(() => {
276
- result.current.close();
277
- });
278
- expect(result.current.isOpen).toBe(false);
279
- expect(result.current.selectedRecord).toBe(null);
280
- });
281
-
282
- it('should expose width from config', () => {
283
- const { result } = renderHook(() =>
284
- useNavigationOverlay({
285
- navigation: { mode: 'drawer', width: '600px' },
286
- objectName: 'contacts',
287
- })
288
- );
289
-
290
- expect(result.current.width).toBe('600px');
291
- });
292
- });
293
-
294
- // ============================================================
295
- // mode: 'modal'
296
- // ============================================================
297
-
298
- describe('mode: modal', () => {
299
- it('should open overlay for modal mode', () => {
300
- const { result } = renderHook(() =>
301
- useNavigationOverlay({
302
- navigation: { mode: 'modal' },
303
- objectName: 'contacts',
304
- })
305
- );
306
-
307
- expect(result.current.isOverlay).toBe(true);
308
- expect(result.current.mode).toBe('modal');
309
-
310
- act(() => {
311
- result.current.handleClick({ id: '123' });
312
- });
313
-
314
- expect(result.current.isOpen).toBe(true);
315
- });
316
-
317
- it('should support numeric width', () => {
318
- const { result } = renderHook(() =>
319
- useNavigationOverlay({
320
- navigation: { mode: 'modal', width: 800 },
321
- objectName: 'contacts',
322
- })
323
- );
324
-
325
- expect(result.current.width).toBe(800);
326
- });
327
- });
328
-
329
- // ============================================================
330
- // mode: 'split'
331
- // ============================================================
332
-
333
- describe('mode: split', () => {
334
- it('should open overlay for split mode', () => {
335
- const { result } = renderHook(() =>
336
- useNavigationOverlay({
337
- navigation: { mode: 'split' },
338
- objectName: 'contacts',
339
- })
340
- );
341
-
342
- expect(result.current.isOverlay).toBe(true);
343
- expect(result.current.mode).toBe('split');
344
-
345
- act(() => {
346
- result.current.handleClick({ id: '123' });
347
- });
348
-
349
- expect(result.current.isOpen).toBe(true);
350
- });
351
- });
352
-
353
- // ============================================================
354
- // mode: 'popover'
355
- // ============================================================
356
-
357
- describe('mode: popover', () => {
358
- it('should open overlay for popover mode', () => {
359
- const { result } = renderHook(() =>
360
- useNavigationOverlay({
361
- navigation: { mode: 'popover' },
362
- objectName: 'contacts',
363
- })
364
- );
365
-
366
- expect(result.current.isOverlay).toBe(true);
367
- expect(result.current.mode).toBe('popover');
368
-
369
- act(() => {
370
- result.current.handleClick({ id: '123' });
371
- });
372
-
373
- expect(result.current.isOpen).toBe(true);
374
- });
375
- });
376
-
377
- // ============================================================
378
- // open / close helpers
379
- // ============================================================
380
-
381
- describe('open/close helpers', () => {
382
- it('should support programmatic open', () => {
383
- const { result } = renderHook(() =>
384
- useNavigationOverlay({
385
- navigation: { mode: 'drawer' },
386
- objectName: 'contacts',
387
- })
388
- );
389
-
390
- act(() => {
391
- result.current.open({ id: 'test', name: 'Direct open' });
392
- });
393
-
394
- expect(result.current.isOpen).toBe(true);
395
- expect(result.current.selectedRecord).toEqual({ id: 'test', name: 'Direct open' });
396
- });
397
-
398
- it('should support setIsOpen for controlled overlay', () => {
399
- const { result } = renderHook(() =>
400
- useNavigationOverlay({
401
- navigation: { mode: 'modal' },
402
- objectName: 'contacts',
403
- })
404
- );
405
-
406
- act(() => {
407
- result.current.open({ id: '1' });
408
- });
409
- expect(result.current.isOpen).toBe(true);
410
-
411
- act(() => {
412
- result.current.setIsOpen(false);
413
- });
414
- expect(result.current.isOpen).toBe(false);
415
- });
416
- });
417
-
418
- // ============================================================
419
- // isOverlay flag
420
- // ============================================================
421
-
422
- describe('isOverlay flag', () => {
423
- const overlayModes: NavigationConfig['mode'][] = ['drawer', 'modal', 'split', 'popover'];
424
- const nonOverlayModes: NavigationConfig['mode'][] = ['page', 'new_window', 'none'];
425
-
426
- overlayModes.forEach((mode) => {
427
- it(`should be true for mode: ${mode}`, () => {
428
- const { result } = renderHook(() =>
429
- useNavigationOverlay({
430
- navigation: { mode },
431
- objectName: 'test',
432
- })
433
- );
434
- expect(result.current.isOverlay).toBe(true);
435
- });
436
- });
437
-
438
- nonOverlayModes.forEach((mode) => {
439
- it(`should be false for mode: ${mode}`, () => {
440
- const { result } = renderHook(() =>
441
- useNavigationOverlay({
442
- navigation: { mode },
443
- objectName: 'test',
444
- })
445
- );
446
- expect(result.current.isOverlay).toBe(false);
447
- });
448
- });
449
- });
450
-
451
- // ============================================================
452
- // navigation.view property
453
- // ============================================================
454
-
455
- describe('navigation.view property', () => {
456
- it('should expose the view property from config', () => {
457
- const { result } = renderHook(() =>
458
- useNavigationOverlay({
459
- navigation: { mode: 'drawer', view: 'edit_form' },
460
- objectName: 'contacts',
461
- })
462
- );
463
-
464
- expect(result.current.view).toBe('edit_form');
465
- });
466
-
467
- it('should pass view to onNavigate for page mode', () => {
468
- const onNavigate = vi.fn();
469
- const { result } = renderHook(() =>
470
- useNavigationOverlay({
471
- navigation: { mode: 'page', view: 'detail_view' },
472
- objectName: 'contacts',
473
- onNavigate,
474
- })
475
- );
476
-
477
- act(() => {
478
- result.current.handleClick({ id: '123' });
479
- });
480
-
481
- expect(onNavigate).toHaveBeenCalledWith('123', 'detail_view');
482
- });
483
-
484
- it('should include view in new_window URL', () => {
485
- const { result } = renderHook(() =>
486
- useNavigationOverlay({
487
- navigation: { mode: 'new_window', view: 'edit_form' },
488
- objectName: 'contacts',
489
- })
490
- );
491
-
492
- act(() => {
493
- result.current.handleClick({ id: '123' });
494
- });
495
-
496
- expect(mockWindowOpen).toHaveBeenCalledWith('/contacts/123/edit_form', '_blank');
497
- });
498
-
499
- it('should return undefined view when not configured', () => {
500
- const { result } = renderHook(() =>
501
- useNavigationOverlay({
502
- navigation: { mode: 'drawer' },
503
- objectName: 'contacts',
504
- })
505
- );
506
-
507
- expect(result.current.view).toBeUndefined();
508
- });
509
- });
510
-
511
- // ============================================================
512
- // Stale closure prevention
513
- // ============================================================
514
-
515
- describe('stale closure prevention', () => {
516
- it('should use latest onNavigate after re-render with new callback', () => {
517
- const onNavigateV1 = vi.fn();
518
- const onNavigateV2 = vi.fn();
519
-
520
- const { result, rerender } = renderHook(
521
- ({ onNavigate }) =>
522
- useNavigationOverlay({
523
- navigation: { mode: 'page' },
524
- objectName: 'contacts',
525
- onNavigate,
526
- }),
527
- { initialProps: { onNavigate: onNavigateV1 } }
528
- );
529
-
530
- // First click uses v1
531
- act(() => {
532
- result.current.handleClick({ id: '1' });
533
- });
534
- expect(onNavigateV1).toHaveBeenCalledWith('1', 'view');
535
- expect(onNavigateV2).not.toHaveBeenCalled();
536
-
537
- // Re-render with new onNavigate
538
- rerender({ onNavigate: onNavigateV2 });
539
-
540
- // Second click must use v2 (not stale v1)
541
- act(() => {
542
- result.current.handleClick({ id: '2' });
543
- });
544
- expect(onNavigateV2).toHaveBeenCalledWith('2', 'view');
545
- expect(onNavigateV1).toHaveBeenCalledTimes(1); // v1 was not called again
546
- });
547
-
548
- it('should use latest onNavigate after navigation config changes from undefined to page', () => {
549
- const onNavigate = vi.fn();
550
-
551
- const { result, rerender } = renderHook(
552
- ({ navigation }) =>
553
- useNavigationOverlay({
554
- navigation,
555
- objectName: 'contacts',
556
- onNavigate,
557
- }),
558
- { initialProps: { navigation: undefined as NavigationConfig | undefined } }
559
- );
560
-
561
- // Click with no config — should still call onNavigate (default page behavior)
562
- act(() => {
563
- result.current.handleClick({ id: '1' });
564
- });
565
- expect(onNavigate).toHaveBeenCalledWith('1', 'view');
566
-
567
- // Re-render with explicit page config
568
- rerender({ navigation: { mode: 'page' } });
569
-
570
- // Click should still work (not stale)
571
- act(() => {
572
- result.current.handleClick({ id: '2' });
573
- });
574
- expect(onNavigate).toHaveBeenCalledWith('2', 'view');
575
- expect(onNavigate).toHaveBeenCalledTimes(2);
576
- });
577
- });
578
- });