@hy_ong/zod-kit 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/ci.yml +24 -0
- package/CLAUDE.md +64 -22
- package/dist/chunk-2SWEVDFZ.js +134 -0
- package/dist/chunk-32JI34CV.cjs +146 -0
- package/dist/chunk-42C5OHRK.js +71 -0
- package/dist/chunk-46VAH2BJ.js +160 -0
- package/dist/chunk-5JGTDL3Y.js +87 -0
- package/dist/chunk-5LEXCVLX.js +257 -0
- package/dist/chunk-6AAP4LPF.js +2606 -0
- package/dist/chunk-B4EZYZOK.cjs +215 -0
- package/dist/chunk-COYKBWTI.js +161 -0
- package/dist/chunk-DFJZ3NS2.cjs +151 -0
- package/dist/chunk-EDHT4LPO.js +118 -0
- package/dist/chunk-EGHL277K.cjs +165 -0
- package/dist/chunk-ERH4NIMU.cjs +69 -0
- package/dist/chunk-FM3EZ72O.js +165 -0
- package/dist/chunk-GJIRDBZJ.cjs +90 -0
- package/dist/chunk-H2XTEM4M.js +696 -0
- package/dist/chunk-HMSM6FFA.cjs +181 -0
- package/dist/chunk-HTEHINI7.cjs +177 -0
- package/dist/chunk-JOLSGZGN.cjs +696 -0
- package/dist/chunk-JXY7APBU.js +69 -0
- package/dist/chunk-K2UOY6TB.js +136 -0
- package/dist/chunk-KFOHKTFD.js +61 -0
- package/dist/chunk-L4HSIKTU.cjs +135 -0
- package/dist/chunk-LH7ZB4BK.js +124 -0
- package/dist/chunk-LL4ZWLGO.js +90 -0
- package/dist/chunk-M6MTP3NY.cjs +99 -0
- package/dist/chunk-MHJFYYGV.js +215 -0
- package/dist/chunk-MINMXGW3.js +135 -0
- package/dist/chunk-MM7IL2RG.js +181 -0
- package/dist/chunk-OPQJWHXN.cjs +301 -0
- package/dist/chunk-ORFHDJII.cjs +136 -0
- package/dist/chunk-ORVV4MCF.cjs +87 -0
- package/dist/chunk-QICQ6YEY.js +75 -0
- package/dist/chunk-RKUQREMW.js +127 -0
- package/dist/chunk-RO47DKQG.js +146 -0
- package/dist/chunk-RRPXIRTQ.cjs +257 -0
- package/dist/chunk-RYFG2GKM.cjs +118 -0
- package/dist/chunk-STNHTRG7.cjs +124 -0
- package/dist/chunk-TFGS34VD.cjs +71 -0
- package/dist/chunk-TQXDUMML.cjs +61 -0
- package/dist/chunk-UBK3VCVH.cjs +134 -0
- package/dist/chunk-UCOXAZJF.cjs +2606 -0
- package/dist/chunk-UQZKFAFX.js +130 -0
- package/dist/chunk-VB2KV2ZM.cjs +130 -0
- package/dist/chunk-WABKPFPK.js +151 -0
- package/dist/chunk-WDI4QJMQ.js +177 -0
- package/dist/chunk-YDH3L27K.cjs +127 -0
- package/dist/chunk-YIM3D2AD.js +99 -0
- package/dist/chunk-YPSEIDUR.cjs +160 -0
- package/dist/chunk-ZNJLWJX3.cjs +75 -0
- package/dist/chunk-ZTFCJCPO.cjs +161 -0
- package/dist/chunk-ZXUMK2RR.js +301 -0
- package/dist/common/boolean.cjs +7 -0
- package/dist/common/boolean.d.cts +119 -0
- package/dist/common/boolean.d.ts +119 -0
- package/dist/common/boolean.js +7 -0
- package/dist/common/color.cjs +9 -0
- package/dist/common/color.d.cts +26 -0
- package/dist/common/color.d.ts +26 -0
- package/dist/common/color.js +9 -0
- package/dist/common/coordinate.cjs +11 -0
- package/dist/common/coordinate.d.cts +23 -0
- package/dist/common/coordinate.d.ts +23 -0
- package/dist/common/coordinate.js +11 -0
- package/dist/common/credit-card.cjs +11 -0
- package/dist/common/credit-card.d.cts +22 -0
- package/dist/common/credit-card.d.ts +22 -0
- package/dist/common/credit-card.js +11 -0
- package/dist/common/date.cjs +7 -0
- package/dist/common/date.d.cts +174 -0
- package/dist/common/date.d.ts +174 -0
- package/dist/common/date.js +7 -0
- package/dist/common/datetime.cjs +15 -0
- package/dist/common/datetime.d.cts +301 -0
- package/dist/common/datetime.d.ts +301 -0
- package/dist/common/datetime.js +15 -0
- package/dist/common/email.cjs +7 -0
- package/dist/common/email.d.cts +149 -0
- package/dist/common/email.d.ts +149 -0
- package/dist/common/email.js +7 -0
- package/dist/common/file.cjs +7 -0
- package/dist/common/file.d.cts +178 -0
- package/dist/common/file.d.ts +178 -0
- package/dist/common/file.js +7 -0
- package/dist/common/id.cjs +13 -0
- package/dist/common/id.d.cts +288 -0
- package/dist/common/id.d.ts +288 -0
- package/dist/common/id.js +13 -0
- package/dist/common/ip.cjs +11 -0
- package/dist/common/ip.d.cts +25 -0
- package/dist/common/ip.d.ts +25 -0
- package/dist/common/ip.js +11 -0
- package/dist/common/number.cjs +7 -0
- package/dist/common/number.d.cts +167 -0
- package/dist/common/number.d.ts +167 -0
- package/dist/common/number.js +7 -0
- package/dist/common/password.cjs +7 -0
- package/dist/common/password.d.cts +192 -0
- package/dist/common/password.d.ts +192 -0
- package/dist/common/password.js +7 -0
- package/dist/common/text.cjs +7 -0
- package/dist/common/text.d.cts +156 -0
- package/dist/common/text.d.ts +156 -0
- package/dist/common/text.js +7 -0
- package/dist/common/time.cjs +15 -0
- package/dist/common/time.d.cts +268 -0
- package/dist/common/time.d.ts +268 -0
- package/dist/common/time.js +15 -0
- package/dist/common/url.cjs +7 -0
- package/dist/common/url.d.cts +196 -0
- package/dist/common/url.d.ts +196 -0
- package/dist/common/url.js +7 -0
- package/dist/config-CABSSvAp.d.cts +5 -0
- package/dist/config-CABSSvAp.d.ts +5 -0
- package/dist/index.cjs +180 -5255
- package/dist/index.d.cts +28 -3150
- package/dist/index.d.ts +28 -3150
- package/dist/index.js +135 -5131
- package/dist/taiwan/bank-account.cjs +11 -0
- package/dist/taiwan/bank-account.d.cts +22 -0
- package/dist/taiwan/bank-account.d.ts +22 -0
- package/dist/taiwan/bank-account.js +11 -0
- package/dist/taiwan/business-id.cjs +9 -0
- package/dist/taiwan/business-id.d.cts +133 -0
- package/dist/taiwan/business-id.d.ts +133 -0
- package/dist/taiwan/business-id.js +9 -0
- package/dist/taiwan/fax.cjs +9 -0
- package/dist/taiwan/fax.d.cts +157 -0
- package/dist/taiwan/fax.d.ts +157 -0
- package/dist/taiwan/fax.js +9 -0
- package/dist/taiwan/invoice.cjs +9 -0
- package/dist/taiwan/invoice.d.cts +17 -0
- package/dist/taiwan/invoice.d.ts +17 -0
- package/dist/taiwan/invoice.js +9 -0
- package/dist/taiwan/license-plate.cjs +9 -0
- package/dist/taiwan/license-plate.d.cts +19 -0
- package/dist/taiwan/license-plate.d.ts +19 -0
- package/dist/taiwan/license-plate.js +9 -0
- package/dist/taiwan/mobile.cjs +9 -0
- package/dist/taiwan/mobile.d.cts +146 -0
- package/dist/taiwan/mobile.d.ts +146 -0
- package/dist/taiwan/mobile.js +9 -0
- package/dist/taiwan/national-id.cjs +15 -0
- package/dist/taiwan/national-id.d.cts +214 -0
- package/dist/taiwan/national-id.d.ts +214 -0
- package/dist/taiwan/national-id.js +15 -0
- package/dist/taiwan/passport.cjs +9 -0
- package/dist/taiwan/passport.d.cts +19 -0
- package/dist/taiwan/passport.d.ts +19 -0
- package/dist/taiwan/passport.js +9 -0
- package/dist/taiwan/postal-code.cjs +17 -0
- package/dist/taiwan/postal-code.d.cts +237 -0
- package/dist/taiwan/postal-code.d.ts +237 -0
- package/dist/taiwan/postal-code.js +17 -0
- package/dist/taiwan/tel.cjs +9 -0
- package/dist/taiwan/tel.d.cts +162 -0
- package/dist/taiwan/tel.d.ts +162 -0
- package/dist/taiwan/tel.js +9 -0
- package/package.json +132 -6
- package/src/i18n/locales/en-GB.json +51 -0
- package/src/i18n/locales/en-US.json +52 -1
- package/src/i18n/locales/id-ID.json +51 -0
- package/src/i18n/locales/ja-JP.json +51 -0
- package/src/i18n/locales/ko-KR.json +51 -0
- package/src/i18n/locales/ms-MY.json +51 -0
- package/src/i18n/locales/th-TH.json +51 -0
- package/src/i18n/locales/vi-VN.json +51 -0
- package/src/i18n/locales/zh-CN.json +51 -0
- package/src/i18n/locales/zh-TW.json +51 -0
- package/src/index.ts +10 -2
- package/src/validators/common/color.ts +192 -0
- package/src/validators/common/coordinate.ts +159 -0
- package/src/validators/common/credit-card.ts +134 -0
- package/src/validators/common/id.ts +45 -3
- package/src/validators/common/ip.ts +210 -0
- package/src/validators/taiwan/bank-account.ts +176 -0
- package/src/validators/taiwan/invoice.ts +84 -0
- package/src/validators/taiwan/license-plate.ts +110 -0
- package/src/validators/taiwan/passport.ts +103 -0
- package/tests/common/color.test.ts +587 -0
- package/tests/common/coordinate.test.ts +345 -0
- package/tests/common/credit-card.test.ts +378 -0
- package/tests/common/id.test.ts +68 -3
- package/tests/common/ip.test.ts +419 -0
- package/tests/taiwan/bank-account.test.ts +286 -0
- package/tests/taiwan/invoice.test.ts +227 -0
- package/tests/taiwan/license-plate.test.ts +280 -0
- package/tests/taiwan/passport.test.ts +277 -0
- package/tsup.config.ts +36 -0
|
@@ -0,0 +1,587 @@
|
|
|
1
|
+
import { describe, it, expect, beforeEach } from "vitest"
|
|
2
|
+
import { color, setLocale } from "../../src"
|
|
3
|
+
|
|
4
|
+
describe("color(true) validator", () => {
|
|
5
|
+
beforeEach(() => setLocale("en-US"))
|
|
6
|
+
|
|
7
|
+
describe("hex validation", () => {
|
|
8
|
+
it("should accept valid 3-digit hex (#RGB)", () => {
|
|
9
|
+
const schema = color(true)
|
|
10
|
+
|
|
11
|
+
expect(schema.parse("#fff")).toBe("#fff")
|
|
12
|
+
expect(schema.parse("#FFF")).toBe("#FFF")
|
|
13
|
+
expect(schema.parse("#000")).toBe("#000")
|
|
14
|
+
expect(schema.parse("#abc")).toBe("#abc")
|
|
15
|
+
expect(schema.parse("#ABC")).toBe("#ABC")
|
|
16
|
+
expect(schema.parse("#f0f")).toBe("#f0f")
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
it("should accept valid 6-digit hex (#RRGGBB)", () => {
|
|
20
|
+
const schema = color(true)
|
|
21
|
+
|
|
22
|
+
expect(schema.parse("#ff0000")).toBe("#ff0000")
|
|
23
|
+
expect(schema.parse("#FF0000")).toBe("#FF0000")
|
|
24
|
+
expect(schema.parse("#00ff00")).toBe("#00ff00")
|
|
25
|
+
expect(schema.parse("#0000ff")).toBe("#0000ff")
|
|
26
|
+
expect(schema.parse("#ffffff")).toBe("#ffffff")
|
|
27
|
+
expect(schema.parse("#000000")).toBe("#000000")
|
|
28
|
+
expect(schema.parse("#abcdef")).toBe("#abcdef")
|
|
29
|
+
expect(schema.parse("#ABCDEF")).toBe("#ABCDEF")
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
it("should accept valid 8-digit hex with alpha (#RRGGBBAA) when allowAlpha is true", () => {
|
|
33
|
+
const schema = color(true, { allowAlpha: true })
|
|
34
|
+
|
|
35
|
+
expect(schema.parse("#FF0000AA")).toBe("#FF0000AA")
|
|
36
|
+
expect(schema.parse("#ff000080")).toBe("#ff000080")
|
|
37
|
+
expect(schema.parse("#00000000")).toBe("#00000000")
|
|
38
|
+
expect(schema.parse("#ffffffff")).toBe("#ffffffff")
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
it("should reject 8-digit hex when allowAlpha is false", () => {
|
|
42
|
+
const schema = color(true, { allowAlpha: false })
|
|
43
|
+
|
|
44
|
+
expect(() => schema.parse("#FF0000AA")).toThrow("Invalid color format")
|
|
45
|
+
expect(() => schema.parse("#ff000080")).toThrow("Invalid color format")
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
it("should reject invalid hex values", () => {
|
|
49
|
+
const schema = color(true)
|
|
50
|
+
|
|
51
|
+
expect(() => schema.parse("#gg0000")).toThrow("Invalid color format")
|
|
52
|
+
expect(() => schema.parse("#12345")).toThrow("Invalid color format")
|
|
53
|
+
expect(() => schema.parse("#1")).toThrow("Invalid color format")
|
|
54
|
+
expect(() => schema.parse("#")).toThrow("Invalid color format")
|
|
55
|
+
expect(() => schema.parse("#12")).toThrow("Invalid color format")
|
|
56
|
+
expect(() => schema.parse("#1234")).toThrow("Invalid color format")
|
|
57
|
+
expect(() => schema.parse("#1234567")).toThrow("Invalid color format")
|
|
58
|
+
expect(() => schema.parse("#123456789")).toThrow("Invalid color format")
|
|
59
|
+
expect(() => schema.parse("fff")).toThrow("Invalid color format")
|
|
60
|
+
expect(() => schema.parse("ff0000")).toThrow("Invalid color format")
|
|
61
|
+
})
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
describe("rgb validation", () => {
|
|
65
|
+
it("should accept valid rgb() values", () => {
|
|
66
|
+
const schema = color(true)
|
|
67
|
+
|
|
68
|
+
expect(schema.parse("rgb(255, 0, 0)")).toBe("rgb(255, 0, 0)")
|
|
69
|
+
expect(schema.parse("rgb(0, 255, 0)")).toBe("rgb(0, 255, 0)")
|
|
70
|
+
expect(schema.parse("rgb(0, 0, 255)")).toBe("rgb(0, 0, 255)")
|
|
71
|
+
expect(schema.parse("rgb(0, 0, 0)")).toBe("rgb(0, 0, 0)")
|
|
72
|
+
expect(schema.parse("rgb(255, 255, 255)")).toBe("rgb(255, 255, 255)")
|
|
73
|
+
expect(schema.parse("rgb(128, 128, 128)")).toBe("rgb(128, 128, 128)")
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
it("should accept valid rgba() values when allowAlpha is true", () => {
|
|
77
|
+
const schema = color(true, { allowAlpha: true })
|
|
78
|
+
|
|
79
|
+
expect(schema.parse("rgba(255, 0, 0, 0.5)")).toBe("rgba(255, 0, 0, 0.5)")
|
|
80
|
+
expect(schema.parse("rgba(0, 0, 0, 0)")).toBe("rgba(0, 0, 0, 0)")
|
|
81
|
+
expect(schema.parse("rgba(255, 255, 255, 1)")).toBe("rgba(255, 255, 255, 1)")
|
|
82
|
+
expect(schema.parse("rgba(128, 128, 128, 0.75)")).toBe("rgba(128, 128, 128, 0.75)")
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
it("should reject rgba() values when allowAlpha is false", () => {
|
|
86
|
+
const schema = color(true, { allowAlpha: false })
|
|
87
|
+
|
|
88
|
+
expect(() => schema.parse("rgba(255, 0, 0, 0.5)")).toThrow("Invalid color format")
|
|
89
|
+
expect(() => schema.parse("rgba(0, 0, 0, 0)")).toThrow("Invalid color format")
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
it("should reject out-of-range rgb values", () => {
|
|
93
|
+
const schema = color(true)
|
|
94
|
+
|
|
95
|
+
expect(() => schema.parse("rgb(256, 0, 0)")).toThrow("Invalid color format")
|
|
96
|
+
expect(() => schema.parse("rgb(-1, 0, 0)")).toThrow("Invalid color format")
|
|
97
|
+
expect(() => schema.parse("rgb(0, 256, 0)")).toThrow("Invalid color format")
|
|
98
|
+
expect(() => schema.parse("rgb(0, 0, 256)")).toThrow("Invalid color format")
|
|
99
|
+
expect(() => schema.parse("rgb(0, -1, 0)")).toThrow("Invalid color format")
|
|
100
|
+
expect(() => schema.parse("rgb(0, 0, -1)")).toThrow("Invalid color format")
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
it("should reject rgba with out-of-range alpha", () => {
|
|
104
|
+
const schema = color(true, { allowAlpha: true })
|
|
105
|
+
|
|
106
|
+
expect(() => schema.parse("rgba(255, 0, 0, 1.1)")).toThrow("Invalid color format")
|
|
107
|
+
expect(() => schema.parse("rgba(255, 0, 0, -0.1)")).toThrow("Invalid color format")
|
|
108
|
+
expect(() => schema.parse("rgba(255, 0, 0, 2)")).toThrow("Invalid color format")
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
it("should reject rgb with decimal channel values", () => {
|
|
112
|
+
const schema = color(true)
|
|
113
|
+
|
|
114
|
+
expect(() => schema.parse("rgb(255.5, 0, 0)")).toThrow("Invalid color format")
|
|
115
|
+
expect(() => schema.parse("rgb(0, 128.3, 0)")).toThrow("Invalid color format")
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
it("should reject rgb with alpha and rgba without alpha", () => {
|
|
119
|
+
const schema = color(true, { allowAlpha: true })
|
|
120
|
+
|
|
121
|
+
// rgb() should not have alpha
|
|
122
|
+
expect(() => schema.parse("rgb(255, 0, 0, 0.5)")).toThrow("Invalid color format")
|
|
123
|
+
// rgba() must have alpha
|
|
124
|
+
expect(() => schema.parse("rgba(255, 0, 0)")).toThrow("Invalid color format")
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
it("should reject malformed rgb strings", () => {
|
|
128
|
+
const schema = color(true)
|
|
129
|
+
|
|
130
|
+
expect(() => schema.parse("rgb(255, 0)")).toThrow("Invalid color format")
|
|
131
|
+
expect(() => schema.parse("rgb(255)")).toThrow("Invalid color format")
|
|
132
|
+
expect(() => schema.parse("rgb()")).toThrow("Invalid color format")
|
|
133
|
+
expect(() => schema.parse("rgb(a, b, c)")).toThrow("Invalid color format")
|
|
134
|
+
})
|
|
135
|
+
})
|
|
136
|
+
|
|
137
|
+
describe("hsl validation", () => {
|
|
138
|
+
it("should accept valid hsl() values", () => {
|
|
139
|
+
const schema = color(true)
|
|
140
|
+
|
|
141
|
+
expect(schema.parse("hsl(360, 100%, 50%)")).toBe("hsl(360, 100%, 50%)")
|
|
142
|
+
expect(schema.parse("hsl(0, 0%, 0%)")).toBe("hsl(0, 0%, 0%)")
|
|
143
|
+
expect(schema.parse("hsl(180, 50%, 50%)")).toBe("hsl(180, 50%, 50%)")
|
|
144
|
+
expect(schema.parse("hsl(120, 100%, 25%)")).toBe("hsl(120, 100%, 25%)")
|
|
145
|
+
expect(schema.parse("hsl(240, 75%, 60%)")).toBe("hsl(240, 75%, 60%)")
|
|
146
|
+
})
|
|
147
|
+
|
|
148
|
+
it("should accept valid hsla() values when allowAlpha is true", () => {
|
|
149
|
+
const schema = color(true, { allowAlpha: true })
|
|
150
|
+
|
|
151
|
+
expect(schema.parse("hsla(180, 50%, 50%, 0.5)")).toBe("hsla(180, 50%, 50%, 0.5)")
|
|
152
|
+
expect(schema.parse("hsla(0, 0%, 0%, 0)")).toBe("hsla(0, 0%, 0%, 0)")
|
|
153
|
+
expect(schema.parse("hsla(360, 100%, 100%, 1)")).toBe("hsla(360, 100%, 100%, 1)")
|
|
154
|
+
expect(schema.parse("hsla(90, 25%, 75%, 0.3)")).toBe("hsla(90, 25%, 75%, 0.3)")
|
|
155
|
+
})
|
|
156
|
+
|
|
157
|
+
it("should reject hsla() values when allowAlpha is false", () => {
|
|
158
|
+
const schema = color(true, { allowAlpha: false })
|
|
159
|
+
|
|
160
|
+
expect(() => schema.parse("hsla(180, 50%, 50%, 0.5)")).toThrow("Invalid color format")
|
|
161
|
+
expect(() => schema.parse("hsla(0, 0%, 0%, 0)")).toThrow("Invalid color format")
|
|
162
|
+
})
|
|
163
|
+
|
|
164
|
+
it("should reject out-of-range hsl values", () => {
|
|
165
|
+
const schema = color(true)
|
|
166
|
+
|
|
167
|
+
expect(() => schema.parse("hsl(361, 100%, 50%)")).toThrow("Invalid color format")
|
|
168
|
+
expect(() => schema.parse("hsl(-1, 100%, 50%)")).toThrow("Invalid color format")
|
|
169
|
+
expect(() => schema.parse("hsl(0, 101%, 50%)")).toThrow("Invalid color format")
|
|
170
|
+
expect(() => schema.parse("hsl(0, -1%, 50%)")).toThrow("Invalid color format")
|
|
171
|
+
expect(() => schema.parse("hsl(0, 100%, 101%)")).toThrow("Invalid color format")
|
|
172
|
+
expect(() => schema.parse("hsl(0, 100%, -1%)")).toThrow("Invalid color format")
|
|
173
|
+
})
|
|
174
|
+
|
|
175
|
+
it("should reject hsla with out-of-range alpha", () => {
|
|
176
|
+
const schema = color(true, { allowAlpha: true })
|
|
177
|
+
|
|
178
|
+
expect(() => schema.parse("hsla(180, 50%, 50%, 1.1)")).toThrow("Invalid color format")
|
|
179
|
+
expect(() => schema.parse("hsla(180, 50%, 50%, -0.1)")).toThrow("Invalid color format")
|
|
180
|
+
expect(() => schema.parse("hsla(180, 50%, 50%, 2)")).toThrow("Invalid color format")
|
|
181
|
+
})
|
|
182
|
+
|
|
183
|
+
it("should reject hsl with alpha and hsla without alpha", () => {
|
|
184
|
+
const schema = color(true, { allowAlpha: true })
|
|
185
|
+
|
|
186
|
+
// hsl() should not have alpha
|
|
187
|
+
expect(() => schema.parse("hsl(180, 50%, 50%, 0.5)")).toThrow("Invalid color format")
|
|
188
|
+
// hsla() must have alpha
|
|
189
|
+
expect(() => schema.parse("hsla(180, 50%, 50%)")).toThrow("Invalid color format")
|
|
190
|
+
})
|
|
191
|
+
|
|
192
|
+
it("should reject malformed hsl strings", () => {
|
|
193
|
+
const schema = color(true)
|
|
194
|
+
|
|
195
|
+
expect(() => schema.parse("hsl(360, 100%)")).toThrow("Invalid color format")
|
|
196
|
+
expect(() => schema.parse("hsl(360)")).toThrow("Invalid color format")
|
|
197
|
+
expect(() => schema.parse("hsl()")).toThrow("Invalid color format")
|
|
198
|
+
expect(() => schema.parse("hsl(a, b%, c%)")).toThrow("Invalid color format")
|
|
199
|
+
})
|
|
200
|
+
})
|
|
201
|
+
|
|
202
|
+
describe("format filtering", () => {
|
|
203
|
+
it("should only accept hex when format is 'hex'", () => {
|
|
204
|
+
const schema = color(true, { format: "hex" })
|
|
205
|
+
|
|
206
|
+
expect(schema.parse("#ff0000")).toBe("#ff0000")
|
|
207
|
+
expect(schema.parse("#fff")).toBe("#fff")
|
|
208
|
+
expect(() => schema.parse("rgb(255, 0, 0)")).toThrow("Must be a valid hex color")
|
|
209
|
+
expect(() => schema.parse("hsl(0, 100%, 50%)")).toThrow("Must be a valid hex color")
|
|
210
|
+
})
|
|
211
|
+
|
|
212
|
+
it("should only accept rgb when format is 'rgb'", () => {
|
|
213
|
+
const schema = color(true, { format: "rgb" })
|
|
214
|
+
|
|
215
|
+
expect(schema.parse("rgb(255, 0, 0)")).toBe("rgb(255, 0, 0)")
|
|
216
|
+
expect(() => schema.parse("#ff0000")).toThrow("Must be a valid RGB color")
|
|
217
|
+
expect(() => schema.parse("hsl(0, 100%, 50%)")).toThrow("Must be a valid RGB color")
|
|
218
|
+
})
|
|
219
|
+
|
|
220
|
+
it("should only accept hsl when format is 'hsl'", () => {
|
|
221
|
+
const schema = color(true, { format: "hsl" })
|
|
222
|
+
|
|
223
|
+
expect(schema.parse("hsl(0, 100%, 50%)")).toBe("hsl(0, 100%, 50%)")
|
|
224
|
+
expect(() => schema.parse("#ff0000")).toThrow("Must be a valid HSL color")
|
|
225
|
+
expect(() => schema.parse("rgb(255, 0, 0)")).toThrow("Must be a valid HSL color")
|
|
226
|
+
})
|
|
227
|
+
|
|
228
|
+
it("should accept multiple formats when format is an array", () => {
|
|
229
|
+
const schema = color(true, { format: ["hex", "rgb"] })
|
|
230
|
+
|
|
231
|
+
expect(schema.parse("#ff0000")).toBe("#ff0000")
|
|
232
|
+
expect(schema.parse("rgb(255, 0, 0)")).toBe("rgb(255, 0, 0)")
|
|
233
|
+
expect(() => schema.parse("hsl(0, 100%, 50%)")).toThrow("Invalid color format")
|
|
234
|
+
})
|
|
235
|
+
|
|
236
|
+
it("should accept all formats when format is 'any' (default)", () => {
|
|
237
|
+
const schema = color(true)
|
|
238
|
+
|
|
239
|
+
expect(schema.parse("#ff0000")).toBe("#ff0000")
|
|
240
|
+
expect(schema.parse("rgb(255, 0, 0)")).toBe("rgb(255, 0, 0)")
|
|
241
|
+
expect(schema.parse("hsl(0, 100%, 50%)")).toBe("hsl(0, 100%, 50%)")
|
|
242
|
+
})
|
|
243
|
+
|
|
244
|
+
it("should accept hex and hsl when format is ['hex', 'hsl']", () => {
|
|
245
|
+
const schema = color(true, { format: ["hex", "hsl"] })
|
|
246
|
+
|
|
247
|
+
expect(schema.parse("#ff0000")).toBe("#ff0000")
|
|
248
|
+
expect(schema.parse("hsl(0, 100%, 50%)")).toBe("hsl(0, 100%, 50%)")
|
|
249
|
+
expect(() => schema.parse("rgb(255, 0, 0)")).toThrow("Invalid color format")
|
|
250
|
+
})
|
|
251
|
+
|
|
252
|
+
it("should accept rgb and hsl when format is ['rgb', 'hsl']", () => {
|
|
253
|
+
const schema = color(true, { format: ["rgb", "hsl"] })
|
|
254
|
+
|
|
255
|
+
expect(schema.parse("rgb(255, 0, 0)")).toBe("rgb(255, 0, 0)")
|
|
256
|
+
expect(schema.parse("hsl(0, 100%, 50%)")).toBe("hsl(0, 100%, 50%)")
|
|
257
|
+
expect(() => schema.parse("#ff0000")).toThrow("Invalid color format")
|
|
258
|
+
})
|
|
259
|
+
})
|
|
260
|
+
|
|
261
|
+
describe("alpha channel", () => {
|
|
262
|
+
it("should allow alpha by default (allowAlpha defaults to true)", () => {
|
|
263
|
+
const schema = color(true)
|
|
264
|
+
|
|
265
|
+
expect(schema.parse("#FF0000AA")).toBe("#FF0000AA")
|
|
266
|
+
expect(schema.parse("rgba(255, 0, 0, 0.5)")).toBe("rgba(255, 0, 0, 0.5)")
|
|
267
|
+
expect(schema.parse("hsla(180, 50%, 50%, 0.5)")).toBe("hsla(180, 50%, 50%, 0.5)")
|
|
268
|
+
})
|
|
269
|
+
|
|
270
|
+
it("should reject alpha when allowAlpha is false", () => {
|
|
271
|
+
const schema = color(true, { allowAlpha: false })
|
|
272
|
+
|
|
273
|
+
expect(() => schema.parse("#FF0000AA")).toThrow("Invalid color format")
|
|
274
|
+
expect(() => schema.parse("rgba(255, 0, 0, 0.5)")).toThrow("Invalid color format")
|
|
275
|
+
expect(() => schema.parse("hsla(180, 50%, 50%, 0.5)")).toThrow("Invalid color format")
|
|
276
|
+
})
|
|
277
|
+
|
|
278
|
+
it("should still accept non-alpha colors when allowAlpha is false", () => {
|
|
279
|
+
const schema = color(true, { allowAlpha: false })
|
|
280
|
+
|
|
281
|
+
expect(schema.parse("#ff0000")).toBe("#ff0000")
|
|
282
|
+
expect(schema.parse("#fff")).toBe("#fff")
|
|
283
|
+
expect(schema.parse("rgb(255, 0, 0)")).toBe("rgb(255, 0, 0)")
|
|
284
|
+
expect(schema.parse("hsl(180, 50%, 50%)")).toBe("hsl(180, 50%, 50%)")
|
|
285
|
+
})
|
|
286
|
+
|
|
287
|
+
it("should still accept non-alpha colors when allowAlpha is true", () => {
|
|
288
|
+
const schema = color(true, { allowAlpha: true })
|
|
289
|
+
|
|
290
|
+
expect(schema.parse("#ff0000")).toBe("#ff0000")
|
|
291
|
+
expect(schema.parse("#fff")).toBe("#fff")
|
|
292
|
+
expect(schema.parse("rgb(255, 0, 0)")).toBe("rgb(255, 0, 0)")
|
|
293
|
+
expect(schema.parse("hsl(180, 50%, 50%)")).toBe("hsl(180, 50%, 50%)")
|
|
294
|
+
})
|
|
295
|
+
|
|
296
|
+
it("should combine format and allowAlpha options", () => {
|
|
297
|
+
const schema = color(true, { format: "hex", allowAlpha: false })
|
|
298
|
+
|
|
299
|
+
expect(schema.parse("#ff0000")).toBe("#ff0000")
|
|
300
|
+
expect(() => schema.parse("#FF0000AA")).toThrow("Must be a valid hex color")
|
|
301
|
+
expect(() => schema.parse("rgb(255, 0, 0)")).toThrow("Must be a valid hex color")
|
|
302
|
+
})
|
|
303
|
+
})
|
|
304
|
+
|
|
305
|
+
describe("required/optional behavior", () => {
|
|
306
|
+
it("should require a value when required is true", () => {
|
|
307
|
+
const schema = color(true)
|
|
308
|
+
|
|
309
|
+
expect(() => schema.parse("")).toThrow("Required")
|
|
310
|
+
expect(() => schema.parse(null)).toThrow()
|
|
311
|
+
expect(() => schema.parse(undefined)).toThrow()
|
|
312
|
+
})
|
|
313
|
+
|
|
314
|
+
it("should allow null/empty when required is false", () => {
|
|
315
|
+
const schema = color(false)
|
|
316
|
+
|
|
317
|
+
expect(schema.parse("")).toBe(null)
|
|
318
|
+
expect(schema.parse(null)).toBe(null)
|
|
319
|
+
expect(schema.parse(undefined)).toBe(null)
|
|
320
|
+
})
|
|
321
|
+
|
|
322
|
+
it("should still validate when value is provided with required=false", () => {
|
|
323
|
+
const schema = color(false)
|
|
324
|
+
|
|
325
|
+
expect(schema.parse("#ff0000")).toBe("#ff0000")
|
|
326
|
+
expect(schema.parse("rgb(255, 0, 0)")).toBe("rgb(255, 0, 0)")
|
|
327
|
+
expect(() => schema.parse("not-a-color")).toThrow("Invalid color format")
|
|
328
|
+
})
|
|
329
|
+
|
|
330
|
+
it("should use default values for required schema", () => {
|
|
331
|
+
const schema = color(true, { defaultValue: "#000000" })
|
|
332
|
+
|
|
333
|
+
expect(schema.parse("")).toBe("#000000")
|
|
334
|
+
expect(schema.parse(null)).toBe("#000000")
|
|
335
|
+
expect(schema.parse(undefined)).toBe("#000000")
|
|
336
|
+
})
|
|
337
|
+
|
|
338
|
+
it("should use default values for optional schema", () => {
|
|
339
|
+
const schema = color(false, { defaultValue: "#ffffff" })
|
|
340
|
+
|
|
341
|
+
expect(schema.parse("")).toBe("#ffffff")
|
|
342
|
+
expect(schema.parse(null)).toBe("#ffffff")
|
|
343
|
+
expect(schema.parse(undefined)).toBe("#ffffff")
|
|
344
|
+
})
|
|
345
|
+
|
|
346
|
+
it("should handle 'null' and 'undefined' string inputs when required", () => {
|
|
347
|
+
const schema = color(true)
|
|
348
|
+
|
|
349
|
+
expect(() => schema.parse("null")).toThrow("Required")
|
|
350
|
+
expect(() => schema.parse("undefined")).toThrow("Required")
|
|
351
|
+
})
|
|
352
|
+
})
|
|
353
|
+
|
|
354
|
+
describe("transform function", () => {
|
|
355
|
+
it("should apply custom transform before validation", () => {
|
|
356
|
+
const schema = color(true, {
|
|
357
|
+
transform: (val) => val.toLowerCase(),
|
|
358
|
+
})
|
|
359
|
+
|
|
360
|
+
expect(schema.parse("#FF0000")).toBe("#ff0000")
|
|
361
|
+
expect(schema.parse("#ABCDEF")).toBe("#abcdef")
|
|
362
|
+
})
|
|
363
|
+
|
|
364
|
+
it("should apply transform that converts shorthand to full hex", () => {
|
|
365
|
+
const schema = color(true, {
|
|
366
|
+
transform: (val) => {
|
|
367
|
+
const shortHex = /^#([0-9a-f])([0-9a-f])([0-9a-f])$/i
|
|
368
|
+
const match = val.match(shortHex)
|
|
369
|
+
if (match) {
|
|
370
|
+
return `#${match[1]}${match[1]}${match[2]}${match[2]}${match[3]}${match[3]}`
|
|
371
|
+
}
|
|
372
|
+
return val
|
|
373
|
+
},
|
|
374
|
+
})
|
|
375
|
+
|
|
376
|
+
expect(schema.parse("#fff")).toBe("#ffffff")
|
|
377
|
+
expect(schema.parse("#abc")).toBe("#aabbcc")
|
|
378
|
+
expect(schema.parse("#ff0000")).toBe("#ff0000")
|
|
379
|
+
})
|
|
380
|
+
|
|
381
|
+
it("should apply transform before validation, not after", () => {
|
|
382
|
+
const schema = color(true, {
|
|
383
|
+
format: "hex",
|
|
384
|
+
transform: (val) => val.trim(),
|
|
385
|
+
})
|
|
386
|
+
|
|
387
|
+
expect(schema.parse(" #ff0000 ")).toBe("#ff0000")
|
|
388
|
+
})
|
|
389
|
+
})
|
|
390
|
+
|
|
391
|
+
describe("i18n support", () => {
|
|
392
|
+
it("should use English messages by default", () => {
|
|
393
|
+
setLocale("en-US")
|
|
394
|
+
const schema = color(true)
|
|
395
|
+
|
|
396
|
+
expect(() => schema.parse("")).toThrow("Required")
|
|
397
|
+
expect(() => schema.parse("not-a-color")).toThrow("Invalid color format")
|
|
398
|
+
})
|
|
399
|
+
|
|
400
|
+
it("should use Chinese messages when locale is zh-TW", () => {
|
|
401
|
+
setLocale("zh-TW")
|
|
402
|
+
const schema = color(true)
|
|
403
|
+
|
|
404
|
+
expect(() => schema.parse("")).toThrow("必填")
|
|
405
|
+
expect(() => schema.parse("not-a-color")).toThrow("無效的顏色格式")
|
|
406
|
+
})
|
|
407
|
+
|
|
408
|
+
it("should use format-specific Chinese messages", () => {
|
|
409
|
+
setLocale("zh-TW")
|
|
410
|
+
const hexSchema = color(true, { format: "hex" })
|
|
411
|
+
const rgbSchema = color(true, { format: "rgb" })
|
|
412
|
+
const hslSchema = color(true, { format: "hsl" })
|
|
413
|
+
|
|
414
|
+
expect(() => hexSchema.parse("not-a-color")).toThrow("必須為有效的十六進位顏色")
|
|
415
|
+
expect(() => rgbSchema.parse("not-a-color")).toThrow("必須為有效的 RGB 顏色")
|
|
416
|
+
expect(() => hslSchema.parse("not-a-color")).toThrow("必須為有效的 HSL 顏色")
|
|
417
|
+
})
|
|
418
|
+
|
|
419
|
+
it("should use format-specific English messages", () => {
|
|
420
|
+
setLocale("en-US")
|
|
421
|
+
const hexSchema = color(true, { format: "hex" })
|
|
422
|
+
const rgbSchema = color(true, { format: "rgb" })
|
|
423
|
+
const hslSchema = color(true, { format: "hsl" })
|
|
424
|
+
|
|
425
|
+
expect(() => hexSchema.parse("not-a-color")).toThrow("Must be a valid hex color")
|
|
426
|
+
expect(() => rgbSchema.parse("not-a-color")).toThrow("Must be a valid RGB color")
|
|
427
|
+
expect(() => hslSchema.parse("not-a-color")).toThrow("Must be a valid HSL color")
|
|
428
|
+
})
|
|
429
|
+
|
|
430
|
+
it("should support custom i18n messages", () => {
|
|
431
|
+
const schema = color(true, {
|
|
432
|
+
i18n: {
|
|
433
|
+
"en-US": {
|
|
434
|
+
required: "Color is required",
|
|
435
|
+
invalid: "Please enter a valid color",
|
|
436
|
+
notHex: "Only hex colors allowed",
|
|
437
|
+
notRgb: "Only RGB colors allowed",
|
|
438
|
+
notHsl: "Only HSL colors allowed",
|
|
439
|
+
},
|
|
440
|
+
"zh-TW": {
|
|
441
|
+
required: "請輸入顏色",
|
|
442
|
+
invalid: "請輸入有效的顏色",
|
|
443
|
+
},
|
|
444
|
+
},
|
|
445
|
+
})
|
|
446
|
+
|
|
447
|
+
setLocale("en-US")
|
|
448
|
+
expect(() => schema.parse("")).toThrow("Color is required")
|
|
449
|
+
expect(() => schema.parse("not-a-color")).toThrow("Please enter a valid color")
|
|
450
|
+
|
|
451
|
+
setLocale("zh-TW")
|
|
452
|
+
expect(() => schema.parse("")).toThrow("請輸入顏色")
|
|
453
|
+
expect(() => schema.parse("not-a-color")).toThrow("請輸入有效的顏色")
|
|
454
|
+
})
|
|
455
|
+
|
|
456
|
+
it("should use custom format-specific i18n messages", () => {
|
|
457
|
+
const schema = color(true, {
|
|
458
|
+
format: "hex",
|
|
459
|
+
i18n: {
|
|
460
|
+
"en-US": {
|
|
461
|
+
notHex: "Only hex format is supported",
|
|
462
|
+
},
|
|
463
|
+
},
|
|
464
|
+
})
|
|
465
|
+
|
|
466
|
+
setLocale("en-US")
|
|
467
|
+
expect(() => schema.parse("rgb(255, 0, 0)")).toThrow("Only hex format is supported")
|
|
468
|
+
})
|
|
469
|
+
|
|
470
|
+
it("should fall back to default messages when custom i18n does not cover the key", () => {
|
|
471
|
+
const schema = color(true, {
|
|
472
|
+
i18n: {
|
|
473
|
+
"en-US": {
|
|
474
|
+
required: "Custom required message",
|
|
475
|
+
},
|
|
476
|
+
},
|
|
477
|
+
})
|
|
478
|
+
|
|
479
|
+
setLocale("en-US")
|
|
480
|
+
expect(() => schema.parse("")).toThrow("Custom required message")
|
|
481
|
+
expect(() => schema.parse("not-a-color")).toThrow("Invalid color format")
|
|
482
|
+
})
|
|
483
|
+
})
|
|
484
|
+
|
|
485
|
+
describe("edge cases", () => {
|
|
486
|
+
it("should reject completely invalid color strings", () => {
|
|
487
|
+
const schema = color(true)
|
|
488
|
+
|
|
489
|
+
expect(() => schema.parse("red")).toThrow("Invalid color format")
|
|
490
|
+
expect(() => schema.parse("blue")).toThrow("Invalid color format")
|
|
491
|
+
expect(() => schema.parse("not-a-color")).toThrow("Invalid color format")
|
|
492
|
+
expect(() => schema.parse("123")).toThrow("Invalid color format")
|
|
493
|
+
expect(() => schema.parse("true")).toThrow("Invalid color format")
|
|
494
|
+
})
|
|
495
|
+
|
|
496
|
+
it("should handle whitespace trimming", () => {
|
|
497
|
+
const schema = color(true)
|
|
498
|
+
|
|
499
|
+
expect(schema.parse(" #ff0000 ")).toBe("#ff0000")
|
|
500
|
+
expect(schema.parse("\t#fff\n")).toBe("#fff")
|
|
501
|
+
expect(schema.parse(" rgb(255, 0, 0) ")).toBe("rgb(255, 0, 0)")
|
|
502
|
+
})
|
|
503
|
+
|
|
504
|
+
it("should handle empty and whitespace inputs for required schema", () => {
|
|
505
|
+
const schema = color(true)
|
|
506
|
+
|
|
507
|
+
expect(() => schema.parse("")).toThrow("Required")
|
|
508
|
+
expect(() => schema.parse(" ")).toThrow("Required")
|
|
509
|
+
expect(() => schema.parse("\t\n")).toThrow("Required")
|
|
510
|
+
})
|
|
511
|
+
|
|
512
|
+
it("should handle empty and whitespace inputs for optional schema", () => {
|
|
513
|
+
const schema = color(false)
|
|
514
|
+
|
|
515
|
+
expect(schema.parse("")).toBe(null)
|
|
516
|
+
expect(schema.parse(" ")).toBe(null)
|
|
517
|
+
expect(schema.parse("\t\n")).toBe(null)
|
|
518
|
+
})
|
|
519
|
+
|
|
520
|
+
it("should handle string coercion from non-string types", () => {
|
|
521
|
+
const schema = color(true)
|
|
522
|
+
|
|
523
|
+
expect(() => schema.parse(123)).toThrow("Invalid color format")
|
|
524
|
+
expect(() => schema.parse(true)).toThrow()
|
|
525
|
+
expect(() => schema.parse(false)).toThrow()
|
|
526
|
+
})
|
|
527
|
+
|
|
528
|
+
it("should reject hex with invalid characters", () => {
|
|
529
|
+
const schema = color(true, { format: "hex" })
|
|
530
|
+
|
|
531
|
+
expect(() => schema.parse("#gg0000")).toThrow("Must be a valid hex color")
|
|
532
|
+
expect(() => schema.parse("#xyz")).toThrow("Must be a valid hex color")
|
|
533
|
+
expect(() => schema.parse("#GHIJKL")).toThrow("Must be a valid hex color")
|
|
534
|
+
})
|
|
535
|
+
|
|
536
|
+
it("should reject hex with wrong digit counts", () => {
|
|
537
|
+
const schema = color(true, { format: "hex" })
|
|
538
|
+
|
|
539
|
+
expect(() => schema.parse("#12345")).toThrow("Must be a valid hex color")
|
|
540
|
+
expect(() => schema.parse("#1")).toThrow("Must be a valid hex color")
|
|
541
|
+
expect(() => schema.parse("#12")).toThrow("Must be a valid hex color")
|
|
542
|
+
expect(() => schema.parse("#1234")).toThrow("Must be a valid hex color")
|
|
543
|
+
expect(() => schema.parse("#1234567")).toThrow("Must be a valid hex color")
|
|
544
|
+
})
|
|
545
|
+
|
|
546
|
+
it("should reject rgb with out-of-range channel values", () => {
|
|
547
|
+
const schema = color(true, { format: "rgb" })
|
|
548
|
+
|
|
549
|
+
expect(() => schema.parse("rgb(256, 0, 0)")).toThrow("Must be a valid RGB color")
|
|
550
|
+
expect(() => schema.parse("rgb(-1, 0, 0)")).toThrow("Must be a valid RGB color")
|
|
551
|
+
expect(() => schema.parse("rgb(0, 300, 0)")).toThrow("Must be a valid RGB color")
|
|
552
|
+
expect(() => schema.parse("rgb(0, 0, 999)")).toThrow("Must be a valid RGB color")
|
|
553
|
+
})
|
|
554
|
+
|
|
555
|
+
it("should reject hsl with out-of-range values", () => {
|
|
556
|
+
const schema = color(true, { format: "hsl" })
|
|
557
|
+
|
|
558
|
+
expect(() => schema.parse("hsl(361, 100%, 50%)")).toThrow("Must be a valid HSL color")
|
|
559
|
+
expect(() => schema.parse("hsl(0, 101%, 50%)")).toThrow("Must be a valid HSL color")
|
|
560
|
+
expect(() => schema.parse("hsl(0, 100%, 101%)")).toThrow("Must be a valid HSL color")
|
|
561
|
+
expect(() => schema.parse("hsl(-1, 50%, 50%)")).toThrow("Must be a valid HSL color")
|
|
562
|
+
})
|
|
563
|
+
|
|
564
|
+
it("should handle boundary values for rgb", () => {
|
|
565
|
+
const schema = color(true, { format: "rgb" })
|
|
566
|
+
|
|
567
|
+
expect(schema.parse("rgb(0, 0, 0)")).toBe("rgb(0, 0, 0)")
|
|
568
|
+
expect(schema.parse("rgb(255, 255, 255)")).toBe("rgb(255, 255, 255)")
|
|
569
|
+
})
|
|
570
|
+
|
|
571
|
+
it("should handle boundary values for hsl", () => {
|
|
572
|
+
const schema = color(true, { format: "hsl" })
|
|
573
|
+
|
|
574
|
+
expect(schema.parse("hsl(0, 0%, 0%)")).toBe("hsl(0, 0%, 0%)")
|
|
575
|
+
expect(schema.parse("hsl(360, 100%, 100%)")).toBe("hsl(360, 100%, 100%)")
|
|
576
|
+
})
|
|
577
|
+
|
|
578
|
+
it("should handle boundary values for alpha", () => {
|
|
579
|
+
const schema = color(true, { allowAlpha: true })
|
|
580
|
+
|
|
581
|
+
expect(schema.parse("rgba(255, 0, 0, 0)")).toBe("rgba(255, 0, 0, 0)")
|
|
582
|
+
expect(schema.parse("rgba(255, 0, 0, 1)")).toBe("rgba(255, 0, 0, 1)")
|
|
583
|
+
expect(schema.parse("hsla(180, 50%, 50%, 0)")).toBe("hsla(180, 50%, 50%, 0)")
|
|
584
|
+
expect(schema.parse("hsla(180, 50%, 50%, 1)")).toBe("hsla(180, 50%, 50%, 1)")
|
|
585
|
+
})
|
|
586
|
+
})
|
|
587
|
+
})
|