feat: migrate Slider with native range semantics and strict ESM declarations
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { createSSRApp, h } from "vue";
|
||||
import { renderToString } from "@vue/server-renderer";
|
||||
import {
|
||||
Slider,
|
||||
SliderTrack,
|
||||
SliderFill,
|
||||
SliderThumb,
|
||||
SliderOutput,
|
||||
SliderMarks,
|
||||
Label,
|
||||
sliderVariants,
|
||||
} from "@heroui-vue/components";
|
||||
const html = await renderToString(
|
||||
createSSRApp({
|
||||
render: () =>
|
||||
h(Slider, { defaultValue: [20, 80], dir: "rtl" }, () => [
|
||||
h(Label, {}, () => "Price"),
|
||||
h(SliderOutput),
|
||||
h(SliderTrack, {}, () => [
|
||||
h(SliderFill),
|
||||
h(SliderThumb, { name: "min" }),
|
||||
h(SliderThumb, { name: "max", index: 1 }),
|
||||
]),
|
||||
h(SliderMarks),
|
||||
]),
|
||||
}),
|
||||
);
|
||||
assert(html.includes('aria-valuenow="20"'));
|
||||
assert(html.includes('aria-valuenow="80"'));
|
||||
assert(html.includes("right:20%"));
|
||||
assert(html.includes('name="min"'));
|
||||
assert(html.includes('name="max"'));
|
||||
const css = readFileSync(
|
||||
new URL(import.meta.resolve("@heroui-vue/styles/css")),
|
||||
"utf8",
|
||||
);
|
||||
assert(css.includes(".hv-slider__track"));
|
||||
assert(css.includes("prefers-reduced-motion"));
|
||||
assert(!css.includes(".hv-slider__thumb:after:not(:is())"));
|
||||
assert(sliderVariants().thumb().includes("hv-slider__thumb"));
|
||||
console.log(
|
||||
"Independent tarball consumer: ESM, SSR, CSS and six named parts passed.",
|
||||
);
|
||||
Reference in New Issue
Block a user