Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit e54dd60

Browse files
committed
Update tests
Signed-off-by: Michael Telatynski <[email protected]>
1 parent 0a36af7 commit e54dd60

File tree

2 files changed

+26
-26
lines changed

2 files changed

+26
-26
lines changed

test/components/views/rooms/RoomHeader-test.tsx

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import React from "react";
1818
import userEvent from "@testing-library/user-event";
1919
import { CallType, MatrixCall } from "matrix-js-sdk/src/webrtc/call";
2020
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";
2222

2323
import { mkEvent, stubClient, withClientContextRenderOptions } from "../../../test-utils";
2424
import RoomHeader from "../../../../src/components/views/rooms/RoomHeader";
@@ -195,7 +195,7 @@ describe("RoomHeader", () => {
195195
withClientContextRenderOptions(MatrixClientPeg.get()!),
196196
);
197197

198-
await userEvent.click(getByTitle(container, "Threads"));
198+
await userEvent.click(getByLabelText(container, "Threads"));
199199
expect(setCardSpy).toHaveBeenCalledWith({ phase: RightPanelPhases.ThreadPanel });
200200
});
201201

@@ -205,7 +205,7 @@ describe("RoomHeader", () => {
205205
withClientContextRenderOptions(MatrixClientPeg.get()!),
206206
);
207207

208-
await userEvent.click(getByTitle(container, "Notifications"));
208+
await userEvent.click(getByLabelText(container, "Notifications"));
209209
expect(setCardSpy).toHaveBeenCalledWith({ phase: RightPanelPhases.NotificationPanel });
210210
});
211211

@@ -216,7 +216,7 @@ describe("RoomHeader", () => {
216216
<RoomHeader room={room} />,
217217
withClientContextRenderOptions(MatrixClientPeg.get()!),
218218
);
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")) {
220220
expect(button).toBeDisabled();
221221
}
222222
});
@@ -227,8 +227,8 @@ describe("RoomHeader", () => {
227227
<RoomHeader room={room} />,
228228
withClientContextRenderOptions(MatrixClientPeg.get()!),
229229
);
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");
232232
expect(voiceButton).not.toBeDisabled();
233233
expect(videoButton).not.toBeDisabled();
234234

@@ -251,7 +251,7 @@ describe("RoomHeader", () => {
251251
<RoomHeader room={room} />,
252252
withClientContextRenderOptions(MatrixClientPeg.get()!),
253253
);
254-
for (const button of getAllByTitle(container, "Ongoing call")) {
254+
for (const button of getAllByLabelText(container, "Ongoing call")) {
255255
expect(button).toBeDisabled();
256256
}
257257
});
@@ -264,8 +264,8 @@ describe("RoomHeader", () => {
264264
withClientContextRenderOptions(MatrixClientPeg.get()!),
265265
);
266266

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();
269269
});
270270

271271
it("disable calls in large rooms by default", () => {
@@ -275,8 +275,8 @@ describe("RoomHeader", () => {
275275
<RoomHeader room={room} />,
276276
withClientContextRenderOptions(MatrixClientPeg.get()!),
277277
);
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();
280280
});
281281
});
282282

@@ -297,12 +297,12 @@ describe("RoomHeader", () => {
297297

298298
expect(screen.queryByTitle("Voice call")).toBeNull();
299299

300-
const videoCallButton = getByTitle(container, "Video call");
300+
const videoCallButton = getByLabelText(container, "Video call");
301301
expect(videoCallButton).not.toBeDisabled();
302302

303303
const dispatcherSpy = jest.spyOn(dispatcher, "dispatch");
304304

305-
await userEvent.click(getByTitle(container, "Video call"));
305+
await userEvent.click(getByLabelText(container, "Video call"));
306306

307307
expect(dispatcherSpy).toHaveBeenCalledWith(expect.objectContaining({ view_call: true }));
308308
});
@@ -318,7 +318,7 @@ describe("RoomHeader", () => {
318318
<RoomHeader room={room} />,
319319
withClientContextRenderOptions(MatrixClientPeg.get()!),
320320
);
321-
expect(getByTitle(container, "Ongoing call")).toBeDisabled();
321+
expect(getByLabelText(container, "Ongoing call")).toBeDisabled();
322322
});
323323

324324
it("disables calling if there's a jitsi call", () => {
@@ -331,7 +331,7 @@ describe("RoomHeader", () => {
331331
<RoomHeader room={room} />,
332332
withClientContextRenderOptions(MatrixClientPeg.get()!),
333333
);
334-
for (const button of getAllByTitle(container, "Ongoing call")) {
334+
for (const button of getAllByLabelText(container, "Ongoing call")) {
335335
expect(button).toBeDisabled();
336336
}
337337
});
@@ -342,7 +342,7 @@ describe("RoomHeader", () => {
342342
<RoomHeader room={room} />,
343343
withClientContextRenderOptions(MatrixClientPeg.get()!),
344344
);
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")) {
346346
expect(button).toBeDisabled();
347347
}
348348
});
@@ -354,8 +354,8 @@ describe("RoomHeader", () => {
354354
withClientContextRenderOptions(MatrixClientPeg.get()!),
355355
);
356356

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");
359359
expect(voiceButton).not.toBeDisabled();
360360
expect(videoButton).not.toBeDisabled();
361361

@@ -380,8 +380,8 @@ describe("RoomHeader", () => {
380380
withClientContextRenderOptions(MatrixClientPeg.get()!),
381381
);
382382

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");
385385
expect(voiceButton).not.toBeDisabled();
386386
expect(videoButton).not.toBeDisabled();
387387

@@ -407,8 +407,8 @@ describe("RoomHeader", () => {
407407
withClientContextRenderOptions(MatrixClientPeg.get()!),
408408
);
409409

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");
412412
expect(voiceButton).not.toBeDisabled();
413413
expect(videoButton).not.toBeDisabled();
414414

test/components/views/rooms/__snapshots__/RoomHeader-test.tsx.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,36 +35,36 @@ exports[`RoomHeader does not show the face pile for DMs 1`] = `
3535
style="--mx-flex-display: flex; --mx-flex-direction: row; --mx-flex-align: center; --mx-flex-justify: start; --mx-flex-gap: var(--cpd-space-2x);"
3636
>
3737
<button
38+
aria-label="There's no one here to call"
3839
class="_icon-button_1k9cw_17"
3940
data-state="closed"
4041
disabled=""
4142
style="--cpd-icon-button-size: 32px;"
42-
title="There's no one here to call"
4343
>
4444
<div />
4545
</button>
4646
<button
47+
aria-label="There's no one here to call"
4748
class="_icon-button_1k9cw_17"
4849
data-state="closed"
4950
disabled=""
5051
style="--cpd-icon-button-size: 32px;"
51-
title="There's no one here to call"
5252
>
5353
<div />
5454
</button>
5555
<button
56+
aria-label="Threads"
5657
class="_icon-button_1k9cw_17"
5758
data-state="closed"
5859
style="--cpd-icon-button-size: 32px;"
59-
title="Threads"
6060
>
6161
<div />
6262
</button>
6363
<button
64+
aria-label="Notifications"
6465
class="_icon-button_1k9cw_17"
6566
data-state="closed"
6667
style="--cpd-icon-button-size: 32px;"
67-
title="Notifications"
6868
>
6969
<div />
7070
</button>

0 commit comments

Comments
 (0)