1use once_cell::sync::Lazy;
9use std::collections::HashMap;
10
11static PROPERTIES: &[(&str, &str)] = &[
13 ("accent-color", "accent"),
14 ("align-content", "algn-c"),
15 ("align-items", "algn-i"),
16 ("align-self", "algn-s"),
17 ("align-tracks", "algn-t"),
18 ("all", "all"),
19 ("anchor-name", "anch-n"),
20 ("anchor-scope", "anch-s"),
21 ("animation", "anim"),
22 ("animation-composition", "anim-comp"),
23 ("animation-delay", "anim-dl"),
24 ("animation-direction", "anim-dir"),
25 ("animation-duration", "anim-dur"),
26 ("animation-fill-mode", "anim-f-m"),
27 ("animation-iteration-count", "anim-i-c"),
28 ("animation-name", "anim-n"),
29 ("animation-play-state", "anim-p-s"),
30 ("animation-range", "anim-r"),
31 ("animation-range-end", "anim-r-e"),
32 ("animation-range-start", "anim-r-s"),
33 ("animation-timeline", "anim-tl"),
34 ("animation-timing-function", "anim-t-f"),
35 ("appearance", "apr"),
36 ("aspect-ratio", "asp-r"),
37 ("backdrop-filter", "bdrop-f"),
38 ("backface-visibility", "bf-vis"),
39 ("background", "bg"),
40 ("background-attachment", "bg-a"),
41 ("background-blend-mode", "bg-b-m"),
42 ("background-clip", "bg-clip"),
43 ("background-color", "bg-c"),
44 ("background-image", "bg-img"),
45 ("background-origin", "bg-o"),
46 ("background-position", "bg-pos"),
47 ("background-position-x", "bg-pos-x"),
48 ("background-position-y", "bg-pos-y"),
49 ("background-repeat", "bg-rep"),
50 ("background-size", "bg-sz"),
51 ("block-size", "blk-sz"),
52 ("border", "bd"),
53 ("border-block", "bd-blk"),
54 ("border-block-color", "bd-blk-c"),
55 ("border-block-end", "bd-blk-e"),
56 ("border-block-end-color", "bd-blk-e-c"),
57 ("border-block-end-style", "bd-blk-e-s"),
58 ("border-block-end-width", "bd-blk-e-w"),
59 ("border-block-start", "bd-blk-s"),
60 ("border-block-start-color", "bd-blk-s-c"),
61 ("border-block-start-style", "bd-blk-s-s"),
62 ("border-block-start-width", "bd-blk-s-w"),
63 ("border-block-style", "bd-blk-st"),
64 ("border-block-width", "bd-blk-w"),
65 ("border-bottom", "bd-b"),
66 ("border-bottom-color", "bd-b-c"),
67 ("border-bottom-left-radius", "bd-b-l-rad"),
68 ("border-bottom-right-radius", "bd-b-r-rad"),
69 ("border-bottom-style", "bd-b-st"),
70 ("border-bottom-width", "bd-b-w"),
71 ("border-collapse", "bd-clps"),
72 ("border-color", "bd-c"),
73 ("border-end-end-radius", "bd-e-e-rad"),
74 ("border-end-start-radius", "bd-e-s-rad"),
75 ("border-image", "bd-img"),
76 ("border-image-outset", "bd-img-o"),
77 ("border-image-repeat", "bd-img-rep"),
78 ("border-image-slice", "bd-img-sl"),
79 ("border-image-source", "bd-img-src"),
80 ("border-image-width", "bd-img-w"),
81 ("border-inline", "bd-inl"),
82 ("border-inline-color", "bd-inl-c"),
83 ("border-inline-end", "bd-inl-e"),
84 ("border-inline-end-color", "bd-inl-e-c"),
85 ("border-inline-end-style", "bd-inl-e-s"),
86 ("border-inline-end-width", "bd-inl-e-w"),
87 ("border-inline-start", "bd-inl-s"),
88 ("border-inline-start-color", "bd-inl-s-c"),
89 ("border-inline-start-style", "bd-inl-s-s"),
90 ("border-inline-start-width", "bd-inl-s-w"),
91 ("border-inline-style", "bd-inl-st"),
92 ("border-inline-width", "bd-inl-w"),
93 ("border-left", "bd-l"),
94 ("border-left-color", "bd-l-c"),
95 ("border-left-style", "bd-l-st"),
96 ("border-left-width", "bd-l-w"),
97 ("border-radius", "bd-rad"),
98 ("border-right", "bd-r"),
99 ("border-right-color", "bd-r-c"),
100 ("border-right-style", "bd-r-st"),
101 ("border-right-width", "bd-r-w"),
102 ("border-spacing", "bd-sp"),
103 ("border-start-end-radius", "bd-s-e-rad"),
104 ("border-start-start-radius", "bd-s-s-rad"),
105 ("border-style", "bd-st"),
106 ("border-top", "bd-t"),
107 ("border-top-color", "bd-t-c"),
108 ("border-top-left-radius", "bd-t-l-rad"),
109 ("border-top-right-radius", "bd-t-r-rad"),
110 ("border-top-style", "bd-t-st"),
111 ("border-top-width", "bd-t-w"),
112 ("border-width", "bd-w"),
113 ("bottom", "bot"),
114 ("box-align", "box-algn"),
115 ("box-decoration-break", "box-d-b"),
116 ("box-direction", "box-dir"),
117 ("box-flex", "box-flex"),
118 ("box-flex-group", "box-flex-g"),
119 ("box-lines", "box-lns"),
120 ("box-ordinal-group", "box-ord-g"),
121 ("box-orient", "box-orient"),
122 ("box-pack", "box-pack"),
123 ("box-shadow", "box-shd"),
124 ("box-sizing", "box-sz"),
125 ("break-after", "brk-a"),
126 ("break-before", "brk-b"),
127 ("break-inside", "brk-i"),
128 ("caption-side", "cap-s"),
129 ("caret", "caret"),
130 ("caret-color", "caret-c"),
131 ("caret-shape", "caret-s"),
132 ("clear", "clr"),
133 ("clip", "clip"),
134 ("clip-path", "clip-p"),
135 ("color", "c"),
136 ("color-scheme", "c-sch"),
137 ("column-count", "col-c"),
138 ("column-fill", "col-f"),
139 ("column-gap", "col-g"),
140 ("column-rule", "col-r"),
141 ("column-rule-color", "col-r-c"),
142 ("column-rule-style", "col-r-s"),
143 ("column-rule-width", "col-r-w"),
144 ("column-span", "col-s"),
145 ("column-width", "col-w"),
146 ("columns", "cols"),
147 ("contain", "ctn"),
148 ("contain-intrinsic-block-size", "ctn-i-blk-sz"),
149 ("contain-intrinsic-height", "ctn-i-h"),
150 ("contain-intrinsic-inline-size", "ctn-i-inl-sz"),
151 ("contain-intrinsic-size", "ctn-i-sz"),
152 ("contain-intrinsic-width", "ctn-i-w"),
153 ("container", "ctnr"),
154 ("container-name", "ctnr-n"),
155 ("container-type", "ctnr-t"),
156 ("content", "cnt"),
157 ("content-visibility", "cnt-vis"),
158 ("counter-increment", "ctr-i"),
159 ("counter-reset", "ctr-r"),
160 ("counter-set", "ctr-s"),
161 ("cursor", "cur"),
162 ("direction", "dir"),
163 ("display", "disp"),
164 ("empty-cells", "empty-c"),
165 ("field-sizing", "field-sz"),
166 ("filter", "fltr"),
167 ("flex", "flex"),
168 ("flex-basis", "flex-b"),
169 ("flex-direction", "flex-dir"),
170 ("flex-flow", "flex-flow"),
171 ("flex-grow", "flex-g"),
172 ("flex-shrink", "flex-s"),
173 ("flex-wrap", "flex-w"),
174 ("float", "flt"),
175 ("font", "font"),
176 ("font-family", "font-f"),
177 ("font-feature-settings", "font-f-s"),
178 ("font-kerning", "font-k"),
179 ("font-language-override", "font-l-o"),
180 ("font-optical-sizing", "font-o-s"),
181 ("font-palette", "font-p"),
182 ("font-size", "font-sz"),
183 ("font-size-adjust", "font-sz-a"),
184 ("font-smooth", "font-smooth"),
185 ("font-stretch", "font-str"),
186 ("font-style", "font-st"),
187 ("font-synthesis", "font-syn"),
188 ("font-synthesis-position", "font-syn-p"),
189 ("font-synthesis-small-caps", "font-syn-s-c"),
190 ("font-synthesis-style", "font-syn-st"),
191 ("font-synthesis-weight", "font-syn-w"),
192 ("font-variant", "font-v"),
193 ("font-variant-alternates", "font-v-alt"),
194 ("font-variant-caps", "font-v-cap"),
195 ("font-variant-east-asian", "font-v-e-a"),
196 ("font-variant-emoji", "font-v-e"),
197 ("font-variant-ligatures", "font-v-lig"),
198 ("font-variant-numeric", "font-v-num"),
199 ("font-variant-position", "font-v-pos"),
200 ("font-variation-settings", "font-var-s"),
201 ("font-weight", "font-w"),
202 ("forced-color-adjust", "force-c-a"),
203 ("gap", "gap"),
204 ("grid", "grid"),
205 ("grid-area", "grid-a"),
206 ("grid-auto-columns", "grid-a-c"),
207 ("grid-auto-flow", "grid-a-f"),
208 ("grid-auto-rows", "grid-a-r"),
209 ("grid-column", "grid-c"),
210 ("grid-column-end", "grid-c-e"),
211 ("grid-column-gap", "grid-c-g"),
212 ("grid-column-start", "grid-c-s"),
213 ("grid-gap", "grid-g"),
214 ("grid-row", "grid-r"),
215 ("grid-row-end", "grid-r-e"),
216 ("grid-row-gap", "grid-r-g"),
217 ("grid-row-start", "grid-r-s"),
218 ("grid-template", "grid-t"),
219 ("grid-template-areas", "grid-t-a"),
220 ("grid-template-columns", "grid-t-c"),
221 ("grid-template-rows", "grid-t-r"),
222 ("hanging-punctuation", "hang-p"),
223 ("height", "h"),
224 ("hyphenate-character", "hyph-c"),
225 ("hyphenate-limit-chars", "hyph-l-c"),
226 ("hyphens", "hyph"),
227 ("image-orientation", "img-o"),
228 ("image-rendering", "img-rnd"),
229 ("image-resolution", "img-res"),
230 ("ime-mode", "ime-mode"),
231 ("initial-letter", "init-l"),
232 ("initial-letter-align", "init-la"),
233 ("inline-size", "inl-sz"),
234 ("input-security", "inp-sec"),
235 ("inset", "inset"),
236 ("inset-area", "inset-a"),
237 ("inset-block", "inset-b"),
238 ("inset-block-end", "inset-b-e"),
239 ("inset-block-start", "inset-b-s"),
240 ("inset-inline", "inset-i"),
241 ("inset-inline-end", "inset-i-e"),
242 ("inset-inline-start", "inset-i-s"),
243 ("isolation", "iso"),
244 ("justify-content", "just-c"),
245 ("justify-items", "just-i"),
246 ("justify-self", "just-s"),
247 ("justify-tracks", "just-t"),
248 ("left", "l"),
249 ("letter-spacing", "let-sp"),
250 ("line-break", "ln-brk"),
251 ("line-clamp", "ln-clmp"),
252 ("line-height", "ln-h"),
253 ("line-height-step", "ln-h-step"),
254 ("list-style", "lst-s"),
255 ("list-style-image", "lst-img"),
256 ("list-style-position", "lst-pos"),
257 ("list-style-type", "lst-type"),
258 ("margin", "m"),
259 ("margin-block", "m-blk"),
260 ("margin-block-end", "m-blk-e"),
261 ("margin-block-start", "m-blk-s"),
262 ("margin-bottom", "m-b"),
263 ("margin-inline", "m-inl"),
264 ("margin-inline-end", "m-inl-e"),
265 ("margin-inline-start", "m-inl-s"),
266 ("margin-left", "m-l"),
267 ("margin-right", "m-r"),
268 ("margin-top", "m-t"),
269 ("margin-trim", "m-trim"),
270 ("mask", "mask"),
271 ("mask-border", "mask-bd"),
272 ("mask-border-mode", "mask-bd-m"),
273 ("mask-border-outset", "mask-bd-o"),
274 ("mask-border-repeat", "mask-bd-rep"),
275 ("mask-border-slice", "mask-bd-sl"),
276 ("mask-border-source", "mask-bd-src"),
277 ("mask-border-width", "mask-bd-w"),
278 ("mask-clip", "mask-clip"),
279 ("mask-composite", "mask-comp"),
280 ("mask-image", "mask-img"),
281 ("mask-mode", "mask-m"),
282 ("mask-origin", "mask-o"),
283 ("mask-position", "mask-pos"),
284 ("mask-repeat", "mask-rep"),
285 ("mask-size", "mask-sz"),
286 ("mask-type", "mask-t"),
287 ("masonry-auto-flow", "mason-af"),
288 ("math-depth", "math-d"),
289 ("math-shift", "math-s"),
290 ("math-style", "math-st"),
291 ("max-block-size", "max-blk-sz"),
292 ("max-height", "max-h"),
293 ("max-inline-size", "max-i-sz"),
294 ("max-lines", "max-ln"),
295 ("max-width", "max-w"),
296 ("min-block-size", "min-blk-sz"),
297 ("min-height", "min-h"),
298 ("min-inline-size", "min-i-sz"),
299 ("min-width", "min-w"),
300 ("mix-blend-mode", "mix-b-m"),
301 ("object-fit", "obj-fit"),
302 ("object-position", "obj-pos"),
303 ("offset", "ofs"),
304 ("offset-anchor", "ofs-a"),
305 ("offset-distance", "ofs-d"),
306 ("offset-path", "ofs-p"),
307 ("offset-position", "ofs-pos"),
308 ("offset-rotate", "ofs-r"),
309 ("opacity", "op"),
310 ("order", "order"),
311 ("orphans", "orph"),
312 ("outline", "ol"),
313 ("outline-color", "ol-c"),
314 ("outline-offset", "ol-o"),
315 ("outline-style", "ol-s"),
316 ("outline-width", "ol-w"),
317 ("overflow", "ovf"),
318 ("overflow-anchor", "ovf-a"),
319 ("overflow-block", "ovf-b"),
320 ("overflow-clip-box", "ovf-c-box"),
321 ("overflow-clip-margin", "ovf-c-m"),
322 ("overflow-inline", "ovf-i"),
323 ("overflow-wrap", "ovf-w"),
324 ("overflow-x", "ovf-x"),
325 ("overflow-y", "ovf-y"),
326 ("overlay", "overlay"),
327 ("overscroll-behavior", "ovsc-b"),
328 ("overscroll-behavior-block", "ovsc-b-blk"),
329 ("overscroll-behavior-inline", "ovsc-b-inl"),
330 ("overscroll-behavior-x", "ovsc-b-x"),
331 ("overscroll-behavior-y", "ovsc-b-y"),
332 ("padding", "p"),
333 ("padding-block", "p-blk"),
334 ("padding-block-end", "p-blk-e"),
335 ("padding-block-start", "p-blk-s"),
336 ("padding-bottom", "pb"),
337 ("padding-inline", "p-inl"),
338 ("padding-inline-end", "p-inl-e"),
339 ("padding-inline-start", "p-inl-s"),
340 ("padding-left", "pl"),
341 ("padding-right", "pr"),
342 ("padding-top", "pt"),
343 ("page", "page"),
344 ("page-break-after", "pg-brk-a"),
345 ("page-break-before", "pg-brk-b"),
346 ("page-break-inside", "pg-brk-i"),
347 ("paint-order", "paint-o"),
348 ("perspective", "persp"),
349 ("perspective-origin", "persp-o"),
350 ("place-content", "place-c"),
351 ("place-items", "place-i"),
352 ("place-self", "place-s"),
353 ("pointer-events", "ptr-e"),
354 ("position", "pos"),
355 ("position-anchor", "pos-anch"),
356 ("position-try", "pos-try"),
357 ("position-try-options", "pos-try-opt"),
358 ("position-try-order", "pos-try-ord"),
359 ("position-visibility", "pos-vis"),
360 ("print-color-adjust", "print-c-a"),
361 ("quotes", "q"),
362 ("resize", "rsz"),
363 ("right", "r"),
364 ("rotate", "rot"),
365 ("row-gap", "row-g"),
366 ("ruby-align", "ruby-a"),
367 ("ruby-merge", "ruby-m"),
368 ("ruby-position", "ruby-p"),
369 ("scale", "scl"),
370 ("scroll-behavior", "scrl-b"),
371 ("scroll-margin", "scrl-m"),
372 ("scroll-margin-block", "scrl-m-blk"),
373 ("scroll-margin-block-end", "scrl-m-blk-e"),
374 ("scroll-margin-block-start", "scrl-m-blk-s"),
375 ("scroll-margin-bottom", "scrl-m-b"),
376 ("scroll-margin-inline", "scrl-m-inl"),
377 ("scroll-margin-inline-end", "scrl-m-inl-e"),
378 ("scroll-margin-inline-start", "scrl-m-inl-s"),
379 ("scroll-margin-left", "scrl-m-l"),
380 ("scroll-margin-right", "scrl-m-r"),
381 ("scroll-margin-top", "scrl-m-t"),
382 ("scroll-padding", "scrl-p"),
383 ("scroll-padding-block", "scrl-p-blk"),
384 ("scroll-padding-block-end", "scrl-p-blk-e"),
385 ("scroll-padding-block-start", "scrl-p-blk-s"),
386 ("scroll-padding-bottom", "scrl-p-b"),
387 ("scroll-padding-inline", "scrl-p-inl"),
388 ("scroll-padding-inline-end", "scrl-p-inl-e"),
389 ("scroll-padding-inline-start", "scrl-p-inl-s"),
390 ("scroll-padding-left", "scrl-p-l"),
391 ("scroll-padding-right", "scrl-p-r"),
392 ("scroll-padding-top", "scrl-p-t"),
393 ("scroll-snap-align", "scrl-s-a"),
394 ("scroll-snap-coordinate", "scrl-s-coord"),
395 ("scroll-snap-destination", "scrl-s-dest"),
396 ("scroll-snap-points-x", "scrl-s-p-x"),
397 ("scroll-snap-points-y", "scrl-s-p-y"),
398 ("scroll-snap-stop", "scrl-s-stop"),
399 ("scroll-snap-type", "scrl-s-type"),
400 ("scroll-timeline", "scrl-tl"),
401 ("scroll-timeline-axis", "scrl-tl-a"),
402 ("scroll-timeline-name", "scrl-tl-n"),
403 ("scrollbar-color", "scrlbar-c"),
404 ("scrollbar-gutter", "scrlbar-g"),
405 ("scrollbar-width", "scrlbar-w"),
406 ("shape-image-threshold", "shp-i-t"),
407 ("shape-margin", "shp-m"),
408 ("shape-outside", "shp-o"),
409 ("tab-size", "tab-sz"),
410 ("table-layout", "tbl-l"),
411 ("text-align", "txt-a"),
412 ("text-align-last", "txt-a-last"),
413 ("text-combine-upright", "txt-comb-u"),
414 ("text-decoration", "txt-d"),
415 ("text-decoration-color", "txt-d-c"),
416 ("text-decoration-line", "txt-d-l"),
417 ("text-decoration-skip", "txt-d-skip"),
418 ("text-decoration-skip-ink", "txt-d-skip-ink"),
419 ("text-decoration-style", "txt-d-st"),
420 ("text-decoration-thickness", "txt-d-thick"),
421 ("text-emphasis", "txt-emph"),
422 ("text-emphasis-color", "txt-emph-c"),
423 ("text-emphasis-position", "txt-emph-p"),
424 ("text-emphasis-style", "txt-emph-s"),
425 ("text-indent", "txt-i"),
426 ("text-justify", "txt-just"),
427 ("text-orientation", "txt-or"),
428 ("text-overflow", "txt-ovf"),
429 ("text-rendering", "txt-rnd"),
430 ("text-shadow", "txt-shd"),
431 ("text-size-adjust", "txt-sa"),
432 ("text-spacing-trim", "txt-spc-t"),
433 ("text-transform", "txt-tf"),
434 ("text-underline-offset", "txt-u-offset"),
435 ("text-underline-position", "txt-u-pos"),
436 ("text-wrap", "txt-wrap"),
437 ("text-wrap-mode", "txt-wrap-m"),
438 ("text-wrap-style", "txt-wrap-s"),
439 ("timeline-scope", "tl-scope"),
440 ("top", "t"),
441 ("touch-action", "tch-a"),
442 ("transform", "tf"),
443 ("transform-box", "tf-box"),
444 ("transform-origin", "tf-o"),
445 ("transform-style", "tf-s"),
446 ("transition", "trs"),
447 ("transition-behavior", "trs-b"),
448 ("transition-delay", "trs-d"),
449 ("transition-duration", "trs-dur"),
450 ("transition-property", "trs-p"),
451 ("transition-timing-function", "trs-t-f"),
452 ("translate", "trl"),
453 ("unicode-bidi", "uni-bidi"),
454 ("user-select", "usr-sel"),
455 ("vertical-align", "v-align"),
456 ("view-timeline", "view-tl"),
457 ("view-timeline-axis", "view-tl-a"),
458 ("view-timeline-inset", "view-tl-i"),
459 ("view-timeline-name", "view-tl-n"),
460 ("view-transition-name", "view-trs-n"),
461 ("visibility", "vis"),
462 ("white-space", "w-s"),
463 ("white-space-collapse", "w-s-coll"),
464 ("widows", "widows"),
465 ("width", "w"),
466 ("will-change", "will-c"),
467 ("word-break", "wrd-brk"),
468 ("word-spacing", "wrd-sp"),
469 ("word-wrap", "wrd-wrap"),
470 ("writing-mode", "w-mode"),
471 ("z-index", "z"),
472 ("zoom", "zoom"),
473 ("g-anim", "g-anim"),
476];
477
478static COMPONENTS_MAP: Lazy<HashMap<&'static str, &'static str>> = Lazy::new(|| {
480 let mut m = HashMap::new();
481 for &(full_name, abbreviation) in PROPERTIES.iter() {
482 m.insert(full_name, full_name);
483 m.insert(abbreviation, full_name);
484 }
485 m
486});
487
488static FULL_TO_SHORT_MAP: Lazy<HashMap<&'static str, &'static str>> =
490 Lazy::new(|| PROPERTIES.iter().cloned().collect());
491
492static ALL_COMPONENTS: Lazy<Vec<&'static str>> =
494 Lazy::new(|| COMPONENTS_MAP.keys().cloned().collect());
495
496pub fn get_css_property(component_str: &str) -> Option<&'static str> {
508 COMPONENTS_MAP.get(component_str).cloned()
509}
510
511pub fn get_shorten_component(full_name: &str) -> Option<&'static str> {
521 FULL_TO_SHORT_MAP.get(full_name).cloned()
522}
523
524pub fn get_all_components() -> &'static [&'static str] {
530 ALL_COMPONENTS.as_slice()
531}
532
533pub fn get_all_components_map() -> HashMap<&'static str, &'static str> {
534 PROPERTIES.iter().cloned().collect()
535}
536
537#[cfg(test)]
538mod tests {
539 use std::collections::HashSet;
540
541 use super::*;
542
543 #[test]
544 fn test_get_css_property_full_name() {
545 assert_eq!(get_css_property("accent-color"), Some("accent-color"));
546 assert_eq!(get_css_property("align-items"), Some("align-items"));
547 }
548
549 #[test]
550 fn test_get_css_property_abbreviation() {
551 assert_eq!(get_css_property("accent"), Some("accent-color"));
552 assert_eq!(get_css_property("algn-i"), Some("align-items"));
553 }
554
555 #[test]
556 fn test_get_css_property_unknown() {
557 assert_eq!(get_css_property("unknown"), None);
558 assert_eq!(get_css_property("xyz"), None);
559 }
560
561 #[test]
562 fn test_get_shorten_component() {
563 assert_eq!(get_shorten_component("accent-color"), Some("accent"));
564 assert_eq!(get_shorten_component("align-items"), Some("algn-i"));
565 }
566
567 #[test]
568 fn test_get_shorten_component_unknown() {
569 assert_eq!(get_shorten_component("unknown-property"), None);
570 assert_eq!(get_shorten_component("acc"), None); }
572
573 #[test]
574 fn test_get_all_components() {
575 let components = get_all_components();
576 assert!(components.contains(&"accent-color"));
577 assert!(components.contains(&"accent"));
578 assert!(components.contains(&"align-items"));
579 assert!(components.contains(&"algn-i"));
580 assert!(!components.contains(&"unknown"));
581 }
582
583 #[test]
584 fn test_get_css_property_case_sensitive() {
585 assert_eq!(get_css_property("Acc"), None);
587 assert_eq!(get_css_property("ACC"), None);
588 }
589
590 #[test]
591 fn test_get_shorten_component_case_sensitive() {
592 assert_eq!(get_shorten_component("Accent-Color"), None);
593 assert_eq!(get_shorten_component("ACCENT-COLOR"), None);
594 }
595
596 #[test]
597 fn test_unique_shortening() {
598 let mut seen = HashSet::new();
599 for &(_, abbreviation) in PROPERTIES.iter() {
600 assert!(
601 seen.insert(abbreviation),
602 "Duplicate abbreviation found: {}",
603 abbreviation
604 );
605 }
606 }
607}