@@ -144,6 +144,11 @@ test('matches case with RegExp matcher', () => {
144144 expect ( queryByText ( / S t e p   1   o f   4 / ) ) . not . toBeTruthy ( ) 
145145} ) 
146146
147+ test ( 'queryByText matches case with non-string matcher' ,  ( )  =>  { 
148+  const  { queryByText}  =  render ( `<span>1</span>` ) 
149+  expect ( queryByText ( 1 ) ) . toBeTruthy ( ) 
150+ } ) 
151+ 
147152test ( 'can get form controls by label text' ,  ( )  =>  { 
148153 const  { getByLabelText}  =  render ( ` 
149154 <div> 
@@ -338,6 +343,11 @@ test('get can get form controls by placeholder', () => {
338343 expect ( getByPlaceholderText ( 'username' ) . id ) . toBe ( 'username-id' ) 
339344} ) 
340345
346+ test ( 'queryByPlaceholderText matches case with non-string matcher' ,  ( )  =>  { 
347+  const  { queryByPlaceholderText}  =  render ( `<input placeholder="1" />` ) 
348+  expect ( queryByPlaceholderText ( 1 ) ) . toBeTruthy ( ) 
349+ } ) 
350+ 
341351test ( 'label with no form control' ,  ( )  =>  { 
342352 const  { getByLabelText,  queryByLabelText}  =  render ( `<label>All alone</label>` ) 
343353 expect ( queryByLabelText ( / a l o n e / ) ) . toBeNull ( ) 
@@ -535,6 +545,11 @@ test('getByLabelText with aria-label', () => {
535545 expect ( queryByLabelText ( / b a t / ) ) . toBeTruthy ( ) 
536546} ) 
537547
548+ test ( 'queryByLabelText matches case with non-string matcher' ,  ( )  =>  { 
549+  const  { queryByLabelText}  =  render ( `<input aria-label="1" />` ) 
550+  expect ( queryByLabelText ( 1 ) ) . toBeTruthy ( ) 
551+ } ) 
552+ 
538553test ( 'get element by its alt text' ,  ( )  =>  { 
539554 const  { getByAltText}  =  render ( ` 
540555 <div> 
@@ -545,6 +560,11 @@ test('get element by its alt text', () => {
545560 expect ( getByAltText ( / f i n .* n e m .* p o s t e r $ / i) . src ) . toContain ( '/finding-nemo.png' ) 
546561} ) 
547562
563+ test ( 'queryByAltText matches case with non-string matcher' ,  ( )  =>  { 
564+  const  { queryByAltText}  =  render ( `<img alt="1" src="/finding-nemo.png" />` ) 
565+  expect ( queryByAltText ( 1 ) ) . toBeTruthy ( ) 
566+ } ) 
567+ 
548568test ( 'query/get element by its title' ,  ( )  =>  { 
549569 const  { getByTitle,  queryByTitle}  =  render ( ` 
550570 <div> 
@@ -577,6 +597,11 @@ test('query/get title element of SVG', () => {
577597 expect ( queryByTitle ( 'Close' ) . id ) . toEqual ( 'svg-title' ) 
578598} ) 
579599
600+ test ( 'queryByTitle matches case with non-string matcher' ,  ( )  =>  { 
601+  const  { queryByTitle}  =  render ( `<span title="1" />` ) 
602+  expect ( queryByTitle ( 1 ) ) . toBeTruthy ( ) 
603+ } ) 
604+ 
580605test ( 'query/get element by its value' ,  ( )  =>  { 
581606 const  { getByDisplayValue,  queryByDisplayValue}  =  render ( ` 
582607 <div> 
@@ -632,6 +657,15 @@ test('query/get select by text with multiple options selected', () => {
632657 expect ( queryByDisplayValue ( 'Alaska' ) . id ) . toEqual ( 'state-select' ) 
633658} ) 
634659
660+ test ( 'queryByDisplayValue matches case with non-string matcher' ,  ( )  =>  { 
661+  const  { queryByDisplayValue}  =  render ( ` 
662+  <select multiple id="state-select"> 
663+  <option selected value="one">1</option> 
664+  </select> 
665+  ` ) 
666+  expect ( queryByDisplayValue ( 1 ) ) . toBeTruthy ( ) 
667+ } ) 
668+ 
635669describe ( 'query by test id' ,  ( )  =>  { 
636670 afterEach ( ( )  =>  { 
637671 // Restore the default test id attribute 
@@ -651,6 +685,11 @@ describe('query by test id', () => {
651685 expect ( queryByTestId ( 'first-name' ) ) . not . toBeTruthy ( ) 
652686 } ) 
653687
688+  test ( 'queryByTestId matches case with non-string matcher' ,  ( )  =>  { 
689+  const  { queryByTestId}  =  render ( `<span data-testid="1" />` ) 
690+  expect ( queryByTestId ( 1 ) ) . toBeTruthy ( ) 
691+  } ) 
692+ 
654693 test ( 'can override test id attribute' ,  ( )  =>  { 
655694 const  { queryByTestId}  =  render ( `<div data-my-test-id="theTestId"></div>` ) 
656695
@@ -732,6 +771,11 @@ test('queryAllByRole returns semantic html elements', () => {
732771 expect ( queryAllByRole ( 'listbox' ) ) . toHaveLength ( 1 ) 
733772} ) 
734773
774+ test ( 'queryByRole matches case with non-string matcher' ,  ( )  =>  { 
775+  const  { queryByRole}  =  render ( `<span role="1" />` ) 
776+  expect ( queryByRole ( 1 ) ) . toBeTruthy ( ) 
777+ } ) 
778+ 
735779test ( 'getAll* matchers return an array' ,  ( )  =>  { 
736780 const  { 
737781 getAllByAltText, 
0 commit comments