mirror of
https://github.com/vector-im/element-call.git
synced 2026-06-06 11:45:53 +00:00
review: remove unneeded early return
This commit is contained in:
@@ -114,6 +114,27 @@ describe("MediaMuteAndSwitchButton", () => {
|
||||
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 () => {
|
||||
const user = userEvent.setup();
|
||||
const requestDeviceNames = vi.fn();
|
||||
|
||||
@@ -89,7 +89,6 @@ export const MediaMuteAndSwitchButton: FC<MediaMuteAndSwitchButtonProps> = ({
|
||||
enabled={enabled ?? false}
|
||||
busy={isBusy}
|
||||
onClick={(e) => {
|
||||
if (isBusy) return;
|
||||
onMuteClick?.();
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
@@ -114,7 +113,6 @@ export const MediaMuteAndSwitchButton: FC<MediaMuteAndSwitchButtonProps> = ({
|
||||
enabled={enabled ?? false}
|
||||
busy={isBusy}
|
||||
onClick={(e) => {
|
||||
if (isBusy) return;
|
||||
onMuteClick?.();
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
Reference in New Issue
Block a user