chore: remove legacy SSR checks and consolidate migration maintenance
This commit is contained in:
@@ -1,13 +1,12 @@
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
import { mount, flushPromises } from "@vue/test-utils";
|
||||
import { defineComponent, shallowRef, createSSRApp } from "vue";
|
||||
import { defineComponent, shallowRef } from "vue";
|
||||
import Input from "../packages/vue/tests/fixtures/ColorInputFoundation.vue";
|
||||
import Picker from "../packages/vue/tests/fixtures/ColorPickerFoundation.vue";
|
||||
import Area from "../packages/vue/tests/fixtures/ColorAreaFoundation.vue";
|
||||
import { Color, parseColor } from "../packages/vue/src/components/color/value";
|
||||
import { colorChannel } from "../packages/vue/src/components/color/channel";
|
||||
import { parseColorNumber } from "../packages/vue/src/components/color/text";
|
||||
import { renderToString } from "@vue/server-renderer";
|
||||
import { Form } from "../packages/vue/src/index";
|
||||
const wrappers: ReturnType<typeof mount>[] = [];
|
||||
afterEach(() => {
|
||||
@@ -359,42 +358,3 @@ describe("color input lifecycle integration", () => {
|
||||
expect(w.getComponent(Picker).emitted("changeEnd")).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe("color inputs hydration and precision", () => {
|
||||
it("does not quantize an untouched formatted alpha draft", async () => {
|
||||
const w = fixture(
|
||||
'<Input channel="alpha" default-value="hsb(270,0%,50%,.123456789012345)"/>',
|
||||
);
|
||||
await input(w).trigger("keydown", { key: "Enter" });
|
||||
expect(changes(w)).toHaveLength(0);
|
||||
});
|
||||
it("hydrates stable actual inputs, native values and IDs", async () => {
|
||||
const App = defineComponent({
|
||||
components: { Input, Picker },
|
||||
template:
|
||||
'<main><Picker default-value="hsb(270,0%,50%,.125)" v-slot><Input channel="alpha" locale="de-DE"/><Input mode="range" channel="hue"/></Picker><Input default-value="#123456"/></main>',
|
||||
});
|
||||
const container = document.createElement("div");
|
||||
container.innerHTML = await renderToString(createSSRApp(App));
|
||||
document.body.append(container);
|
||||
const nodes = [...container.querySelectorAll("[data-color-input]")];
|
||||
const warn = vi.spyOn(console, "warn").mockImplementation(() => {});
|
||||
const error = vi.spyOn(console, "error").mockImplementation(() => {});
|
||||
const app = createSSRApp(App);
|
||||
app.mount(container);
|
||||
await flushPromises();
|
||||
expect([...container.querySelectorAll("[data-color-input]")]).toEqual(
|
||||
nodes,
|
||||
);
|
||||
expect(nodes.map((n) => (n as HTMLInputElement).value)).toEqual([
|
||||
"12,5",
|
||||
"270",
|
||||
"#123456",
|
||||
]);
|
||||
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();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user