chore: remove legacy SSR checks and consolidate migration maintenance

This commit is contained in:
maoyingjie
2026-10-26 10:32:22 +08:00
parent 52a0bef851
commit 60af6ee40b
169 changed files with 958 additions and 8422 deletions
@@ -0,0 +1,57 @@
import { describe, it, expect, afterEach, vi } from "vitest";
import { mount } from "@vue/test-utils";
import { defineComponent } from "vue";
import {
ColorFieldRoot,
ColorFieldInput,
ColorSliderRoot,
ColorSliderTrack,
ColorSliderThumb,
} from "../../../packages/vue/tests/fixtures/color-probe";
const wrappers: ReturnType<typeof mount>[] = [];
afterEach(() => {
wrappers.splice(0).forEach((w) => w.unmount());
vi.unstubAllGlobals();
});
describe("installed Reka color input audit, not public component acceptance", () => {
it("emits hex for a polar channel edit", async () => {
const w = mount(
defineComponent({
components: { ColorFieldRoot, ColorFieldInput },
template:
'<ColorFieldRoot default-value="hsb(270,0%,50%,.12345)" channel="hue" color-space="hsb"><ColorFieldInput/></ColorFieldRoot>',
}),
);
wrappers.push(w);
await w.get("input").setValue("271");
await w.get("input").trigger("blur");
expect(
w.getComponent(ColorFieldRoot).emitted("update:modelValue")?.[0]?.[0],
).toBe("#8080801f");
});
it("keeps optimistic slider state after a controlled parent rejection", async () => {
vi.stubGlobal(
"ResizeObserver",
class {
observe() {}
unobserve() {}
disconnect() {}
},
);
const w = mount(
defineComponent({
components: { ColorSliderRoot, ColorSliderTrack, ColorSliderThumb },
template:
'<ColorSliderRoot model-value="hsb(270,0%,50%)" channel="hue" color-space="hsb"><ColorSliderTrack><ColorSliderThumb/></ColorSliderTrack></ColorSliderRoot>',
}),
);
wrappers.push(w);
await w.get('[role="slider"]').trigger("keydown", { key: "ArrowRight" });
expect(
w.getComponent(ColorSliderRoot).emitted("update:modelValue")?.[0]?.[0],
).toMatch(/^#/);
expect(w.get('[role="slider"]').attributes("aria-valuenow")).not.toBe(
"270",
);
});
});
@@ -0,0 +1,66 @@
import { describe, it, expect, afterEach } from "vitest";
import { mount, flushPromises } from "@vue/test-utils";
import { defineComponent } from "vue";
import {
ColorAreaRoot,
ColorAreaArea,
ColorAreaThumb,
parseColor,
getChannelRange,
getChannelValue,
getAreaBackgroundStyle,
} from "../../../packages/vue/tests/fixtures/color-probe";
const wrappers: ReturnType<typeof mount>[] = [];
afterEach(() => {
wrappers.splice(0).forEach((w) => w.unmount());
});
function area() {
const w = mount(
defineComponent({
components: { ColorAreaRoot, ColorAreaArea, ColorAreaThumb },
template:
'<ColorAreaRoot model-value="hsb(240, 50%, 50%)" color-space="hsb" x-channel="saturation" y-channel="brightness"><ColorAreaArea><ColorAreaThumb/></ColorAreaArea></ColorAreaRoot>',
}),
);
wrappers.push(w);
return w;
}
describe("Reka 2.11 installed color capability audit (not public acceptance)", () => {
it("emits hex and leaves a rejected channel at its optimistic thumb position", async () => {
const w = area();
await w.get('[role="slider"]').trigger("keydown", { key: "ArrowRight" });
await flushPromises();
expect(
w.getComponent(ColorAreaRoot).emitted("update:modelValue")?.[0]?.[0],
).toMatch(/^#/);
expect(w.get('[role="slider"]').attributes("aria-valuenow")).toBe("51");
});
it("does not emit keyboard changeEnd after releasing an arrow", async () => {
const w = area();
await w.get('[role="slider"]').trigger("keydown", { key: "ArrowRight" });
await w.get('[role="slider"]').trigger("keyup", { key: "ArrowRight" });
expect(w.getComponent(ColorAreaRoot).emitted("changeEnd")).toBeUndefined();
});
it("uses percent alpha channel metadata while color storage uses a fraction", () => {
expect(getChannelRange("alpha").max).toBe(100);
expect(parseColor("#ff000080").alpha).toBeCloseTo(128 / 255);
});
it("loses achromatic HSB hue through the generic hue getter", () => {
expect(getChannelValue(parseColor("hsb(240, 0%, 50%)"), "hue")).toBe(0);
});
it("accepts functional trailing junk and out-of-range values without normalization", () => {
expect(parseColor("rgb(999, 0, 0) trailing")).toMatchObject({ r: 999 });
});
it("does not parse the four-digit alpha shorthand", () => {
expect(() => parseColor("#f008")).toThrow();
});
it("falls back to no hue layer when hue is the y axis", () => {
const style = getAreaBackgroundStyle(
parseColor("hsb(240, 50%, 50%)"),
"saturation",
"hue",
"hsb",
);
expect(style.backgroundImage).not.toContain("#ff0000, #ffff00");
});
});