|
5 | 5 | LINE_WIDTHS,
|
6 | 6 | OFFSETS,
|
7 | 7 | SPACING,
|
| 8 | + SQUARE_SIZES, |
8 | 9 | } from "../src/consts";
|
9 | 10 | import { css, expectCssToBe, generateTwCss } from "./utils";
|
10 | 11 |
|
@@ -55,6 +56,31 @@ describe("dot sizes", () => {
|
55 | 56 | });
|
56 | 57 | });
|
57 | 58 |
|
| 59 | +describe("square sizes", () => { |
| 60 | + test(`square sizes ${SQUARE_SIZES[0]}-${SQUARE_SIZES[SQUARE_SIZES.length - 1]}`, async () => { |
| 61 | + const expected: string[] = []; |
| 62 | + const classes: string[] = []; |
| 63 | + for (const value of SQUARE_SIZES) { |
| 64 | + classes.push(`${DEFAULT_OPTS.prefix}pattern-square-${value}`); |
| 65 | + expected.push( |
| 66 | + css`.${DEFAULT_OPTS.prefix}pattern-square-${value} { |
| 67 | + --tw-square-size: ${value} /* px */ |
| 68 | + }`, |
| 69 | + ); |
| 70 | + } |
| 71 | + expectCssToBe(await generateTwCss(classes.join(" ")), expected.join("")); |
| 72 | + }); |
| 73 | + |
| 74 | + test("custom square size", async () => { |
| 75 | + expectCssToBe( |
| 76 | + await generateTwCss(`${DEFAULT_OPTS.prefix}pattern-square-[321]`), |
| 77 | + css`.${DEFAULT_OPTS.prefix}pattern-square-[321] { |
| 78 | + --tw-square-size: 321 /* px */ |
| 79 | + }`, |
| 80 | + ); |
| 81 | + }); |
| 82 | +}); |
| 83 | + |
58 | 84 | describe("spacing", () => {
|
59 | 85 | test(`spacing ${SPACING[0]}-${SPACING[SPACING.length - 1]}`, async () => {
|
60 | 86 | const expected: string[] = [];
|
@@ -174,3 +200,32 @@ describe("dot colors", () => {
|
174 | 200 | );
|
175 | 201 | });
|
176 | 202 | });
|
| 203 | + |
| 204 | +describe("square colors", () => { |
| 205 | + test("custom color", async () => { |
| 206 | + expectCssToBe( |
| 207 | + await generateTwCss(`${DEFAULT_OPTS.prefix}pattern-square-[#f8f8f8]`), |
| 208 | + css`.${DEFAULT_OPTS.prefix}pattern-square-[#f8f8f8] { |
| 209 | + --tw-square-color: #f8f8f8 |
| 210 | + }`, |
| 211 | + ); |
| 212 | + }); |
| 213 | + |
| 214 | + test("color with variant", async () => { |
| 215 | + expectCssToBe( |
| 216 | + await generateTwCss(`${DEFAULT_OPTS.prefix}pattern-square-red-300`), |
| 217 | + css`.${DEFAULT_OPTS.prefix}pattern-square-red-300 { |
| 218 | + --tw-square-color: #fca5a5 |
| 219 | + }`, |
| 220 | + ); |
| 221 | + }); |
| 222 | + |
| 223 | + test("color without variant", async () => { |
| 224 | + expectCssToBe( |
| 225 | + await generateTwCss(`${DEFAULT_OPTS.prefix}pattern-square-white`), |
| 226 | + css`.${DEFAULT_OPTS.prefix}pattern-square-white { |
| 227 | + --tw-square-color: #fff |
| 228 | + }`, |
| 229 | + ); |
| 230 | + }); |
| 231 | +}); |
0 commit comments