mirror of
https://github.com/vector-im/element-call.git
synced 2026-07-24 19:19:21 +00:00
review: remove unneeded early return
This commit is contained in:
@@ -114,6 +114,27 @@ describe("MediaMuteAndSwitchButton", () => {
|
|||||||
expect(onMute).not.toHaveBeenCalled();
|
expect(onMute).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("disables video button while busy", async () => {
|
||||||
|
const user = userEvent.setup();
|
||||||
|
const onMute = vi.fn();
|
||||||
|
const { getByRole } = renderComponent(
|
||||||
|
<MediaMuteAndSwitchButton
|
||||||
|
title={"Switcher"}
|
||||||
|
onMuteClick={onMute}
|
||||||
|
iconsAndLabels="video"
|
||||||
|
enabled={true}
|
||||||
|
busy={true}
|
||||||
|
/>,
|
||||||
|
);
|
||||||
|
|
||||||
|
const videoButton = getByRole("switch", { name: "Stop video" });
|
||||||
|
expect(videoButton).toHaveAttribute("aria-disabled", "true");
|
||||||
|
expect(videoButton).toHaveAttribute("aria-busy", "true");
|
||||||
|
|
||||||
|
await user.click(videoButton);
|
||||||
|
expect(onMute).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
test("requests device names when opened", async () => {
|
test("requests device names when opened", async () => {
|
||||||
const user = userEvent.setup();
|
const user = userEvent.setup();
|
||||||
const requestDeviceNames = vi.fn();
|
const requestDeviceNames = vi.fn();
|
||||||
|
|||||||
@@ -89,7 +89,6 @@ export const MediaMuteAndSwitchButton: FC<MediaMuteAndSwitchButtonProps> = ({
|
|||||||
enabled={enabled ?? false}
|
enabled={enabled ?? false}
|
||||||
busy={isBusy}
|
busy={isBusy}
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
if (isBusy) return;
|
|
||||||
onMuteClick?.();
|
onMuteClick?.();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
@@ -114,7 +113,6 @@ export const MediaMuteAndSwitchButton: FC<MediaMuteAndSwitchButtonProps> = ({
|
|||||||
enabled={enabled ?? false}
|
enabled={enabled ?? false}
|
||||||
busy={isBusy}
|
busy={isBusy}
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
if (isBusy) return;
|
|
||||||
onMuteClick?.();
|
onMuteClick?.();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|||||||
Reference in New Issue
Block a user