Skip to content

Commit

Permalink
Iterate
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
  • Loading branch information
t3chguy committed Oct 17, 2024
1 parent 457e7d5 commit 21022e3
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ exports[`LogoutDialog Prompts user to connect backup if there is a backup on the
</details>
</div>
<div
aria-describedby=":r2:"
aria-label="Close dialog"
class="mx_AccessibleButton mx_Dialog_cancelButton"
role="button"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
mockClientMethodsUser,
setupRoomWithPollEvents,
} from "../../../../test-utils";
import { waitForElementToBeRemoved } from "@testing-library/dom";

Check failure on line 28 in test/unit-tests/components/views/messages/MPollEndBody-test.tsx

View workflow job for this annotation

GitHub Actions / ESLint

`@testing-library/dom` import should occur before import of `../../../../../src/components/views/messages/IBodyProps`

describe("<MPollEndBody />", () => {
const userId = "@alice:domain.org";
Expand Down Expand Up @@ -127,6 +128,7 @@ describe("<MPollEndBody />", () => {
expect(container).toMatchSnapshot();

await waitFor(() => expect(getByRole("progressbar")).toBeInTheDocument());
await waitForElementToBeRemoved(() => getByRole("progressbar"));

expect(mockClient.fetchRoomEvent).toHaveBeenCalledWith(roomId, pollStartEvent.getId());

Expand Down
9 changes: 4 additions & 5 deletions test/unit-tests/components/views/rooms/MemberList-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -398,13 +398,12 @@ describe("MemberList", () => {
jest.spyOn(room, "canInvite").mockReturnValue(false);

renderComponent();
await flushPromises();
await act(flushPromises);

// button rendered but disabled
expect(screen.getByRole("button", { name: "Invite to this room" })).toHaveAttribute(
"aria-disabled",
"true",
);
const button = document.querySelector(".mx_MemberList_invite");
expect(button).toHaveTextContent("Invite to this room");
expect(button).toHaveAttribute("aria-disabled", "true");
});

it("renders enabled invite button when current user is a member and has rights to invite", async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -926,10 +926,10 @@ describe("<SessionManagerTab />", () => {
devices: [alicesDevice, alicesMobileDevice, alicesOlderMobileDevice],
});

const { getByTestId, findByTestId } = render(getComponent());
const { getByTestId, findByTestId } = render(getComponent(), { legacyRoot: true });

await waitForElementToBeRemoved(() => screen.queryAllByRole("progressbar"));
await toggleDeviceDetails(getByTestId, alicesMobileDevice.device_id);
toggleDeviceDetails(getByTestId, alicesMobileDevice.device_id);

const signOutButton = await within(
await findByTestId(`device-detail-${alicesMobileDevice.device_id}`),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,16 @@ describe("<VoiceUserSettingsTab />", () => {
describe("devices", () => {
it("renders dropdowns for input devices", async () => {
render(getComponent());
await flushPromises();

expect(screen.getByLabelText("Microphone")).toHaveDisplayValue(audioIn1.label);
expect(screen.getByLabelText("Camera")).toHaveDisplayValue(videoIn1.label);
await expect(screen.findByLabelText("Microphone")).resolves.toHaveDisplayValue(audioIn1.label);
await expect(screen.findByLabelText("Camera")).resolves.toHaveDisplayValue(videoIn1.label);
});

it("updates device", async () => {
render(getComponent());
await flushPromises();

fireEvent.change(screen.getByLabelText("Camera"), { target: { value: videoIn2.deviceId } });
fireEvent.change(await screen.findByLabelText("Camera"), { target: { value: videoIn2.deviceId } });

expect(MediaDeviceHandlerMock.instance.setDevice).toHaveBeenCalledWith(
videoIn2.deviceId,
Expand Down

0 comments on commit 21022e3

Please sign in to comment.