@@ -21,15 +21,15 @@ describe('renderValue', () => {
2121 it ( 'should be used by default' , async ( ) => {
2222 await setup ( { columns, rows } ) ;
2323 const [ cell1 , cell2 ] = getCells ( ) ;
24- expect ( cell1 ) . toHaveTextContent ( '101' ) ;
25- expect ( cell2 ) . toBeEmptyDOMElement ( ) ;
24+ await expect . element ( cell1 ) . toHaveTextContent ( '101' ) ;
25+ await expect . element ( cell2 ) . toBeEmptyDOMElement ( ) ;
2626 } ) ;
2727
2828 it ( 'should handle non-object values' , async ( ) => {
2929 await setup ( { columns, rows : [ null ] } ) ;
3030 const [ cell1 , cell2 ] = getCells ( ) ;
31- expect ( cell1 ) . toBeEmptyDOMElement ( ) ;
32- expect ( cell2 ) . toBeEmptyDOMElement ( ) ;
31+ await expect . element ( cell1 ) . toBeEmptyDOMElement ( ) ;
32+ await expect . element ( cell2 ) . toBeEmptyDOMElement ( ) ;
3333 } ) ;
3434} ) ;
3535
@@ -52,8 +52,8 @@ describe('Custom cell renderer', () => {
5252 it ( 'should replace the default cell renderer' , async ( ) => {
5353 await setup ( { columns, rows } ) ;
5454 const [ cell1 , cell2 ] = getCells ( ) ;
55- expect ( cell1 ) . toHaveTextContent ( '#101' ) ;
56- expect ( cell2 ) . toHaveTextContent ( 'No name' ) ;
55+ await expect . element ( cell1 ) . toHaveTextContent ( '#101' ) ;
56+ await expect . element ( cell2 ) . toHaveTextContent ( 'No name' ) ;
5757 } ) ;
5858
5959 it ( 'can update rows' , async ( ) => {
@@ -93,9 +93,9 @@ describe('Custom cell renderer', () => {
9393 await page . render ( < Test /> ) ;
9494
9595 const [ cell ] = getCells ( ) ;
96- expect ( cell ) . toHaveTextContent ( 'value: 1' ) ;
96+ await expect . element ( cell ) . toHaveTextContent ( 'value: 1' ) ;
9797 await userEvent . click ( page . getByRole ( 'button' ) ) ;
98- expect ( cell ) . toHaveTextContent ( 'value: 2' ) ;
98+ await expect . element ( cell ) . toHaveTextContent ( 'value: 2' ) ;
9999 expect ( onChange ) . toHaveBeenCalledExactlyOnceWith ( [ { id : 2 } ] , {
100100 column : {
101101 ...column ,
@@ -140,29 +140,29 @@ test('Focus child if it sets tabIndex', async () => {
140140 const button1 = page . getByRole ( 'button' , { name : 'Button 1' } ) ;
141141 const button2 = page . getByRole ( 'button' , { name : 'Button 2' } ) ;
142142 const cell = page . getByRole ( 'gridcell' , { name : 'Button 1 Text Button 2' } ) ;
143- expect ( button1 ) . toHaveAttribute ( 'tabindex' , '-1' ) ;
144- expect ( cell ) . toHaveAttribute ( 'tabindex' , '-1' ) ;
143+ await expect . element ( button1 ) . toHaveAttribute ( 'tabindex' , '-1' ) ;
144+ await expect . element ( cell ) . toHaveAttribute ( 'tabindex' , '-1' ) ;
145145 await userEvent . click ( page . getByText ( 'Text' ) ) ;
146- expect ( button1 ) . toHaveFocus ( ) ;
147- expect ( button1 ) . toHaveAttribute ( 'tabindex' , '0' ) ;
146+ await expect . element ( button1 ) . toHaveFocus ( ) ;
147+ await expect . element ( button1 ) . toHaveAttribute ( 'tabindex' , '0' ) ;
148148 await userEvent . tab ( { shift : true } ) ;
149- expect ( button1 ) . not . toHaveFocus ( ) ;
150- expect ( button1 ) . toHaveAttribute ( 'tabindex' , '-1' ) ;
151- expect ( cell ) . toHaveAttribute ( 'tabindex' , '-1' ) ;
149+ await expect . element ( button1 ) . not . toHaveFocus ( ) ;
150+ await expect . element ( button1 ) . toHaveAttribute ( 'tabindex' , '-1' ) ;
151+ await expect . element ( cell ) . toHaveAttribute ( 'tabindex' , '-1' ) ;
152152 await userEvent . click ( button1 ) ;
153- expect ( button1 ) . toHaveFocus ( ) ;
154- expect ( button1 ) . toHaveAttribute ( 'tabindex' , '0' ) ;
155- expect ( cell ) . toHaveAttribute ( 'tabindex' , '-1' ) ;
153+ await expect . element ( button1 ) . toHaveFocus ( ) ;
154+ await expect . element ( button1 ) . toHaveAttribute ( 'tabindex' , '0' ) ;
155+ await expect . element ( cell ) . toHaveAttribute ( 'tabindex' , '-1' ) ;
156156 await userEvent . tab ( { shift : true } ) ;
157157 await userEvent . click ( button2 ) ;
158- expect ( button2 ) . toHaveFocus ( ) ;
158+ await expect . element ( button2 ) . toHaveFocus ( ) ;
159159 // It is user's responsibilty to set the tabIndex on button2
160- expect ( button1 ) . toHaveAttribute ( 'tabindex' , '0' ) ;
161- expect ( cell ) . toHaveAttribute ( 'tabindex' , '-1' ) ;
160+ await expect . element ( button1 ) . toHaveAttribute ( 'tabindex' , '0' ) ;
161+ await expect . element ( cell ) . toHaveAttribute ( 'tabindex' , '-1' ) ;
162162 await userEvent . click ( button1 ) ;
163- expect ( button1 ) . toHaveFocus ( ) ;
164- expect ( button1 ) . toHaveAttribute ( 'tabindex' , '0' ) ;
165- expect ( cell ) . toHaveAttribute ( 'tabindex' , '-1' ) ;
163+ await expect . element ( button1 ) . toHaveFocus ( ) ;
164+ await expect . element ( button1 ) . toHaveAttribute ( 'tabindex' , '0' ) ;
165+ await expect . element ( cell ) . toHaveAttribute ( 'tabindex' , '-1' ) ;
166166} ) ;
167167
168168test ( 'Cell should not steal focus when the focus is outside the grid and cell is recreated' , async ( ) => {
@@ -193,11 +193,11 @@ test('Cell should not steal focus when the focus is outside the grid and cell is
193193 await page . render ( < FormatterTest /> ) ;
194194
195195 await userEvent . click ( getCellsAtRowIndex ( 0 ) [ 0 ] ) ;
196- expect ( getCellsAtRowIndex ( 0 ) [ 0 ] ) . toHaveFocus ( ) ;
196+ await expect . element ( getCellsAtRowIndex ( 0 ) [ 0 ] ) . toHaveFocus ( ) ;
197197
198198 const button = page . getByRole ( 'button' , { name : 'Test' } ) . element ( ) ;
199- expect ( button ) . not . toHaveFocus ( ) ;
199+ await expect . element ( button ) . not . toHaveFocus ( ) ;
200200 await userEvent . click ( button ) ;
201- expect ( getCellsAtRowIndex ( 0 ) [ 0 ] ) . not . toHaveFocus ( ) ;
202- expect ( button ) . toHaveFocus ( ) ;
201+ await expect . element ( getCellsAtRowIndex ( 0 ) [ 0 ] ) . not . toHaveFocus ( ) ;
202+ await expect . element ( button ) . toHaveFocus ( ) ;
203203} ) ;
0 commit comments