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
-51
View File
@@ -3,7 +3,6 @@ import { mount } from "@vue/test-utils";
import { defineComponent, h, nextTick, ref } from "vue";
import { readFileSync } from "node:fs";
import {
Description,
FieldError,
Form,
InputGroup,
@@ -14,8 +13,6 @@ import {
Label,
TextField,
} from "../packages/vue/src";
import { createSSRApp } from "vue";
import { renderToString } from "@vue/server-renderer";
import InputGroupDefaultDemo from "../apps/docs/demos/input-group-default.vue";
import InputGroupPasswordDemo from "../apps/docs/demos/input-group-password-with-toggle.vue";
import InputGroupCopyDemo from "../apps/docs/demos/input-group-with-copy-suffix.vue";
@@ -508,52 +505,4 @@ describe("InputGroup independent integration regression", () => {
expect(submit).toHaveBeenCalledOnce();
w.unmount();
});
it("hydrates explicit IDs and keeps dynamic slots, labels and descriptions current", async () => {
const id = ref("group-a");
const show = ref(true);
const view = defineComponent({
render: () =>
h(TextField, {}, () => [
h(Label, {}, () => "Email"),
h(InputGroup, {}, () => [
show.value ? h(InputGroupPrefix, {}, () => "@") : null,
h(InputGroupInput, { id: id.value }),
]),
h(Description, {}, () => "Hint"),
]),
});
const host = document.createElement("div");
host.innerHTML = await renderToString(createSSRApp(view));
document.body.append(host);
const errors = vi.spyOn(console, "error");
const warnings = vi.spyOn(console, "warn");
const app = createSSRApp(view);
try {
app.mount(host);
await settle();
expect(host.querySelector("label")?.htmlFor).toBe("group-a");
id.value = "group-b";
show.value = false;
await settle();
expect(host.querySelector("label")?.htmlFor).toBe("group-b");
expect(host.querySelector("input")?.id).toBe("group-b");
expect(host.querySelector("[data-slot=input-group-prefix]")).toBeNull();
const refs =
host
.querySelector("input")
?.getAttribute("aria-describedby")
?.split(" ") ?? [];
expect(refs.length).toBeGreaterThan(0);
for (const ref of refs)
expect(document.getElementById(ref)).not.toBeNull();
expect(errors).not.toHaveBeenCalled();
expect(warnings).not.toHaveBeenCalled();
} finally {
app.unmount();
host.remove();
errors.mockRestore();
warnings.mockRestore();
}
});
});