feat: migrate Pagination Header and InputOTP with field and event regressions
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
// @vitest-environment node
|
||||
import { expect, it } from "vitest";
|
||||
import { createSSRApp, h } from "vue";
|
||||
import { renderToString } from "@vue/server-renderer";
|
||||
import {
|
||||
InputOTP,
|
||||
InputOTPGroup,
|
||||
InputOTPSlot,
|
||||
Label,
|
||||
} from "../packages/vue/src";
|
||||
it("renders composed OTP names on the real native inputs without browser globals", async () => {
|
||||
expect(typeof window).toBe("undefined");
|
||||
const html = await renderToString(
|
||||
createSSRApp({
|
||||
render: () =>
|
||||
h(InputOTP, { maxLength: 2, defaultValue: "12" }, () => [
|
||||
h(Label, { id: "otp-server-label" }, () => "Security code"),
|
||||
h(InputOTPGroup, {}, () => [
|
||||
h(InputOTPSlot, { index: 0 }),
|
||||
h(InputOTPSlot, { index: 1 }),
|
||||
]),
|
||||
]),
|
||||
}),
|
||||
);
|
||||
expect(html.match(/aria-labelledby="otp-server-label"/g)).toHaveLength(2);
|
||||
expect(html).toContain('value="1"');
|
||||
expect(html).toContain('value="2"');
|
||||
expect(html).not.toMatch(/aria-label="pin input/);
|
||||
});
|
||||
Reference in New Issue
Block a user