@@ -18,7 +18,7 @@ import React from "react";
18
18
import userEvent from "@testing-library/user-event" ;
19
19
import { CallType , MatrixCall } from "matrix-js-sdk/src/webrtc/call" ;
20
20
import { EventType , JoinRule , MatrixClient , MatrixEvent , PendingEventOrdering , Room } from "matrix-js-sdk/src/matrix" ;
21
- import { getAllByTitle , getByLabelText , getByText , getByTitle , render , screen , waitFor } from "@testing-library/react" ;
21
+ import { getAllByLabelText , getByLabelText , getByText , render , screen , waitFor } from "@testing-library/react" ;
22
22
23
23
import { mkEvent , stubClient , withClientContextRenderOptions } from "../../../test-utils" ;
24
24
import RoomHeader from "../../../../src/components/views/rooms/RoomHeader" ;
@@ -195,7 +195,7 @@ describe("RoomHeader", () => {
195
195
withClientContextRenderOptions ( MatrixClientPeg . get ( ) ! ) ,
196
196
) ;
197
197
198
- await userEvent . click ( getByTitle ( container , "Threads" ) ) ;
198
+ await userEvent . click ( getByLabelText ( container , "Threads" ) ) ;
199
199
expect ( setCardSpy ) . toHaveBeenCalledWith ( { phase : RightPanelPhases . ThreadPanel } ) ;
200
200
} ) ;
201
201
@@ -205,7 +205,7 @@ describe("RoomHeader", () => {
205
205
withClientContextRenderOptions ( MatrixClientPeg . get ( ) ! ) ,
206
206
) ;
207
207
208
- await userEvent . click ( getByTitle ( container , "Notifications" ) ) ;
208
+ await userEvent . click ( getByLabelText ( container , "Notifications" ) ) ;
209
209
expect ( setCardSpy ) . toHaveBeenCalledWith ( { phase : RightPanelPhases . NotificationPanel } ) ;
210
210
} ) ;
211
211
@@ -216,7 +216,7 @@ describe("RoomHeader", () => {
216
216
< RoomHeader room = { room } /> ,
217
217
withClientContextRenderOptions ( MatrixClientPeg . get ( ) ! ) ,
218
218
) ;
219
- for ( const button of getAllByTitle ( container , "There's no one here to call" ) ) {
219
+ for ( const button of getAllByLabelText ( container , "There's no one here to call" ) ) {
220
220
expect ( button ) . toBeDisabled ( ) ;
221
221
}
222
222
} ) ;
@@ -227,8 +227,8 @@ describe("RoomHeader", () => {
227
227
< RoomHeader room = { room } /> ,
228
228
withClientContextRenderOptions ( MatrixClientPeg . get ( ) ! ) ,
229
229
) ;
230
- const voiceButton = getByTitle ( container , "Voice call" ) ;
231
- const videoButton = getByTitle ( container , "Video call" ) ;
230
+ const voiceButton = getByLabelText ( container , "Voice call" ) ;
231
+ const videoButton = getByLabelText ( container , "Video call" ) ;
232
232
expect ( voiceButton ) . not . toBeDisabled ( ) ;
233
233
expect ( videoButton ) . not . toBeDisabled ( ) ;
234
234
@@ -251,7 +251,7 @@ describe("RoomHeader", () => {
251
251
< RoomHeader room = { room } /> ,
252
252
withClientContextRenderOptions ( MatrixClientPeg . get ( ) ! ) ,
253
253
) ;
254
- for ( const button of getAllByTitle ( container , "Ongoing call" ) ) {
254
+ for ( const button of getAllByLabelText ( container , "Ongoing call" ) ) {
255
255
expect ( button ) . toBeDisabled ( ) ;
256
256
}
257
257
} ) ;
@@ -264,8 +264,8 @@ describe("RoomHeader", () => {
264
264
withClientContextRenderOptions ( MatrixClientPeg . get ( ) ! ) ,
265
265
) ;
266
266
267
- expect ( getByTitle ( container , "Voice call" ) ) . not . toBeDisabled ( ) ;
268
- expect ( getByTitle ( container , "Video call" ) ) . not . toBeDisabled ( ) ;
267
+ expect ( getByLabelText ( container , "Voice call" ) ) . not . toBeDisabled ( ) ;
268
+ expect ( getByLabelText ( container , "Video call" ) ) . not . toBeDisabled ( ) ;
269
269
} ) ;
270
270
271
271
it ( "disable calls in large rooms by default" , ( ) => {
@@ -275,8 +275,8 @@ describe("RoomHeader", () => {
275
275
< RoomHeader room = { room } /> ,
276
276
withClientContextRenderOptions ( MatrixClientPeg . get ( ) ! ) ,
277
277
) ;
278
- expect ( getByTitle ( container , "You do not have permission to start voice calls" ) ) . toBeDisabled ( ) ;
279
- expect ( getByTitle ( container , "You do not have permission to start video calls" ) ) . toBeDisabled ( ) ;
278
+ expect ( getByLabelText ( container , "You do not have permission to start voice calls" ) ) . toBeDisabled ( ) ;
279
+ expect ( getByLabelText ( container , "You do not have permission to start video calls" ) ) . toBeDisabled ( ) ;
280
280
} ) ;
281
281
} ) ;
282
282
@@ -297,12 +297,12 @@ describe("RoomHeader", () => {
297
297
298
298
expect ( screen . queryByTitle ( "Voice call" ) ) . toBeNull ( ) ;
299
299
300
- const videoCallButton = getByTitle ( container , "Video call" ) ;
300
+ const videoCallButton = getByLabelText ( container , "Video call" ) ;
301
301
expect ( videoCallButton ) . not . toBeDisabled ( ) ;
302
302
303
303
const dispatcherSpy = jest . spyOn ( dispatcher , "dispatch" ) ;
304
304
305
- await userEvent . click ( getByTitle ( container , "Video call" ) ) ;
305
+ await userEvent . click ( getByLabelText ( container , "Video call" ) ) ;
306
306
307
307
expect ( dispatcherSpy ) . toHaveBeenCalledWith ( expect . objectContaining ( { view_call : true } ) ) ;
308
308
} ) ;
@@ -318,7 +318,7 @@ describe("RoomHeader", () => {
318
318
< RoomHeader room = { room } /> ,
319
319
withClientContextRenderOptions ( MatrixClientPeg . get ( ) ! ) ,
320
320
) ;
321
- expect ( getByTitle ( container , "Ongoing call" ) ) . toBeDisabled ( ) ;
321
+ expect ( getByLabelText ( container , "Ongoing call" ) ) . toBeDisabled ( ) ;
322
322
} ) ;
323
323
324
324
it ( "disables calling if there's a jitsi call" , ( ) => {
@@ -331,7 +331,7 @@ describe("RoomHeader", () => {
331
331
< RoomHeader room = { room } /> ,
332
332
withClientContextRenderOptions ( MatrixClientPeg . get ( ) ! ) ,
333
333
) ;
334
- for ( const button of getAllByTitle ( container , "Ongoing call" ) ) {
334
+ for ( const button of getAllByLabelText ( container , "Ongoing call" ) ) {
335
335
expect ( button ) . toBeDisabled ( ) ;
336
336
}
337
337
} ) ;
@@ -342,7 +342,7 @@ describe("RoomHeader", () => {
342
342
< RoomHeader room = { room } /> ,
343
343
withClientContextRenderOptions ( MatrixClientPeg . get ( ) ! ) ,
344
344
) ;
345
- for ( const button of getAllByTitle ( container , "There's no one here to call" ) ) {
345
+ for ( const button of getAllByLabelText ( container , "There's no one here to call" ) ) {
346
346
expect ( button ) . toBeDisabled ( ) ;
347
347
}
348
348
} ) ;
@@ -354,8 +354,8 @@ describe("RoomHeader", () => {
354
354
withClientContextRenderOptions ( MatrixClientPeg . get ( ) ! ) ,
355
355
) ;
356
356
357
- const voiceButton = getByTitle ( container , "Voice call" ) ;
358
- const videoButton = getByTitle ( container , "Video call" ) ;
357
+ const voiceButton = getByLabelText ( container , "Voice call" ) ;
358
+ const videoButton = getByLabelText ( container , "Video call" ) ;
359
359
expect ( voiceButton ) . not . toBeDisabled ( ) ;
360
360
expect ( videoButton ) . not . toBeDisabled ( ) ;
361
361
@@ -380,8 +380,8 @@ describe("RoomHeader", () => {
380
380
withClientContextRenderOptions ( MatrixClientPeg . get ( ) ! ) ,
381
381
) ;
382
382
383
- const voiceButton = getByTitle ( container , "Voice call" ) ;
384
- const videoButton = getByTitle ( container , "Video call" ) ;
383
+ const voiceButton = getByLabelText ( container , "Voice call" ) ;
384
+ const videoButton = getByLabelText ( container , "Video call" ) ;
385
385
expect ( voiceButton ) . not . toBeDisabled ( ) ;
386
386
expect ( videoButton ) . not . toBeDisabled ( ) ;
387
387
@@ -407,8 +407,8 @@ describe("RoomHeader", () => {
407
407
withClientContextRenderOptions ( MatrixClientPeg . get ( ) ! ) ,
408
408
) ;
409
409
410
- const voiceButton = getByTitle ( container , "Voice call" ) ;
411
- const videoButton = getByTitle ( container , "Video call" ) ;
410
+ const voiceButton = getByLabelText ( container , "Voice call" ) ;
411
+ const videoButton = getByLabelText ( container , "Video call" ) ;
412
412
expect ( voiceButton ) . not . toBeDisabled ( ) ;
413
413
expect ( videoButton ) . not . toBeDisabled ( ) ;
414
414
0 commit comments