chore: remove legacy SSR checks and consolidate migration maintenance
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
import { mount } from "@vue/test-utils";
|
||||
import { createSSRApp, defineComponent, h, nextTick, ref } from "vue";
|
||||
import { renderToString } from "@vue/server-renderer";
|
||||
import { defineComponent, h, nextTick, ref } from "vue";
|
||||
import {
|
||||
Button,
|
||||
CloseButton,
|
||||
@@ -341,30 +340,6 @@ describe("SearchField shared text state", () => {
|
||||
expect((w.get("input").element as HTMLInputElement).value).toBe("keep");
|
||||
w.unmount();
|
||||
});
|
||||
it("supports SSR and hydration with explicit control ID inside group", async () => {
|
||||
const view = defineComponent({
|
||||
render: () =>
|
||||
search({ name: "q", defaultValue: "query" }, { id: "explicit-search" }),
|
||||
});
|
||||
const host = document.createElement("div");
|
||||
host.innerHTML = await renderToString(createSSRApp(view));
|
||||
document.body.append(host);
|
||||
expect(host.querySelector("label")?.htmlFor).toBe("explicit-search");
|
||||
const warn = vi.spyOn(console, "warn"),
|
||||
error = vi.spyOn(console, "error");
|
||||
const app = createSSRApp(view);
|
||||
try {
|
||||
app.mount(host);
|
||||
await settle();
|
||||
expect(warn).not.toHaveBeenCalled();
|
||||
expect(error).not.toHaveBeenCalled();
|
||||
} finally {
|
||||
app.unmount();
|
||||
warn.mockRestore();
|
||||
error.mockRestore();
|
||||
host.remove();
|
||||
}
|
||||
});
|
||||
it("updates variant, attrs, event handlers and conditional slots without stale classes", async () => {
|
||||
const attrs = ref<Record<string, unknown>>({}),
|
||||
variant = ref<"primary" | "secondary">("primary"),
|
||||
@@ -499,22 +474,3 @@ it("keeps the baseline preview inventories and exact fieldset submission feedbac
|
||||
);
|
||||
w.unmount();
|
||||
});
|
||||
|
||||
it("plans a grouped leaf's initial search value in SSR and restores the default ID after explicit removal", async () => {
|
||||
const id = ref<string | undefined>("temporary-search");
|
||||
const view = defineComponent({
|
||||
render: () => search({}, { id: id.value, defaultValue: "leaf initial" }),
|
||||
});
|
||||
const html = await renderToString(createSSRApp(view));
|
||||
expect(html).not.toContain('data-empty="true"');
|
||||
expect(html).toContain('value="leaf initial"');
|
||||
const w = mount(view);
|
||||
expect(w.get("label").attributes("for")).toBe("temporary-search");
|
||||
id.value = undefined;
|
||||
await settle();
|
||||
expect(w.get("input").attributes("id")).not.toBe("temporary-search");
|
||||
expect(w.get("input").attributes("id")).toBe(
|
||||
w.get("label").attributes("for"),
|
||||
);
|
||||
w.unmount();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user