Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: only show audio message when track ID matches active #5305

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
2 changes: 1 addition & 1 deletion frontend/src/components/VAudioTrack/VAudioTrack.vue
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ watch(
/* Timekeeping */

const message = computed(() =>
activeMediaStore.message
activeMediaStore.id === props.audio.id && activeMediaStore.message
? t(`audioTrack.messages.${activeMediaStore.message}`)
: ""
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,33 @@ describe("AudioTrack", () => {
expect(screen.queryAllByTitle(match)).toEqual([])
expect(screen.queryAllByAltText(match)).toEqual([])
})

it("should show message when audio ID matches active ID", async () => {
const activeMediaStore = useActiveMediaStore()
const audioId = props.audio.id
activeMediaStore.$patch({
state: {
id: audioId,
message: "playing",
type: "audio"
}
})

const { getByText } = await render(VAudioTrack, options)
expect(getByText(/playing/i)).toBeVisible()
})

it("should not show message when audio ID doesn't match active ID", async () => {
const activeMediaStore = useActiveMediaStore()
activeMediaStore.$patch({
state: {
id: "different-id",
message: "playing",
type: "audio"
}
})

const { queryByText } = await render(VAudioTrack, options)
expect(queryByText(/playing/i)).not.toBeInTheDocument()
})
})
Loading