feat(ai-character): 공통 오디오 플레이어 UI 개선
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { fireEvent, render, screen } from "@testing-library/react";
|
||||
import { fireEvent, render, screen, within } from "@testing-library/react";
|
||||
import { afterEach, beforeEach, expect, test, vi } from "vitest";
|
||||
|
||||
import { AdminAudioPlayer } from "@/shared/ui/admin-audio-player";
|
||||
@@ -33,6 +33,30 @@ test("AdminAudioPlayer wraps native audio with controls and no download or autop
|
||||
expect(screen.getByRole("combobox", { name: "재생 속도" })).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test("AdminAudioPlayer matches the compact reference control anatomy", () => {
|
||||
render(<AdminAudioPlayer playerId="one" src="https://cdn.example.com/signed/audio.m4a?token=secret" title="샘플 오디오" />);
|
||||
|
||||
const player = screen.getByRole("group", { name: "샘플 오디오 오디오 플레이어" });
|
||||
const controls = within(player).getByRole("group", { name: "재생 제어" });
|
||||
expect(within(controls).getByRole("button", { name: "재생" })).toBeInTheDocument();
|
||||
const seek = within(controls).getByRole("slider", { name: "재생 위치" });
|
||||
const speed = within(controls).getByRole("combobox", { name: "재생 속도" });
|
||||
const volume = within(controls).getByRole("slider", { name: "볼륨" });
|
||||
expect.soft(player).toHaveClass("px-1", "sm:px-3");
|
||||
expect(seek).toHaveClass("min-w-11");
|
||||
expect.soft(speed).toHaveClass("w-11");
|
||||
expect(speed).toHaveClass("text-base");
|
||||
expect.soft(volume).toHaveClass("basis-11");
|
||||
expect(volume).toHaveClass("min-w-11");
|
||||
expect(volume).toBeInTheDocument();
|
||||
expect(volume.className).not.toContain("hidden");
|
||||
expect.soft(within(controls).queryByText("0:00/0:00")).toBeInTheDocument();
|
||||
expect(within(player).queryByText("볼륨")).not.toBeInTheDocument();
|
||||
expect(within(player).queryByText("재생 속도")).not.toBeInTheDocument();
|
||||
expect(player.querySelector("img")).not.toBeInTheDocument();
|
||||
expect(player.querySelector("video")).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
test("AudioPlaybackProvider keeps only one player active by player id", () => {
|
||||
render(
|
||||
<AudioPlaybackProvider>
|
||||
|
||||
Reference in New Issue
Block a user