| 1 | import { renderToStaticMarkup } from "react-dom/server"; |
| 2 | import { describe, expect, it } from "vite-plus/test"; |
| 3 | |
| 4 | import { QRCodeSvg } from "./qr-code"; |
| 5 | |
| 6 | describe("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 | }); |