// @vitest-environment node
import { describe, it, expect } from "vitest";
import { createSSRApp, defineComponent } from "vue";
import { renderToString } from "@vue/server-renderer";
import Input from "../packages/vue/tests/fixtures/ColorInputFoundation.vue";
import Picker from "../packages/vue/tests/fixtures/ColorPickerFoundation.vue";
describe("private color inputs actual Node SSR", () => {
it("renders localized text and exact fractional native channel without browser globals", async () => {
const html = await renderToString(
createSSRApp(
defineComponent({
components: { Input, Picker },
template:
'',
}),
),
);
expect(html).toContain('value="12,345"');
expect(html).toContain('value="0.12345"');
expect(html).toContain('value="270"');
expect(html).toContain('aria-valuetext="270°"');
expect(html.match(/name="alpha"/g)).toHaveLength(1);
expect(html).not.toContain("NaN");
});
it("renders empty fields and native validation association deterministically", async () => {
const html = await renderToString(
createSSRApp(
defineComponent({
components: { Input },
template:
'',
}),
),
);
expect(html).toContain('aria-required="true"');
expect(html).toContain('form="external"');
expect(html).toContain('value=""');
});
});