From acc5a440c7d9255df6f528288cbe613fe783cb86 Mon Sep 17 00:00:00 2001 From: Valere Date: Fri, 5 Jun 2026 12:35:21 +0200 Subject: [PATCH] review: remove unneeded early return --- .../MediaMuteAndSwitchButton.test.tsx | 21 +++++++++++++++++++ src/components/MediaMuteAndSwitchButton.tsx | 2 -- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/components/MediaMuteAndSwitchButton.test.tsx b/src/components/MediaMuteAndSwitchButton.test.tsx index 2ec2c867..d9bcee1e 100644 --- a/src/components/MediaMuteAndSwitchButton.test.tsx +++ b/src/components/MediaMuteAndSwitchButton.test.tsx @@ -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( + , + ); + + 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(); diff --git a/src/components/MediaMuteAndSwitchButton.tsx b/src/components/MediaMuteAndSwitchButton.tsx index 57a2efb9..bd220330 100644 --- a/src/components/MediaMuteAndSwitchButton.tsx +++ b/src/components/MediaMuteAndSwitchButton.tsx @@ -89,7 +89,6 @@ export const MediaMuteAndSwitchButton: FC = ({ enabled={enabled ?? false} busy={isBusy} onClick={(e) => { - if (isBusy) return; onMuteClick?.(); e.preventDefault(); e.stopPropagation(); @@ -114,7 +113,6 @@ export const MediaMuteAndSwitchButton: FC = ({ enabled={enabled ?? false} busy={isBusy} onClick={(e) => { - if (isBusy) return; onMuteClick?.(); e.preventDefault(); e.stopPropagation();