fix tests

This commit is contained in:
Timo K
2026-04-09 17:12:21 +02:00
parent 9528c4f837
commit 6be06de153
4 changed files with 32 additions and 6 deletions

View File

@@ -93,7 +93,7 @@ export const InCallFooter: FC<InCallFooterProps> = ({
key="audio"
enabled={audioEnabled}
onClick={toggleAudio ?? undefined}
disabled={toggleAudio === null}
disabled={toggleAudio === undefined}
data-testid="incall_mute"
/>,
<VideoButton
@@ -101,7 +101,7 @@ export const InCallFooter: FC<InCallFooterProps> = ({
key="video"
enabled={videoEnabled}
onClick={toggleVideo ?? undefined}
disabled={toggleVideo === null}
disabled={toggleVideo === undefined}
data-testid="incall_videomute"
/>,
);
@@ -137,6 +137,7 @@ export const InCallFooter: FC<InCallFooterProps> = ({
return (
<LoudspeakerButton
size={buttonSize}
onClick={() => audioOutputSwitcher.switch()}
isEarpieceTarget={audioOutputSwitcher.targetOutput === "earpiece"}
/>
);

View File

@@ -197,7 +197,7 @@ describe("InCallView", () => {
const { getByRole } = createInCallView({ mediaDevices });
// The button should be visible. When current output is "speaker",
// the switcher targets "earpiece", so the tooltip label is "Handset".
const audioOutputBtn = getByRole("button", { name: "Handset" });
const audioOutputBtn = getByRole("switch", { name: "Handset" });
expect(audioOutputBtn).toBeVisible();
await user.click(audioOutputBtn);

View File

@@ -565,12 +565,14 @@ export const InCallView: FC<InCallViewProps> = ({
<SettingsButton key="settings" onClick={openSettings} />,
);
const footerNotNeeded =
showControls === false && headerStyle === HeaderStyle.None;
const footer = (
<InCallFooter
ref={footerRef}
asOverlay={windowMode === "flat"}
// TODO this should be computed in the view model!
showFooter={!showFooter || (!showControls && headerStyle === "none")}
showFooter={showFooter && !footerNotNeeded}
showControls={showControls}
showLogo={headerStyle !== HeaderStyle.None}
showSettingsButton={headerStyle !== HeaderStyle.AppBar}

View File

@@ -345,7 +345,30 @@ exports[`InCallView > rendering > renders 1`] = `
</svg>
</button>
<button
aria-checked="false"
aria-labelledby="_r_n_"
class="_button_13vu4_8 shareScreen _has-icon_13vu4_60 _icon-only_13vu4_53"
data-kind="secondary"
data-size="lg"
data-testid="incall_screenshare"
role="switch"
tabindex="0"
>
<svg
aria-hidden="true"
fill="currentColor"
height="24"
viewBox="0 0 24 24"
width="24"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M1.288 20.713Q1.575 21 2 21h20q.424 0 .712-.288A.97.97 0 0 0 23 20a.97.97 0 0 0-.288-.712A.97.97 0 0 0 22 19H2a.97.97 0 0 0-.712.288A.97.97 0 0 0 1 20q0 .424.288.712m1.3-3.299A1.93 1.93 0 0 1 2 16V5q0-.824.587-1.412A1.93 1.93 0 0 1 4 3h16q.824 0 1.413.587Q22 4.176 22 5v11q0 .824-.587 1.413A1.93 1.93 0 0 1 20 18H4q-.824 0-1.412-.587m10.12-10.12a1 1 0 0 0-1.415 0l-2.5 2.5a1 1 0 0 0 1.414 1.414l.793-.793V13a1 1 0 1 0 2 0v-2.586l.793.793a1 1 0 0 0 1.414-1.414z"
/>
</svg>
</button>
<button
aria-labelledby="_r_s_"
class="_button_13vu4_8 endCall _has-icon_13vu4_60 _icon-only_13vu4_53 _destructive_13vu4_110"
data-kind="primary"
data-size="lg"
@@ -371,7 +394,7 @@ exports[`InCallView > rendering > renders 1`] = `
class="toggle layout"
>
<input
aria-labelledby="_r_s_"
aria-labelledby="_r_11_"
name="layout"
type="radio"
value="spotlight"
@@ -389,7 +412,7 @@ exports[`InCallView > rendering > renders 1`] = `
/>
</svg>
<input
aria-labelledby="_r_11_"
aria-labelledby="_r_16_"
checked=""
name="layout"
type="radio"