UNPKG

1.13 kBSCSSView Raw
1@use '../theme';
2
3$origin-theme: (
4 one: 1,
5 two: '22',
6 three: 3px,
7 four: (
8 x: 1,
9 y: 2,
10 ),
11);
12
13// Should validate when subset of keys are provided.
14@include theme.validate-theme(
15 $origin-theme,
16 (
17 two: '22',
18 three: 3px,
19 )
20);
21
22// Should validate when theme configuration is empty.
23@include theme.validate-theme($origin-theme, ());
24
25// Should validate when nested theme keys are provided.
26@include theme.validate-theme(
27 $origin-theme,
28 (
29 four: (
30 x: 11,
31 y: 22,
32 ),
33 )
34);
35
36// Should validate when custom property strings are provided.
37@include theme.validate-theme(
38 $origin-theme,
39 (
40 one: var(--one),
41 two: var(--two, 4px),
42 )
43);
44
45// Should throw error when unsupported key (i.e., foobar) is provided.
46.test {
47 @include theme.validate-theme(
48 $origin-theme,
49 (
50 foobar: 66px,
51 ),
52 $test-only: true
53 );
54}
55
56// Should throw error when custom properties are provided.
57.no-custom-props {
58 @include theme.validate-theme(
59 $origin-theme,
60 (
61 three: (
62 varname: --three,
63 fallback: teal,
64 ),
65 ),
66 $test-only: true
67 );
68}