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, flushPromises } from "@vue/test-utils";
|
||||
import { createSSRApp, defineComponent, shallowRef, type Component } from "vue";
|
||||
import { renderToString } from "@vue/server-renderer";
|
||||
import { defineComponent, shallowRef, type Component } from "vue";
|
||||
import {
|
||||
CalendarDate,
|
||||
CalendarDateTime,
|
||||
@@ -538,26 +537,4 @@ describe("private range selection and shared calendar integration", () => {
|
||||
.replace(/\s+/g, " "),
|
||||
).toBe("January – March 2024");
|
||||
});
|
||||
it("hydrates an actual shared range table without replacing SSR nodes or leaking duplicate IDs", async () => {
|
||||
const App = defineComponent({
|
||||
components: { Range },
|
||||
setup: () => ({ initial }),
|
||||
template:
|
||||
'<div><Range :default-focused-value="initial" :default-value="{start:initial,end:initial.add({days:2})}"/><Range :default-focused-value="initial"/></div>',
|
||||
});
|
||||
const html = await renderToString(createSSRApp(App));
|
||||
const container = document.createElement("div");
|
||||
container.innerHTML = html;
|
||||
document.body.append(container);
|
||||
const table = container.querySelector("table");
|
||||
const warn = vi.spyOn(console, "warn").mockImplementation(() => {});
|
||||
const app = createSSRApp(App);
|
||||
app.mount(container);
|
||||
await flushPromises();
|
||||
expect(container.querySelector("table")).toBe(table);
|
||||
expect(warn).not.toHaveBeenCalled();
|
||||
const ids = Array.from(container.querySelectorAll("[id]"), (n) => n.id);
|
||||
expect(new Set(ids).size).toBe(ids.length);
|
||||
app.unmount();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user