@@ -97,15 +97,7 @@ cases(
9797 } ,
9898)
9999
100- test . each ( [
101- [ 'getByLabelText' ] ,
102- [ 'getByPlaceholderText' ] ,
103- [ 'getByText' ] ,
104- [ 'getByAltText' ] ,
105- [ 'getByTitle' ] ,
106- [ 'getByRole' ] ,
107- [ 'getByTestId' ] ,
108- ] ) (
100+ test . each ( [ [ 'getByText' ] , [ 'getByLabelText' ] ] ) (
109101 '%s query will print the playground link when enabled in the config' ,
110102 query => {
111103 configure ( { printPlaygroundLink : true } )
@@ -114,15 +106,7 @@ test.each([
114106 } ,
115107)
116108
117- test . each ( [
118- [ 'getByLabelText' ] ,
119- [ 'getByPlaceholderText' ] ,
120- [ 'getByText' ] ,
121- [ 'getByAltText' ] ,
122- [ 'getByTitle' ] ,
123- [ 'getByRole' ] ,
124- [ 'getByTestId' ] ,
125- ] ) (
109+ test . each ( [ [ 'getByText' ] , [ 'getByLabelText' ] ] ) (
126110 '%s query will NOT print the playground link when disabled in the config' ,
127111 query => {
128112 configure ( { printPlaygroundLink : false } )
@@ -131,6 +115,15 @@ test.each([
131115 } ,
132116)
133117
118+ test . each ( [ [ 'getByText' ] , [ 'getByLabelText' ] ] ) (
119+ '%s query will NOT print the playground link when element has no children' ,
120+ query => {
121+ configure ( { printPlaygroundLink : true } )
122+ document . body . innerHTML = ''
123+ expect ( ( ) => screen [ query ] ( 'TEST QUERY' ) ) . not . toThrowError ( / p l a y g r o u n d / i)
124+ } ,
125+ )
126+
134127describe ( '*ByDisplayValue queries throw an error when there are multiple elements returned' , ( ) => {
135128 test ( 'getByDisplayValue' , ( ) => {
136129 const { getByDisplayValue} = render (
0 commit comments