Open History to see the last commit
1import * as React from 'react'
2import { fireEvent, screen, waitFor, act } from '@testing-library/react'
3import '@testing-library/jest-dom'
4import { useQuery } from '@tanstack/react-query'
5import { defaultPanelSize, sortFns } from '../utils'
6import {
7 getByTextContent,
8 renderWithClient,
9 sleep,
10 createQueryClient,
11} from './utils'
12β
13Object.defineProperty(window, 'matchMedia', {
14 writable: true,
15 value: jest.fn().mockImplementation((query: string) => ({
16 matches: false,
17 media: query,
18 onchange: null,
19 addListener: jest.fn(), // deprecated
20 removeListener: jest.fn(), // deprecated
21 addEventListener: jest.fn(),
22 removeEventListener: jest.fn(),
23 dispatchEvent: jest.fn(),
24 })),
25})
26β
27describe('ReactQueryDevtools', () => {
28 beforeEach(() => {
29 localStorage.removeItem('reactQueryDevtoolsOpen')
30 localStorage.removeItem('reactQueryDevtoolsPanelPosition')
31 })
32 it('should be able to open and close devtools', async () => {
33 const { queryClient } = createQueryClient()
34 const onCloseClick = jest.fn()
35 const onToggleClick = jest.fn()
36β
37 function Page() {
38 const { data = 'default' } = useQuery({
39 queryKey: ['check'],
40 queryFn: async () => {
41 await sleep(10)
42 return 'test'
43 },
44 })
45β
46 return (
47 <div>
48 <h1>{data}</h1>
49 </div>
50 )
51 }
52β
53 renderWithClient(queryClient, <Page />, {
54 initialIsOpen: false,
55 closeButtonProps: { onClick: onCloseClick },
56 toggleButtonProps: { onClick: onToggleClick },
57 })
58β
59 const verifyDevtoolsIsOpen = () => {
60 expect(
61 screen.queryByRole('generic', { name: /react query devtools panel/i }),
62 ).not.toBeNull()
63 expect(
64 screen.queryByRole('button', { name: /open react query devtools/i }),
65 ).toBeNull()
66 }
67 const verifyDevtoolsIsClosed = () => {
68 expect(
69 screen.queryByRole('generic', { name: /react query devtools panel/i }),
70 ).toBeNull()
71 expect(
72 screen.queryByRole('button', { name: /open react query devtools/i }),
73 ).not.toBeNull()
74 }
75β
76 const waitForDevtoolsToOpen = () =>
77 screen.findByRole('button', { name: /close react query devtools/i })
78 const waitForDevtoolsToClose = () =>
79 screen.findByRole('button', { name: /open react query devtools/i })
80β
81 const getOpenLogoButton = () =>
82 screen.getByRole('button', { name: /open react query devtools/i })
83 const getCloseLogoButton = () =>
84 screen.getByRole('button', { name: /close react query devtools/i })
85 const getCloseButton = () =>
86 screen.getByRole('button', { name: /^close$/i })
87β
88 verifyDevtoolsIsClosed()
89β
90 fireEvent.click(getOpenLogoButton())
91 await waitForDevtoolsToOpen()
92β
93 verifyDevtoolsIsOpen()
94β
95 fireEvent.click(getCloseLogoButton())
96 await waitForDevtoolsToClose()
97β
98 verifyDevtoolsIsClosed()
99β
100 fireEvent.click(getOpenLogoButton())
101 await waitForDevtoolsToOpen()
102β
103 verifyDevtoolsIsOpen()
104β
105 fireEvent.click(getCloseButton())
106 await waitForDevtoolsToClose()
107β
108 verifyDevtoolsIsClosed()
109 })
110β
111 it('should be able to drag devtools without error', async () => {
112 const { queryClient } = createQueryClient()
113β
114 function Page() {
115 const { data = 'default' } = useQuery({
116 queryKey: ['check'],
117 queryFn: async () => {
118 await sleep(10)
119 return 'test'
120 },
121 })
122β
123 return (
124 <div>
125 <h1>{data}</h1>
126 </div>
127 )
128 }
129β
130 const result = renderWithClient(queryClient, <Page />, {
131 initialIsOpen: false,
132 })
133β
134 const draggableElement = result.container
135 .querySelector('#ReactQueryDevtoolsPanel')
136 ?.querySelector('div')
137β
138 if (!draggableElement) {
139 throw new Error('Could not find the draggable element')
140 }
141β
142 await act(async () => {
143 fireEvent.mouseDown(draggableElement)
144 })
145 })
146β
147 it('should display the correct query states', async () => {
148 const { queryClient, queryCache } = createQueryClient()
149β
150 function Page() {
151 const { data = 'default' } = useQuery({
152 queryKey: ['check'],
153 queryFn: async () => {
154 await sleep(100)
155 return 'test'
156 },
157 staleTime: 300,
158 })
159β
160 return (
161 <div>
162 <h1>{data}</h1>
163 </div>
164 )
165 }
166β
167 function PageParent() {
168 const [isPageVisible, togglePageVisible] = React.useReducer(
169 (visible) => !visible,
170 true,
171 )
172β
173 return (
174 <div>
175 <button
176 type="button"
177 aria-label="Toggle page visibility"
178 onClick={togglePageVisible}
179 >
180 Toggle Page
181 </button>
182 {isPageVisible && <Page />}
183 </div>
184 )
185 }
186β
187 renderWithClient(queryClient, <PageParent />)
188β
189 fireEvent.click(
190 screen.getByRole('button', { name: /open react query devtools/i }),
191 )
192β
193 const currentQuery = queryCache.find({ queryKey: ['check'] })
194β
195 // When the query is fetching then expect number of
196 // fetching queries to be 1
197 expect(currentQuery?.state.fetchStatus).toEqual('fetching')
198 await screen.findByText(
199 getByTextContent(
200 'fresh (0) fetching (1) paused (0) stale (0) inactive (0)',
201 ),
202 )
203β
204 // When we are done fetching the query doesn't go stale
205 // until 300ms after, so expect the number of fresh
206 // queries to be 1
207 await waitFor(() => {
208 expect(currentQuery?.state.fetchStatus).toEqual('idle')
209 })
210 await screen.findByText(
211 getByTextContent(
212 'fresh (1) fetching (0) paused (0) stale (0) inactive (0)',
213 ),
214 )
215β
216 // Then wait for the query to go stale and then
217 // expect the number of stale queries to be 1
218 await waitFor(() => {
219 expect(currentQuery?.isStale()).toEqual(false)
220 })
221 await screen.findByText(
222 getByTextContent(
223 'fresh (0) fetching (0) paused (0) stale (1) inactive (0)',
224 ),
225 )
226β
227 // Unmount the page component thus making the query inactive
228 // and expect number of inactive queries to be 1
229 fireEvent.click(
230 screen.getByRole('button', { name: /toggle page visibility/i }),
231 )
232 await screen.findByText(
233 getByTextContent(
234 'fresh (0) fetching (0) paused (0) stale (0) inactive (1)',
235 ),
236 )
237 })
238β
239 it('should display the query hash and open the query details', async () => {
240 const { queryClient, queryCache } = createQueryClient()
241β
242 function Page() {
243 const { data = 'default' } = useQuery({
244 queryKey: ['check'],
245 queryFn: async () => {
246 await sleep(10)
247 return 'test'
248 },
249 })
250β
251 return (
252 <div>
253 <h1>{data}</h1>
254 </div>
255 )
256 }
257β
258 renderWithClient(queryClient, <Page />)
259β
260 fireEvent.click(
261 screen.getByRole('button', { name: /open react query devtools/i }),
262 )
263β
264 const currentQuery = queryCache.find({ queryKey: ['check'] })
265β
266 await screen.findByText(getByTextContent(`1${currentQuery?.queryHash}`))
267β
268 const queryButton = await screen.findByRole('button', {
269 name: `Open query details for ${currentQuery?.queryHash}`,
270 })
271β
272 fireEvent.click(queryButton)
273β
274 await screen.findByText(/query details/i)
275 })
276β
277 it('should filter the queries via the query hash', async () => {
278 const { queryClient, queryCache } = createQueryClient()
279β
280 function Page() {
281 const fooResult = useQuery({
282 queryKey: ['foo'],
283 queryFn: async () => {
284 await sleep(10)
285 return 'foo-result'
286 },
287 })
288β
289 const barResult = useQuery({
290 queryKey: ['bar'],
291 queryFn: async () => {
292 await sleep(10)
293 return 'bar-result'
294 },
295 })
296β
297 const bazResult = useQuery({
298 queryKey: ['baz'],
299 queryFn: async () => {
300 await sleep(10)
301 return 'baz-result'
302 },
303 })
304β
305 return (
306 <div>
307 <h1>
308 {barResult.data} {fooResult.data} {bazResult.data}
309 </h1>
310 </div>
311 )
312 }
313β
314 renderWithClient(queryClient, <Page />)
315β
316 fireEvent.click(
317 screen.getByRole('button', { name: /open react query devtools/i }),
318 )
319β
320 const fooQueryHash =
321 queryCache.find({ queryKey: ['foo'] })?.queryHash ?? 'invalid hash'
322 const barQueryHash =
323 queryCache.find({ queryKey: ['bar'] })?.queryHash ?? 'invalid hash'
324 const bazQueryHash =
325 queryCache.find({ queryKey: ['baz'] })?.queryHash ?? 'invalid hash'
326β
327 await screen.findByText(fooQueryHash)
328 screen.getByText(barQueryHash)
329 screen.getByText(bazQueryHash)
330β
331 const filterInput = screen.getByLabelText(/filter by queryhash/i)
332 fireEvent.change(filterInput, { target: { value: 'fo' } })
333β
334 await screen.findByText(fooQueryHash)
335 const barItem = screen.queryByText(barQueryHash)
336 const bazItem = screen.queryByText(bazQueryHash)
337 expect(barItem).toBeNull()
338 expect(bazItem).toBeNull()
339β
340 fireEvent.change(filterInput, { target: { value: '' } })
341 })
342β
343 it('should show a disabled label if all observers are disabled', async () => {
344 const { queryClient } = createQueryClient()
345β
346 function Page() {
347 const [enabled, setEnabled] = React.useState(false)
348 const { data } = useQuery({
349 queryKey: ['key'],
350 queryFn: async () => {
351 await sleep(10)
352 return 'test'
353 },
354 enabled,
355 })
356β
357 return (
358 <div>
359 <h1>{data}</h1>
360 <button onClick={() => setEnabled(true)}>Enable Query</button>
361 </div>
362 )
363 }
364β
365 renderWithClient(queryClient, <Page />, { initialIsOpen: true })
366β
367 await screen.findByText(/disabled/i)
368β
369 fireEvent.click(screen.getByRole('button', { name: /enable query/i }))
370β
371 await waitFor(() => {
372 expect(screen.queryByText(/disabled/i)).not.toBeInTheDocument()
373 })
374 })
375β
376 it('should not show a disabled label for inactive queries', async () => {
377 const { queryClient } = createQueryClient()
378β
379 function Page() {
380 const { data } = useQuery({
381 queryKey: ['key'],
382 queryFn: () => Promise.resolve('test'),
383 enabled: false,
384 })
385β
386 return (
387 <div>
388 <h1>{data}</h1>
389 </div>
390 )
391 }
392β
393 function App() {
394 const [visible, setVisible] = React.useState(true)
395β
396 return (
397 <div>
398 {visible ? <Page /> : null}
399 <button onClick={() => setVisible(false)}>Hide Query</button>
400 </div>
401 )
402 }
403β
404 renderWithClient(queryClient, <App />, { initialIsOpen: true })
405β
406 await screen.findByText(/disabled/i)
407β
408 fireEvent.click(screen.getByRole('button', { name: /hide query/i }))
409β
410 await waitFor(() => {
411 expect(screen.queryByText(/disabled/i)).not.toBeInTheDocument()
412 })
413 })
414β
415 it('should simulate offline mode', async () => {
416 const { queryClient } = createQueryClient()
417 let count = 0
418β
419 function App() {
420 const { data, fetchStatus } = useQuery({
421 queryKey: ['key'],
422 queryFn: () => {
423 count++
424 return Promise.resolve('test')
425 },
426 })
427β
428 return (
429 <div>
430 <h1>
431 {data}, {fetchStatus}
432 </h1>
433 </div>
434 )
435 }
436β
437 renderWithClient(queryClient, <App />, {
438 initialIsOpen: true,
439 })
440β
441 await screen.findByRole('heading', { name: /test/i })
442β
443 fireEvent.click(
444 screen.getByRole('button', { name: /mock offline behavior/i }),
445 )
446β
447 const queryButton = await screen.findByRole('button', {
448 name: 'Open query details for ["key"]',
449 })
450 fireEvent.click(queryButton)
451β
452 const refetchButton = await screen.findByRole('button', {
453 name: /refetch/i,
454 })
455 fireEvent.click(refetchButton)
456β
457 await waitFor(() => {
458 expect(screen.getByText('test, paused')).toBeInTheDocument()
459 })
460β
461 fireEvent.click(
462 screen.getByRole('button', { name: /restore offline mock/i }),
463 )
464β
465 await waitFor(() => {
466 expect(screen.getByText('test, idle')).toBeInTheDocument()
467 })
468β
469 expect(count).toBe(2)
470 })
471β
472 it('should sort the queries according to the sorting filter', async () => {
473 const { queryClient, queryCache } = createQueryClient()
474β
475 function Page() {
476 const query1Result = useQuery({
477 queryKey: ['query-1'],
478 queryFn: async () => {
479 await sleep(20)
480 return 'query-1-result'
481 },
482 })
483β
484 const query3Result = useQuery({
485 queryKey: ['query-3'],
486 queryFn: async () => {
487 await sleep(10)
488 return 'query-3-result'
489 },
490 staleTime: Infinity,
491 enabled: typeof query1Result.data === 'string',
492 })
493β
494 const query2Result = useQuery({
495 queryKey: ['query-2'],
496 queryFn: async () => {
497 await sleep(10)
498 return 'query-2-result'
499 },
500β
501 enabled: typeof query3Result.data === 'string',
502 })
503β
504 return (
505 <div>
506 <h1>
507 {query1Result.data} {query2Result.data} {query3Result.data}
508 </h1>
509 </div>
510 )
511 }
512β
513 renderWithClient(queryClient, <Page />)
514β
515 fireEvent.click(
516 screen.getByRole('button', { name: /open react query devtools/i }),
517 )
518β
519 const query1Hash =
520 queryCache.find({ queryKey: ['query-1'] })?.queryHash ?? 'invalid hash'
521 const query2Hash =
522 queryCache.find({ queryKey: ['query-2'] })?.queryHash ?? 'invalid hash'
523 const query3Hash =
524 queryCache.find({ queryKey: ['query-3'] })?.queryHash ?? 'invalid hash'
525β
526 const sortSelect = screen.getByLabelText(/sort queries/i)
527 let queries = []
528β
529 // When sorted by query hash the queries get sorted according
530 // to just the number, with the order being -> query-1, query-2, query-3
531 fireEvent.change(sortSelect, { target: { value: 'Query Hash' } })
532β
533 /** To check the order of the queries we can use regex to find
534 * all the row items in an array and then compare the items
535 * one by one in the order we expect it
536 * @reference https://github.com/testing-library/react-testing-library/issues/313#issuecomment-625294327
537 */
538 queries = await screen.findAllByText(/\["query-[1-3]"\]/)
539 expect(queries[0]?.textContent).toEqual(query1Hash)
540 expect(queries[1]?.textContent).toEqual(query2Hash)
541 expect(queries[2]?.textContent).toEqual(query3Hash)
542β
543 // Wait for the queries to be resolved
544 await screen.findByText(/query-1-result query-2-result query-3-result/i)
545β
546 // When sorted by the last updated date the queries are sorted by the time
547 // they were updated and since the query-2 takes longest time to complete
548 // and query-1 the shortest, so the order is -> query-2, query-3, query-1
549 fireEvent.change(sortSelect, { target: { value: 'Last Updated' } })
550β
551 queries = await screen.findAllByText(/\["query-[1-3]"\]/)
552 expect(queries[0]?.textContent).toEqual(query2Hash)
553 expect(queries[1]?.textContent).toEqual(query3Hash)
554 expect(queries[2]?.textContent).toEqual(query1Hash)
555β
556 // When sorted by the status and then last updated date the queries
557 // query-3 takes precedence because its stale time being infinity, it
558 // always remains fresh, the rest of the queries are sorted by their last
559 // updated time, so the resulting order is -> query-3, query-2, query-1
560 fireEvent.change(sortSelect, {
561 target: { value: 'Status > Last Updated' },
562 })
563β
564 queries = await screen.findAllByText(/\["query-[1-3]"\]/)
565 expect(queries[0]?.textContent).toEqual(query3Hash)
566 expect(queries[1]?.textContent).toEqual(query2Hash)
567 expect(queries[2]?.textContent).toEqual(query1Hash)
568β
569 // Switch the order form ascending to descending and expect the
570 // query order to be reversed from previous state
571 fireEvent.click(screen.getByRole('button', { name: /β¬ asc/i }))
572β
573 queries = await screen.findAllByText(/\["query-[1-3]"\]/)
574 expect(queries[0]?.textContent).toEqual(query1Hash)
575 expect(queries[1]?.textContent).toEqual(query2Hash)
576 expect(queries[2]?.textContent).toEqual(query3Hash)
577 })
578β
579 it('should initialize filtering and sorting values with defaults when they are not stored in localstorage', () => {
580 localStorage.removeItem('reactQueryDevtoolsBaseSort')
581 localStorage.removeItem('reactQueryDevtoolsSortFn')
582 localStorage.removeItem('reactQueryDevtoolsFilter')
583β
584 const { queryClient } = createQueryClient()
585β
586 function Page() {
587 const { data = 'default' } = useQuery({
588 queryKey: ['check'],
589 queryFn: async () => {
590 await sleep(10)
591 return 'test'
592 },
593 })
594β
595 return (
596 <div>
597 <h1>{data}</h1>
598 </div>
599 )
600 }
601β
602 renderWithClient(queryClient, <Page />, {
603 initialIsOpen: true,
604 })
605β
606 const filterInput: HTMLInputElement =
607 screen.getByLabelText(/Filter by queryhash/i)
608 expect(filterInput.value).toEqual('')
609β
610 const sortCombobox: HTMLSelectElement =
611 screen.getByLabelText(/Sort queries/i)
612 expect(sortCombobox.value).toEqual(Object.keys(sortFns)[0])
613β
614 expect(screen.getByRole('button', { name: /Asc/i })).toBeInTheDocument()
615β
616 const detailsPanel = screen.queryByText(/Query Details/i)
617 expect(detailsPanel).not.toBeInTheDocument()
618 })
619β
620 it('should initialize sorting values with ones stored in localstorage', async () => {
621 localStorage.setItem('reactQueryDevtoolsBaseSort', 'true')
622 localStorage.setItem(
623 'reactQueryDevtoolsSortFn',
624 JSON.stringify(Object.keys(sortFns)[1]),
625 )
626β
627 const { queryClient } = createQueryClient()
628β
629 function Page() {
630 const { data = 'default' } = useQuery({
631 queryKey: ['check'],
632 queryFn: async () => {
633 await sleep(10)
634 return 'test'
635 },
636 })
637β
638 return (
639 <div>
640 <h1>{data}</h1>
641 </div>
642 )
643 }
644β
645 renderWithClient(queryClient, <Page />, {
646 initialIsOpen: true,
647 })
648β
649 const sortCombobox: HTMLSelectElement =
650 screen.getByLabelText(/Sort queries/i)
651 expect(sortCombobox.value).toEqual(Object.keys(sortFns)[1])
652β
653 expect(screen.getByRole('button', { name: /Desc/i })).toBeInTheDocument()
654 })
655β
656 it('should initialize filter value with one stored in localstorage', () => {
657 localStorage.setItem('reactQueryDevtoolsFilter', JSON.stringify('posts'))
658β
659 const { queryClient } = createQueryClient()
660β
661 function Page() {
662 const { data = 'default' } = useQuery({
663 queryKey: ['check'],
664 queryFn: async () => {
665 await sleep(10)
666 return 'test'
667 },
668 })
669β
670 return (
671 <div>
672 <h1>{data}</h1>
673 </div>
674 )
675 }
676β
677 renderWithClient(queryClient, <Page />, {
678 initialIsOpen: true,
679 })
680β
681 const filterInput: HTMLInputElement =
682 screen.getByLabelText(/Filter by queryhash/i)
683 expect(filterInput.value).toEqual('posts')
684 })
685β
686 it('style should have a nonce', async () => {
687 const { queryClient } = createQueryClient()
688β
689 function Page() {
690 return <div></div>
691 }
692β
693 const { container } = renderWithClient(queryClient, <Page />, {
694 styleNonce: 'test-nonce',
695 initialIsOpen: false,
696 })
697 const styleTag = container.querySelector('style')
698 expect(styleTag).toHaveAttribute('nonce', 'test-nonce')
699β
700 await screen.findByRole('button', { name: /react query devtools/i })
701 })
702β
703 it('should render a menu to select panel position', async () => {
704 const { queryClient } = createQueryClient()
705β
706 function Page() {
707 const { data = 'default' } = useQuery({
708 queryKey: ['check'],
709 queryFn: async () => 'test',
710 })
711β
712 return (
713 <div>
714 <h1>{data}</h1>
715 </div>
716 )
717 }
718β
719 renderWithClient(queryClient, <Page />, {
720 initialIsOpen: true,
721 })
722β
723 const positionSelect = (await screen.findByLabelText(
724 'Panel position',
725 )) as HTMLSelectElement
726β
727 expect(positionSelect.value).toBe('bottom')
728 })
729β
730 it(`should render the panel to the left if panelPosition is set to 'left'`, async () => {
731 const { queryClient } = createQueryClient()
732β
733 function Page() {
734 const { data = 'default' } = useQuery({
735 queryKey: ['check'],
736 queryFn: async () => 'test',
737 })
738β
739 return (
740 <div>
741 <h1>{data}</h1>
742 </div>
743 )
744 }
745β
746 renderWithClient(queryClient, <Page />, {
747 initialIsOpen: true,
748 panelPosition: 'left',
749 })
750β
751 const positionSelect = (await screen.findByLabelText(
752 'Panel position',
753 )) as HTMLSelectElement
754β
755 expect(positionSelect.value).toBe('left')
756β
757 const panel = (await screen.getByLabelText(
758 'React Query Devtools Panel',
759 )) as HTMLDivElement
760β
761 expect(panel.style.left).toBe('0px')
762 expect(panel.style.width).toBe('500px')
763 expect(panel.style.height).toBe('100vh')
764 })
765β
766 it('should change the panel position if user select different option from the menu', async () => {
767 const { queryClient } = createQueryClient()
768β
769 function Page() {
770 const { data = 'default' } = useQuery({
771 queryKey: ['check'],
772 queryFn: async () => 'test',
773 })
774β
775 return (
776 <div>
777 <h1>{data}</h1>
778 </div>
779 )
780 }
781β
782 renderWithClient(queryClient, <Page />, {
783 initialIsOpen: true,
784 })
785β
786 const positionSelect = (await screen.findByLabelText(
787 'Panel position',
788 )) as HTMLSelectElement
789β
790 expect(positionSelect.value).toBe('bottom')
791β
792 const panel = (await screen.getByLabelText(
793 'React Query Devtools Panel',
794 )) as HTMLDivElement
795β
796 expect(panel.style.bottom).toBe('0px')
797 expect(panel.style.height).toBe('500px')
798 expect(panel.style.width).toBe('100%')
799β
800 await act(async () => {
801 fireEvent.change(positionSelect, { target: { value: 'right' } })
802 })
803β
804 expect(positionSelect.value).toBe('right')
805β
806 expect(panel.style.right).toBe('0px')
807 expect(panel.style.width).toBe('500px')
808 expect(panel.style.height).toBe('100vh')
809 })
810β
811 it('should restore parent element padding after closing', async () => {
812 const { queryClient } = createQueryClient()
813β
814 function Page() {
815 const { data = 'default' } = useQuery({
816 queryKey: ['check'],
817 queryFn: async () => 'test',
818 })
819β
820 return (
821 <div>
822 <h1>{data}</h1>
823 </div>
824 )
825 }
826β
827 const parentElementTestid = 'parentElement'
828 const parentPaddings = {
829 paddingTop: '428px',
830 paddingBottom: '39px',
831 paddingLeft: '-373px',
832 paddingRight: '20%',
833 }
834β
835 function Parent({ children }: { children: React.ReactElement }) {
836 return (
837 <div data-testid={parentElementTestid} style={parentPaddings}>
838 {children}
839 </div>
840 )
841 }
842β
843 renderWithClient(
844 queryClient,
845 <Page />,
846 {
847 initialIsOpen: true,
848 panelPosition: 'bottom',
849 },
850 { wrapper: Parent },
851 )
852β
853 const parentElement = screen.getByTestId(parentElementTestid)
854 expect(parentElement).toHaveStyle({
855 paddingTop: '0px',
856 paddingLeft: '0px',
857 paddingRight: '0px',
858 paddingBottom: defaultPanelSize,
859 })
860β
861 fireEvent.click(screen.getByRole('button', { name: /^close$/i }))
862 expect(parentElement).toHaveStyle(parentPaddings)
863 })
864})