@tanstack/react-query-devtools 5.0.0-alpha.10 → 5.0.0-alpha.11
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.
- package/build/lib/devtools.esm.js +1 -0
- package/build/lib/devtools.esm.js.map +1 -1
- package/build/lib/devtools.js +1 -0
- package/build/lib/devtools.js.map +1 -1
- package/build/lib/devtools.mjs +1 -0
- package/build/lib/devtools.mjs.map +1 -1
- package/build/lib/index.prod.esm.js +1 -0
- package/build/lib/index.prod.esm.js.map +1 -1
- package/build/lib/index.prod.js +1 -0
- package/build/lib/index.prod.js.map +1 -1
- package/build/lib/index.prod.mjs +1 -0
- package/build/lib/index.prod.mjs.map +1 -1
- package/build/umd/index.development.js +1 -0
- package/build/umd/index.development.js.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/devtools.test.tsx +26 -1
- package/src/devtools.tsx +1 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
2
|
import { fireEvent, screen, waitFor, act } from '@testing-library/react'
|
|
3
3
|
import '@testing-library/jest-dom'
|
|
4
|
-
import { useQuery } from '@tanstack/react-query'
|
|
4
|
+
import { useQuery, onlineManager } from '@tanstack/react-query'
|
|
5
5
|
import { defaultPanelSize, sortFns } from '../utils'
|
|
6
6
|
import {
|
|
7
7
|
getByTextContent,
|
|
@@ -478,6 +478,31 @@ describe('ReactQueryDevtools', () => {
|
|
|
478
478
|
expect(count).toBe(2)
|
|
479
479
|
})
|
|
480
480
|
|
|
481
|
+
it('should inform onlineManager when offline mode is simulated', () => {
|
|
482
|
+
const { queryClient } = createQueryClient()
|
|
483
|
+
const online: Array<boolean> = []
|
|
484
|
+
|
|
485
|
+
const unsubscribe = onlineManager.subscribe(() => {
|
|
486
|
+
online.push(onlineManager.isOnline())
|
|
487
|
+
})
|
|
488
|
+
|
|
489
|
+
renderWithClient(queryClient, <div />, {
|
|
490
|
+
initialIsOpen: true,
|
|
491
|
+
})
|
|
492
|
+
|
|
493
|
+
fireEvent.click(
|
|
494
|
+
screen.getByRole('button', { name: /mock offline behavior/i }),
|
|
495
|
+
)
|
|
496
|
+
|
|
497
|
+
fireEvent.click(
|
|
498
|
+
screen.getByRole('button', { name: /restore offline mock/i }),
|
|
499
|
+
)
|
|
500
|
+
|
|
501
|
+
expect(online).toStrictEqual([false, true])
|
|
502
|
+
|
|
503
|
+
unsubscribe()
|
|
504
|
+
})
|
|
505
|
+
|
|
481
506
|
it('should sort the queries according to the sorting filter', async () => {
|
|
482
507
|
const { queryClient, queryCache } = createQueryClient()
|
|
483
508
|
|