mirror of
https://github.com/element-hq/element-call.git
synced 2026-10-15 19:50:43 +00:00
* Give the microphone level its own observable * Add a microphone level meter * Show speakers and microphones in the quick audio menu * Wire speaker selection through the call footer * Add stories for the meter and the device menu * Add end-to-end specs for the quick audio menu * Keep the footer while a menu opened from it is open * Use the shared audio capture stub in the lobby test --------- Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
43 lines
1.5 KiB
TypeScript
43 lines
1.5 KiB
TypeScript
/*
|
|
Copyright 2026 Element Creations Ltd.
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
|
Please see LICENSE in the repository root for full details.
|
|
*/
|
|
|
|
import { describe, expect, test } from "vitest";
|
|
import { render, screen } from "@testing-library/react";
|
|
|
|
import { MicrophoneLevelMeter } from "./MicrophoneLevelMeter";
|
|
import { LEVEL_SCALE } from "../state/MicrophoneLevel";
|
|
import { constant } from "../state/Behavior";
|
|
|
|
describe("MicrophoneLevelMeter", () => {
|
|
test("announces the level rather than relying on hue", () => {
|
|
render(
|
|
<MicrophoneLevelMeter state={{ type: "level", level$: constant(6) }} />,
|
|
);
|
|
|
|
const meter = screen.getByRole("meter", { name: "Microphone level" });
|
|
expect(meter).toHaveAttribute("aria-valuenow", "6");
|
|
expect(meter).toHaveAttribute("aria-valuemax", String(LEVEL_SCALE));
|
|
expect(meter).toHaveAttribute("aria-valuetext", `6 of ${LEVEL_SCALE}`);
|
|
});
|
|
|
|
test("shows distinct messages for denied permission and no input device", () => {
|
|
const denied = render(
|
|
<MicrophoneLevelMeter state={{ type: "permission-denied" }} />,
|
|
);
|
|
expect(
|
|
denied.getByText(/Microphone access is blocked/),
|
|
).toBeInTheDocument();
|
|
expect(denied.queryByRole("meter")).toBeNull();
|
|
|
|
const missing = render(
|
|
<MicrophoneLevelMeter state={{ type: "no-device" }} />,
|
|
);
|
|
expect(missing.getByText(/No microphone found/)).toBeInTheDocument();
|
|
expect(missing.queryByRole("meter")).toBeNull();
|
|
});
|
|
});
|