File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -5,12 +5,25 @@ import {
5
5
Queries ,
6
6
BoundFunction ,
7
7
prettyFormat ,
8
+ Config as ConfigDTL ,
8
9
} from '@testing-library/dom'
9
10
import { Renderer } from 'react-dom'
10
11
import { act as reactAct } from 'react-dom/test-utils'
11
12
12
13
export * from '@testing-library/dom'
13
14
15
+ export interface Config extends ConfigDTL {
16
+ reactStrictMode : boolean
17
+ }
18
+
19
+ export interface ConfigFn {
20
+ ( existingConfig : Config ) : Partial < Config >
21
+ }
22
+
23
+ export function configure ( configDelta : ConfigFn | Partial < Config > ) : void
24
+
25
+ export function getConfig ( ) : Config
26
+
14
27
export type RenderResult <
15
28
Q extends Queries = typeof queries ,
16
29
Container extends Element | DocumentFragment = HTMLElement ,
Original file line number Diff line number Diff line change @@ -62,6 +62,28 @@ export function testFireEvent() {
62
62
fireEvent . click ( container )
63
63
}
64
64
65
+ export function testConfigure ( ) {
66
+ // test for DTL's config
67
+ pure . configure ( { testIdAttribute : 'foobar' } )
68
+ pure . configure ( existingConfig => ( {
69
+ testIdAttribute : `modified-${ existingConfig . testIdAttribute } ` ,
70
+ } ) )
71
+
72
+ // test for RTL's config
73
+ pure . configure ( { reactStrictMode : true } )
74
+ pure . configure ( existingConfig => ( {
75
+ reactStrictMode : ! existingConfig . reactStrictMode ,
76
+ } ) )
77
+ }
78
+
79
+ export function testGetConfig ( ) {
80
+ // test for DTL's config
81
+ pure . getConfig ( ) . testIdAttribute
82
+
83
+ // test for RTL's config
84
+ pure . getConfig ( ) . reactStrictMode
85
+ }
86
+
65
87
export function testDebug ( ) {
66
88
const { debug, getAllByTestId} = render (
67
89
< >
You can’t perform that action at this time.
0 commit comments