Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

qr-code.test.tsx

27 lines853 Bytes

1import { renderToStaticMarkup } from "react-dom/server";
2import { describe, expect, it } from "vite-plus/test";
3​
4import { QRCodeSvg } from "./qr-code";
5​
6describe("QRCodeSvg", () => {
7 it("renders with explicit high-contrast colors by default", () => {
8 const markup = renderToStaticMarkup(<QRCodeSvg value="https://example.com/pair" />);
9​
10 expect(markup).toContain('fill="#fff"');
11 expect(markup).toContain('fill="#000"');
12 expect(markup).not.toContain('fill="currentColor"');
13 });
14​
15 it("supports custom foreground and background colors", () => {
16 const markup = renderToStaticMarkup(
17 <QRCodeSvg
18 value="https://example.com/pair"
19 foregroundColor="#123456"
20 backgroundColor="#abcdef"
21 />,
22 );
23​
24 expect(markup).toContain('fill="#abcdef"');
25 expect(markup).toContain('fill="#123456"');
26 });
27});