41 lines
1.7 KiB
TypeScript
41 lines
1.7 KiB
TypeScript
// @vitest-environment node
|
|
import { describe, it, expect } from "vitest";
|
|
import { createSSRApp, defineComponent } from "vue";
|
|
import { renderToString } from "@vue/server-renderer";
|
|
import Slider from "../packages/vue/tests/fixtures/ColorSliderFoundation.vue";
|
|
import Picker from "../packages/vue/tests/fixtures/ColorPickerComposition.vue";
|
|
describe("private custom color track and picker actual Node SSR", () => {
|
|
it("renders direction, gradient, native value and accepted thumb consistently without layout globals", async () => {
|
|
const html = await renderToString(
|
|
createSSRApp(
|
|
defineComponent({
|
|
components: { Slider },
|
|
template:
|
|
'<Slider channel="alpha" name="alpha" orientation="vertical" dir="rtl" default-value="hsba(270,0%,50%,.12345)" aria-label="Alpha"/>',
|
|
}),
|
|
),
|
|
);
|
|
expect(html).toContain('value="0.12345"');
|
|
expect(html).toContain("top:87.655%");
|
|
expect(html).toContain('aria-orientation="vertical"');
|
|
expect(html).toContain("linear-gradient(to top");
|
|
expect(html.match(/name="alpha"/g)).toHaveLength(1);
|
|
expect(html).not.toContain("NaN");
|
|
});
|
|
it("renders a single exact owner submission while closed, without popup controls", async () => {
|
|
const html = await renderToString(
|
|
createSSRApp(
|
|
defineComponent({
|
|
components: { Picker },
|
|
template:
|
|
'<Picker name="color" default-value="hsba(270,0%,50%,.123456789012345)"/>',
|
|
}),
|
|
),
|
|
);
|
|
expect(html).toContain('value="hsba(270, 0%, 50%, 0.123456789012345)"');
|
|
expect(html.match(/name="color"/g)).toHaveLength(1);
|
|
expect(html).toContain('aria-expanded="false"');
|
|
expect(html).not.toContain("data-color-slider-track");
|
|
});
|
|
});
|