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
+1 -35
View File
@@ -1,7 +1,6 @@
import { afterEach, describe, it, expect, vi } from "vitest";
import { mount, flushPromises } from "@vue/test-utils";
import { createSSRApp, defineComponent, shallowRef } from "vue";
import { renderToString } from "@vue/server-renderer";
import { defineComponent, shallowRef } from "vue";
import ColorField from "../packages/vue/src/components/color-field/ColorField.vue";
import ColorInputGroup from "../packages/vue/src/components/color-field/ColorInputGroup.vue";
import ColorInputGroupInput from "../packages/vue/src/components/color-field/ColorInputGroupInput.vue";
@@ -330,28 +329,6 @@ describe("color field composed protocol", () => {
w.get("[data-slot=color-input-group]").attributes("data-focus-within"),
).toBe("true");
});
it("hydrates prepared leaf ID and all real associations without replacing nodes", async () => {
const App = defineComponent({
components,
template: `<main>${field('default-value="#123456"', 'id="leaf"')}${field('channel="saturation" color-space="hsb" default-value="hsb(270,50%,50%)"', 'id="percent"')}</main>`,
});
const container = document.createElement("div");
container.innerHTML = await renderToString(createSSRApp(App));
document.body.append(container);
expect(container.querySelector("label")?.htmlFor).toBe("leaf");
const nodes = [...container.querySelectorAll("input")];
const warn = vi.spyOn(console, "warn").mockImplementation(() => {}),
error = vi.spyOn(console, "error").mockImplementation(() => {});
const app = createSSRApp(App);
app.mount(container);
await flushPromises();
expect([...container.querySelectorAll("input")]).toEqual(nodes);
const ids = [...container.querySelectorAll("[id]")].map((n) => n.id);
expect(new Set(ids).size).toBe(ids.length);
expect(warn).not.toHaveBeenCalled();
expect(error).not.toHaveBeenCalled();
app.unmount();
});
});
describe("color field ownership and native boundaries", () => {
it("switches channel/name mode with only one successful named input", async () => {
@@ -490,17 +467,6 @@ describe("color field draft validation and step grid", () => {
expect(data(empty)).toEqual(["0"]);
});
});
it("keeps Group scoped slot state reactive while planning the native label before SSR", async () => {
const w = view(
"<ColorField default-value=\"#123456\"><Label>Hover color</Label><ColorInputGroup v-slot=\"{isHovered}\"><ColorInputGroupInput :id=\"isHovered?'hover-input':'rest-input'\"/><Suffix>{{isHovered?'hover':'rest'}}</Suffix></ColorInputGroup></ColorField>",
);
expect(w.get("label").attributes("for")).toBe("rest-input");
expect(w.get("[data-slot=color-input-group-suffix]").text()).toBe("rest");
await w.get("[data-slot=color-input-group]").trigger("pointerenter");
expect(w.get("[data-slot=color-input-group-suffix]").text()).toBe("hover");
expect(input(w).attributes("id")).toBe("hover-input");
expect(w.get("label").attributes("for")).toBe("hover-input");
});
it("refreshes root ARIA and native listeners even when only fallthrough attrs change", async () => {
const invalid = shallowRef(false),
label = shallowRef("first label"),