File tree 2 files changed +23
-2
lines changed
2 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -19,4 +19,21 @@ test('debug pretty prints the container', () => {
19
19
)
20
20
} )
21
21
22
+ test ( 'debug pretty prints multiple containers' , ( ) => {
23
+ const HelloWorld = ( ) => (
24
+ < >
25
+ < h1 data-testid = "testId" > Hello World</ h1 >
26
+ < h1 data-testid = "testId" > Hello World</ h1 >
27
+ </ >
28
+ )
29
+ const { getAllByTestId, debug} = render ( < HelloWorld /> )
30
+ const multipleElements = getAllByTestId ( 'testId' )
31
+ debug ( multipleElements )
32
+
33
+ expect ( console . log ) . toHaveBeenCalledTimes ( 2 )
34
+ expect ( console . log ) . toHaveBeenCalledWith (
35
+ expect . stringContaining ( 'Hello World' ) ,
36
+ )
37
+ } )
38
+
22
39
/* eslint no-console:0 */
Original file line number Diff line number Diff line change @@ -60,8 +60,12 @@ function render(
60
60
return {
61
61
container,
62
62
baseElement,
63
- // eslint-disable-next-line no-console
64
- debug : ( el = baseElement ) => console . log ( prettyDOM ( el ) ) ,
63
+ debug : ( el = baseElement ) =>
64
+ Array . isArray ( el )
65
+ ? // eslint-disable-next-line no-console
66
+ el . forEach ( e => console . log ( prettyDOM ( e ) ) )
67
+ : // eslint-disable-next-line no-console,
68
+ console . log ( prettyDOM ( el ) ) ,
65
69
unmount : ( ) => ReactDOM . unmountComponentAtNode ( container ) ,
66
70
rerender : rerenderUi => {
67
71
render ( wrapUiIfNeeded ( rerenderUi ) , { container, baseElement} )
You can’t perform that action at this time.
0 commit comments