@@ -15,7 +15,7 @@ limitations under the License.
15
15
*/
16
16
17
17
import React from "react" ;
18
- import { fireEvent , render , screen , waitFor , cleanup , act , within } from "@testing-library/react" ;
18
+ import { fireEvent , render , screen , waitFor , cleanup , act } from "@testing-library/react" ;
19
19
import userEvent from "@testing-library/user-event" ;
20
20
import { Mocked , mocked } from "jest-mock" ;
21
21
import {
@@ -288,7 +288,8 @@ describe("<UserInfo />", () => {
288
288
289
289
it ( "renders close button correctly when encryption panel with a pending verification request" , ( ) => {
290
290
renderComponent ( { phase : RightPanelPhases . EncryptionPanel , verificationRequest } ) ;
291
- expect ( screen . getByTestId ( "base-card-close-button" ) ) . toHaveAttribute ( "title" , "Cancel" ) ;
291
+ screen . getByTestId ( "base-card-close-button" ) . focus ( ) ;
292
+ expect ( screen . getByRole ( "tooltip" ) ) . toHaveTextContent ( "Cancel" ) ;
292
293
} ) ;
293
294
} ) ;
294
295
@@ -355,11 +356,8 @@ describe("<UserInfo />", () => {
355
356
// click it
356
357
await userEvent . click ( devicesButton ) ;
357
358
358
- // there should now be a button with the device id ...
359
- const deviceButton = screen . getByRole ( "button" , { description : "d1" } ) ;
360
-
361
- // ... which should contain the device name
362
- expect ( within ( deviceButton ) . getByText ( "my device" ) ) . toBeInTheDocument ( ) ;
359
+ // there should now be a button with the device id which should contain the device name
360
+ expect ( screen . getByRole ( "button" , { name : "my device" } ) ) . toBeInTheDocument ( ) ;
363
361
} ) ;
364
362
365
363
it ( "renders <BasicUserInfo />" , async ( ) => {
@@ -460,7 +458,11 @@ describe("<DeviceItem />", () => {
460
458
461
459
const renderComponent = ( props = { } ) => {
462
460
const Wrapper = ( wrapperProps = { } ) => {
463
- return < MatrixClientContext . Provider value = { mockClient } { ...wrapperProps } /> ;
461
+ return (
462
+ < TooltipProvider >
463
+ < MatrixClientContext . Provider value = { mockClient } { ...wrapperProps } />
464
+ </ TooltipProvider >
465
+ ) ;
464
466
} ;
465
467
466
468
return render ( < DeviceItem { ...defaultProps } { ...props } /> , {
0 commit comments