|
1 | 1 | import { render } from "@testing-library/react"; |
2 | 2 | import { describe, expect, it } from "vitest"; |
3 | | -import { ThemeModeScript } from "./mode-script"; |
| 3 | +import { getThemeModeScript, ThemeModeScript } from "./mode-script"; |
4 | 4 |
|
5 | 5 | describe("ThemeModeScript", () => { |
6 | 6 | it("should render with default props", () => { |
@@ -47,3 +47,25 @@ describe("ThemeModeScript", () => { |
47 | 47 | expect(script?.innerHTML).toContain('const className = "dark"'); |
48 | 48 | }); |
49 | 49 | }); |
| 50 | + |
| 51 | +describe("getThemeModeScript", () => { |
| 52 | + it("should return the correct script for prefix and version 3", () => { |
| 53 | + const script = getThemeModeScript({ prefix: "custom-", version: 3 }); |
| 54 | + expect(script).toContain('const className = "custom-dark"'); |
| 55 | + }); |
| 56 | + |
| 57 | + it("should return the correct script for prefix and version 4", () => { |
| 58 | + const script = getThemeModeScript({ prefix: "custom-", version: 4 }); |
| 59 | + expect(script).toContain('const className = "dark"'); |
| 60 | + }); |
| 61 | + |
| 62 | + it("should return the correct script for version 3", () => { |
| 63 | + const script = getThemeModeScript({ version: 3 }); |
| 64 | + expect(script).toContain('const className = "dark"'); |
| 65 | + }); |
| 66 | + |
| 67 | + it("should return the correct script for version 4", () => { |
| 68 | + const script = getThemeModeScript({ version: 4 }); |
| 69 | + expect(script).toContain('const className = "dark"'); |
| 70 | + }); |
| 71 | +}); |
0 commit comments