fix: disable the quality choice while visuals are unavailable
This commit is contained in:
@@ -94,6 +94,14 @@ const statusText = computed(() => {
|
|||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/** The scene was lost or never started: the quality choice has nothing to
|
||||||
|
* act on, so it reads Static and is disabled rather than claiming High. */
|
||||||
|
const visualsUnavailable = computed(
|
||||||
|
() =>
|
||||||
|
props.policy.reason === "full" &&
|
||||||
|
(props.sceneStatus === "failed" || props.sceneStatus === "static"),
|
||||||
|
);
|
||||||
|
|
||||||
const runAction = (): void => {
|
const runAction = (): void => {
|
||||||
const event = action.value?.event;
|
const event = action.value?.event;
|
||||||
if (event === "pause") emit("pause");
|
if (event === "pause") emit("pause");
|
||||||
@@ -334,7 +342,8 @@ onBeforeUnmount(() => {
|
|||||||
<label for="drive-quality">QUALITY</label>
|
<label for="drive-quality">QUALITY</label>
|
||||||
<select
|
<select
|
||||||
id="drive-quality"
|
id="drive-quality"
|
||||||
:value="maximumQuality"
|
:value="visualsUnavailable ? 'static' : maximumQuality"
|
||||||
|
:disabled="visualsUnavailable"
|
||||||
aria-label="Quality control"
|
aria-label="Quality control"
|
||||||
@change="changeQuality"
|
@change="changeQuality"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -374,6 +374,22 @@ describe("DriveControls", () => {
|
|||||||
expect(wrapper.find('[role="dialog"]').exists()).toBe(false);
|
expect(wrapper.find('[role="dialog"]').exists()).toBe(false);
|
||||||
expect(wrapper.get('[role="status"]').text()).toBe("Visuals unavailable");
|
expect(wrapper.get('[role="status"]').text()).toBe("Visuals unavailable");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("disables the quality choice and reads Static while visuals are unavailable", async () => {
|
||||||
|
const wrapper = mount(DriveControls, {
|
||||||
|
props: {
|
||||||
|
policy: policy(),
|
||||||
|
maximumQuality: "high",
|
||||||
|
sceneStatus: "failed",
|
||||||
|
audioState: { kind: "idle" },
|
||||||
|
},
|
||||||
|
});
|
||||||
|
await wrapper.get('[aria-label="Drive settings"]').trigger("click");
|
||||||
|
const select = wrapper.get<HTMLSelectElement>('[aria-label="Quality control"]');
|
||||||
|
expect(select.element.disabled).toBe(true);
|
||||||
|
expect(select.element.value).toBe("static");
|
||||||
|
wrapper.unmount();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("JourneyHud", () => {
|
describe("JourneyHud", () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user