kempo-css 1.3.13 → 2.0.0
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/test.yml +25 -25
- package/AGENTS.md +43 -43
- package/CHANGELOG.md +107 -97
- package/LICENSE.md +21 -21
- package/dist/kempo.min.css +1 -1
- package/docs/components/ThemePropertyInput.js +2 -2
- package/docs/demo.inc.html +213 -213
- package/docs/examples/responsive-grid.html +1 -1
- package/docs/index.html +1390 -25
- package/docs/init.js +1 -1
- package/docs/kempo-hljs.css +124 -124
- package/docs/kempo.css +1210 -1177
- package/docs/kempo.min.css +1 -1
- package/docs/manifest.json +87 -87
- package/docs/nav.js +32 -32
- package/docs/theme-editor.html +10 -10
- package/package.json +1 -1
- package/scripts/build.js +173 -173
- package/src/kempo-hljs.css +124 -124
- package/src/kempo.css +1210 -1177
- package/tests/base_reset.browser-test.js +201 -201
- package/tests/buttons.browser-test.js +223 -223
- package/tests/colors.browser-test.js +277 -277
- package/tests/components.browser-test.js +131 -144
- package/tests/css_variables.browser-test.js +170 -170
- package/tests/display_flex.browser-test.js +159 -159
- package/tests/elevation.browser-test.js +239 -0
- package/tests/forms.browser-test.js +224 -224
- package/tests/rows_columns.browser-test.js +171 -171
- package/tests/spacing.browser-test.js +310 -310
- package/tests/tables.browser-test.js +192 -192
- package/tests/typography.browser-test.js +255 -255
- package/docs/docs.inc.html +0 -955
|
@@ -1,144 +1,131 @@
|
|
|
1
|
-
const getStyle = (el, prop) => getComputedStyle(el)[prop];
|
|
2
|
-
|
|
3
|
-
export const beforeAll = async () => {
|
|
4
|
-
const link = document.createElement('link');
|
|
5
|
-
link.rel = 'stylesheet';
|
|
6
|
-
link.href = '/src/kempo.css';
|
|
7
|
-
document.head.appendChild(link);
|
|
8
|
-
await new Promise(resolve => link.onload = resolve);
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export default {
|
|
12
|
-
'should style .card with border': ({pass, fail}) => {
|
|
13
|
-
const el = document.createElement('div');
|
|
14
|
-
el.className = 'card';
|
|
15
|
-
document.body.appendChild(el);
|
|
16
|
-
const border = parseFloat(getStyle(el, 'borderWidth'));
|
|
17
|
-
el.remove();
|
|
18
|
-
if(border > 0){
|
|
19
|
-
pass(`.card has border: ${border}px`);
|
|
20
|
-
} else {
|
|
21
|
-
fail('card should have border');
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
'should style .card with border radius': ({pass, fail}) => {
|
|
26
|
-
const el = document.createElement('div');
|
|
27
|
-
el.className = 'card';
|
|
28
|
-
document.body.appendChild(el);
|
|
29
|
-
const radius = parseFloat(getStyle(el, 'borderRadius'));
|
|
30
|
-
el.remove();
|
|
31
|
-
if(radius > 0){
|
|
32
|
-
pass(`.card has border-radius: ${radius}px`);
|
|
33
|
-
} else {
|
|
34
|
-
fail('card should have border radius');
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
'should style .card with padding': ({pass, fail}) => {
|
|
39
|
-
const el = document.createElement('div');
|
|
40
|
-
el.className = 'card';
|
|
41
|
-
document.body.appendChild(el);
|
|
42
|
-
const paddingTop = parseFloat(getStyle(el, 'paddingTop'));
|
|
43
|
-
const paddingLeft = parseFloat(getStyle(el, 'paddingLeft'));
|
|
44
|
-
const paddingRight = parseFloat(getStyle(el, 'paddingRight'));
|
|
45
|
-
el.remove();
|
|
46
|
-
if(paddingTop > 0 && paddingLeft > 0 && paddingRight > 0){
|
|
47
|
-
pass('.card has padding on top, left, and right');
|
|
48
|
-
} else {
|
|
49
|
-
fail(`Expected padding, got top: ${paddingTop}, left: ${paddingLeft}, right: ${paddingRight}`);
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
|
|
53
|
-
'should style .card with margin-bottom': ({pass, fail}) => {
|
|
54
|
-
const el = document.createElement('div');
|
|
55
|
-
el.className = 'card';
|
|
56
|
-
document.body.appendChild(el);
|
|
57
|
-
const marginBottom = parseFloat(getStyle(el, 'marginBottom'));
|
|
58
|
-
el.remove();
|
|
59
|
-
if(marginBottom > 0){
|
|
60
|
-
pass(`.card has margin-bottom: ${marginBottom}px`);
|
|
61
|
-
} else {
|
|
62
|
-
fail('card should have margin-bottom');
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
|
|
66
|
-
'should
|
|
67
|
-
const el = document.createElement('
|
|
68
|
-
el.className = '
|
|
69
|
-
document.body.appendChild(el);
|
|
70
|
-
const
|
|
71
|
-
el.remove();
|
|
72
|
-
if(
|
|
73
|
-
pass(
|
|
74
|
-
} else {
|
|
75
|
-
fail(`Expected
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
|
|
79
|
-
'should style .icon
|
|
80
|
-
const el = document.createElement('span');
|
|
81
|
-
el.className = 'icon';
|
|
82
|
-
document.body.appendChild(el);
|
|
83
|
-
const
|
|
84
|
-
el.remove();
|
|
85
|
-
if(
|
|
86
|
-
pass(
|
|
87
|
-
} else {
|
|
88
|
-
fail(
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
|
|
92
|
-
'should style .icon with
|
|
93
|
-
const el = document.createElement('span');
|
|
94
|
-
el.className = 'icon';
|
|
95
|
-
document.body.appendChild(el);
|
|
96
|
-
const
|
|
97
|
-
el.remove();
|
|
98
|
-
if(
|
|
99
|
-
pass(
|
|
100
|
-
} else {
|
|
101
|
-
fail(
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
|
|
105
|
-
'should
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
document.
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
container.style.width = '500px';
|
|
133
|
-
const iframe = document.createElement('iframe');
|
|
134
|
-
container.appendChild(iframe);
|
|
135
|
-
document.body.appendChild(container);
|
|
136
|
-
const width = getStyle(iframe, 'width');
|
|
137
|
-
container.remove();
|
|
138
|
-
if(width === '100%' || parseFloat(width) >= 490){
|
|
139
|
-
pass(`iframe has full width: ${width}`);
|
|
140
|
-
} else {
|
|
141
|
-
fail(`Expected 100%, got ${width}`);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
};
|
|
1
|
+
const getStyle = (el, prop) => getComputedStyle(el)[prop];
|
|
2
|
+
|
|
3
|
+
export const beforeAll = async () => {
|
|
4
|
+
const link = document.createElement('link');
|
|
5
|
+
link.rel = 'stylesheet';
|
|
6
|
+
link.href = '/src/kempo.css';
|
|
7
|
+
document.head.appendChild(link);
|
|
8
|
+
await new Promise(resolve => link.onload = resolve);
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
'should style .card with border': ({pass, fail}) => {
|
|
13
|
+
const el = document.createElement('div');
|
|
14
|
+
el.className = 'card';
|
|
15
|
+
document.body.appendChild(el);
|
|
16
|
+
const border = parseFloat(getStyle(el, 'borderWidth'));
|
|
17
|
+
el.remove();
|
|
18
|
+
if(border > 0){
|
|
19
|
+
pass(`.card has border: ${border}px`);
|
|
20
|
+
} else {
|
|
21
|
+
fail('card should have border');
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
'should style .card with border radius': ({pass, fail}) => {
|
|
26
|
+
const el = document.createElement('div');
|
|
27
|
+
el.className = 'card';
|
|
28
|
+
document.body.appendChild(el);
|
|
29
|
+
const radius = parseFloat(getStyle(el, 'borderRadius'));
|
|
30
|
+
el.remove();
|
|
31
|
+
if(radius > 0){
|
|
32
|
+
pass(`.card has border-radius: ${radius}px`);
|
|
33
|
+
} else {
|
|
34
|
+
fail('card should have border radius');
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
'should style .card with padding': ({pass, fail}) => {
|
|
39
|
+
const el = document.createElement('div');
|
|
40
|
+
el.className = 'card';
|
|
41
|
+
document.body.appendChild(el);
|
|
42
|
+
const paddingTop = parseFloat(getStyle(el, 'paddingTop'));
|
|
43
|
+
const paddingLeft = parseFloat(getStyle(el, 'paddingLeft'));
|
|
44
|
+
const paddingRight = parseFloat(getStyle(el, 'paddingRight'));
|
|
45
|
+
el.remove();
|
|
46
|
+
if(paddingTop > 0 && paddingLeft > 0 && paddingRight > 0){
|
|
47
|
+
pass('.card has padding on top, left, and right');
|
|
48
|
+
} else {
|
|
49
|
+
fail(`Expected padding, got top: ${paddingTop}, left: ${paddingLeft}, right: ${paddingRight}`);
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
'should style .card with margin-bottom': ({pass, fail}) => {
|
|
54
|
+
const el = document.createElement('div');
|
|
55
|
+
el.className = 'card';
|
|
56
|
+
document.body.appendChild(el);
|
|
57
|
+
const marginBottom = parseFloat(getStyle(el, 'marginBottom'));
|
|
58
|
+
el.remove();
|
|
59
|
+
if(marginBottom > 0){
|
|
60
|
+
pass(`.card has margin-bottom: ${marginBottom}px`);
|
|
61
|
+
} else {
|
|
62
|
+
fail('card should have margin-bottom');
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
'should style .icon as inline-block': ({pass, fail}) => {
|
|
67
|
+
const el = document.createElement('span');
|
|
68
|
+
el.className = 'icon';
|
|
69
|
+
document.body.appendChild(el);
|
|
70
|
+
const display = getStyle(el, 'display');
|
|
71
|
+
el.remove();
|
|
72
|
+
if(display === 'inline-block'){
|
|
73
|
+
pass('.icon displays as inline-block');
|
|
74
|
+
} else {
|
|
75
|
+
fail(`Expected inline-block, got ${display}`);
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
'should style .icon with width': ({pass, fail}) => {
|
|
80
|
+
const el = document.createElement('span');
|
|
81
|
+
el.className = 'icon';
|
|
82
|
+
document.body.appendChild(el);
|
|
83
|
+
const width = getStyle(el, 'width');
|
|
84
|
+
el.remove();
|
|
85
|
+
if(width && width !== 'auto'){
|
|
86
|
+
pass(`.icon has width: ${width}`);
|
|
87
|
+
} else {
|
|
88
|
+
fail('icon should have width');
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
'should style .icon with vertical-align top': ({pass, fail}) => {
|
|
93
|
+
const el = document.createElement('span');
|
|
94
|
+
el.className = 'icon';
|
|
95
|
+
document.body.appendChild(el);
|
|
96
|
+
const verticalAlign = getStyle(el, 'verticalAlign');
|
|
97
|
+
el.remove();
|
|
98
|
+
if(verticalAlign === 'top'){
|
|
99
|
+
pass('.icon has vertical-align: top');
|
|
100
|
+
} else {
|
|
101
|
+
fail(`Expected top, got ${verticalAlign}`);
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
'should remove iframe border': ({pass, fail}) => {
|
|
106
|
+
const iframe = document.createElement('iframe');
|
|
107
|
+
document.body.appendChild(iframe);
|
|
108
|
+
const border = getStyle(iframe, 'borderStyle');
|
|
109
|
+
iframe.remove();
|
|
110
|
+
if(border === 'none'){
|
|
111
|
+
pass('iframe has no border');
|
|
112
|
+
} else {
|
|
113
|
+
fail(`Expected none, got ${border}`);
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
|
|
117
|
+
'should make iframe full width': ({pass, fail}) => {
|
|
118
|
+
const container = document.createElement('div');
|
|
119
|
+
container.style.width = '500px';
|
|
120
|
+
const iframe = document.createElement('iframe');
|
|
121
|
+
container.appendChild(iframe);
|
|
122
|
+
document.body.appendChild(container);
|
|
123
|
+
const width = getStyle(iframe, 'width');
|
|
124
|
+
container.remove();
|
|
125
|
+
if(width === '100%' || parseFloat(width) >= 490){
|
|
126
|
+
pass(`iframe has full width: ${width}`);
|
|
127
|
+
} else {
|
|
128
|
+
fail(`Expected 100%, got ${width}`);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
};
|
|
@@ -1,170 +1,170 @@
|
|
|
1
|
-
const getVar = name => getComputedStyle(document.documentElement).getPropertyValue(name).trim();
|
|
2
|
-
|
|
3
|
-
export const beforeAll = async () => {
|
|
4
|
-
const link = document.createElement('link');
|
|
5
|
-
link.rel = 'stylesheet';
|
|
6
|
-
link.href = '/src/kempo.css';
|
|
7
|
-
document.head.appendChild(link);
|
|
8
|
-
await new Promise(resolve => link.onload = resolve);
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export default {
|
|
12
|
-
'should have font family variables': ({pass, fail}) => {
|
|
13
|
-
const vars = ['--ff_body', '--ff_heading', '--ff_mono'];
|
|
14
|
-
const missing = vars.filter(v => !getVar(v));
|
|
15
|
-
if(missing.length === 0){
|
|
16
|
-
pass('All font family variables exist');
|
|
17
|
-
} else {
|
|
18
|
-
fail(`Missing font family variables: ${missing.join(', ')}`);
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
'should have font size variables': ({pass, fail}) => {
|
|
23
|
-
const vars = [
|
|
24
|
-
'--fs_base', '--fs_small', '--fs_large',
|
|
25
|
-
'--fs_h1', '--fs_h2', '--fs_h3', '--fs_h4', '--fs_h5', '--fs_h6'
|
|
26
|
-
];
|
|
27
|
-
const missing = vars.filter(v => !getVar(v));
|
|
28
|
-
if(missing.length === 0){
|
|
29
|
-
pass('All font size variables exist');
|
|
30
|
-
} else {
|
|
31
|
-
fail(`Missing font size variables: ${missing.join(', ')}`);
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
'should have font weight variables': ({pass, fail}) => {
|
|
36
|
-
const vars = ['--fw_base', '--fw_bold'];
|
|
37
|
-
const missing = vars.filter(v => !getVar(v));
|
|
38
|
-
if(missing.length === 0){
|
|
39
|
-
pass('All font weight variables exist');
|
|
40
|
-
} else {
|
|
41
|
-
fail(`Missing font weight variables: ${missing.join(', ')}`);
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
'should have spacer variables': ({pass, fail}) => {
|
|
46
|
-
const vars = ['--spacer', '--spacer_h', '--spacer_q'];
|
|
47
|
-
const missing = vars.filter(v => !getVar(v));
|
|
48
|
-
if(missing.length === 0){
|
|
49
|
-
pass('All spacer variables exist');
|
|
50
|
-
} else {
|
|
51
|
-
fail(`Missing spacer variables: ${missing.join(', ')}`);
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
|
|
55
|
-
'should have layout variables': ({pass, fail}) => {
|
|
56
|
-
const vars = ['--line-height', '--container_width', '--animation_ms', '--radius'];
|
|
57
|
-
const missing = vars.filter(v => !getVar(v));
|
|
58
|
-
if(missing.length === 0){
|
|
59
|
-
pass('All layout variables exist');
|
|
60
|
-
} else {
|
|
61
|
-
fail(`Missing layout variables: ${missing.join(', ')}`);
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
|
|
65
|
-
'should have background color variables': ({pass, fail}) => {
|
|
66
|
-
const vars = ['--c_bg', '--c_bg__inv', '--c_bg__alt', '--c_overscroll'];
|
|
67
|
-
const missing = vars.filter(v => !getVar(v));
|
|
68
|
-
if(missing.length === 0){
|
|
69
|
-
pass('All background color variables exist');
|
|
70
|
-
} else {
|
|
71
|
-
fail(`Missing background color variables: ${missing.join(', ')}`);
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
|
|
75
|
-
'should have border color variables': ({pass, fail}) => {
|
|
76
|
-
const vars = ['--c_border', '--c_border__inv'];
|
|
77
|
-
const missing = vars.filter(v => !getVar(v));
|
|
78
|
-
if(missing.length === 0){
|
|
79
|
-
pass('All border color variables exist');
|
|
80
|
-
} else {
|
|
81
|
-
fail(`Missing border color variables: ${missing.join(', ')}`);
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
|
|
85
|
-
'should have semantic color variables': ({pass, fail}) => {
|
|
86
|
-
const vars = [
|
|
87
|
-
'--c_primary', '--c_primary__hover',
|
|
88
|
-
'--c_secondary', '--c_secondary__hover',
|
|
89
|
-
'--c_success', '--c_success__hover',
|
|
90
|
-
'--c_warning', '--c_warning__hover',
|
|
91
|
-
'--c_danger', '--c_danger__hover'
|
|
92
|
-
];
|
|
93
|
-
const missing = vars.filter(v => !getVar(v));
|
|
94
|
-
if(missing.length === 0){
|
|
95
|
-
pass('All semantic color variables exist');
|
|
96
|
-
} else {
|
|
97
|
-
fail(`Missing semantic color variables: ${missing.join(', ')}`);
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
|
|
101
|
-
'should have text color variables': ({pass, fail}) => {
|
|
102
|
-
const vars = [
|
|
103
|
-
'--tc', '--tc_dark', '--tc_light', '--tc_inv', '--tc_muted',
|
|
104
|
-
'--tc_on_primary', '--tc_on_secondary', '--tc_on_success',
|
|
105
|
-
'--tc_on_warning', '--tc_on_danger',
|
|
106
|
-
'--tc_primary', '--tc_secondary', '--tc_success', '--tc_warning', '--tc_danger'
|
|
107
|
-
];
|
|
108
|
-
const missing = vars.filter(v => !getVar(v));
|
|
109
|
-
if(missing.length === 0){
|
|
110
|
-
pass('All text color variables exist');
|
|
111
|
-
} else {
|
|
112
|
-
fail(`Missing text color variables: ${missing.join(', ')}`);
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
|
|
116
|
-
'should have button variables': ({pass, fail}) => {
|
|
117
|
-
const vars = [
|
|
118
|
-
'--btn_padding', '--btn_box_shadow', '--btn_box_shadow__hover',
|
|
119
|
-
'--btn_border', '--btn_bg', '--btn_bg__hover', '--btn_tc'
|
|
120
|
-
];
|
|
121
|
-
const missing = vars.filter(v => !getVar(v));
|
|
122
|
-
if(missing.length === 0){
|
|
123
|
-
pass('All button variables exist');
|
|
124
|
-
} else {
|
|
125
|
-
fail(`Missing button variables: ${missing.join(', ')}`);
|
|
126
|
-
}
|
|
127
|
-
},
|
|
128
|
-
|
|
129
|
-
'should have input variables': ({pass, fail}) => {
|
|
130
|
-
const vars = [
|
|
131
|
-
'--input_padding', '--input_border_width', '--input_bg',
|
|
132
|
-
'--input_tc', '--c_input_accent', '--c_input_border'
|
|
133
|
-
];
|
|
134
|
-
const missing = vars.filter(v => !getVar(v));
|
|
135
|
-
if(missing.length === 0){
|
|
136
|
-
pass('All input variables exist');
|
|
137
|
-
} else {
|
|
138
|
-
fail(`Missing input variables: ${missing.join(', ')}`);
|
|
139
|
-
}
|
|
140
|
-
},
|
|
141
|
-
|
|
142
|
-
'should have link variables': ({pass, fail}) => {
|
|
143
|
-
const vars = ['--link_decoration', '--tc_link', '--tc_link__hover'];
|
|
144
|
-
const missing = vars.filter(v => !getVar(v));
|
|
145
|
-
if(missing.length === 0){
|
|
146
|
-
pass('All link variables exist');
|
|
147
|
-
} else {
|
|
148
|
-
fail(`Missing link variables: ${missing.join(', ')}`);
|
|
149
|
-
}
|
|
150
|
-
},
|
|
151
|
-
|
|
152
|
-
'should have focus and shadow variables': ({pass, fail}) => {
|
|
153
|
-
const vars = ['--focus_shadow', '--focus_shadow_on_primary', '--
|
|
154
|
-
const missing = vars.filter(v => !getVar(v));
|
|
155
|
-
if(missing.length === 0){
|
|
156
|
-
pass('All focus and shadow variables exist');
|
|
157
|
-
} else {
|
|
158
|
-
fail(`Missing focus and shadow variables: ${missing.join(', ')}`);
|
|
159
|
-
}
|
|
160
|
-
},
|
|
161
|
-
|
|
162
|
-
'should have highlight variable': ({pass, fail}) => {
|
|
163
|
-
const value = getVar('--c_highlight');
|
|
164
|
-
if(value){
|
|
165
|
-
pass('Highlight variable exists');
|
|
166
|
-
} else {
|
|
167
|
-
fail('Missing --c_highlight variable');
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
};
|
|
1
|
+
const getVar = name => getComputedStyle(document.documentElement).getPropertyValue(name).trim();
|
|
2
|
+
|
|
3
|
+
export const beforeAll = async () => {
|
|
4
|
+
const link = document.createElement('link');
|
|
5
|
+
link.rel = 'stylesheet';
|
|
6
|
+
link.href = '/src/kempo.css';
|
|
7
|
+
document.head.appendChild(link);
|
|
8
|
+
await new Promise(resolve => link.onload = resolve);
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
'should have font family variables': ({pass, fail}) => {
|
|
13
|
+
const vars = ['--ff_body', '--ff_heading', '--ff_mono'];
|
|
14
|
+
const missing = vars.filter(v => !getVar(v));
|
|
15
|
+
if(missing.length === 0){
|
|
16
|
+
pass('All font family variables exist');
|
|
17
|
+
} else {
|
|
18
|
+
fail(`Missing font family variables: ${missing.join(', ')}`);
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
'should have font size variables': ({pass, fail}) => {
|
|
23
|
+
const vars = [
|
|
24
|
+
'--fs_base', '--fs_small', '--fs_large',
|
|
25
|
+
'--fs_h1', '--fs_h2', '--fs_h3', '--fs_h4', '--fs_h5', '--fs_h6'
|
|
26
|
+
];
|
|
27
|
+
const missing = vars.filter(v => !getVar(v));
|
|
28
|
+
if(missing.length === 0){
|
|
29
|
+
pass('All font size variables exist');
|
|
30
|
+
} else {
|
|
31
|
+
fail(`Missing font size variables: ${missing.join(', ')}`);
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
'should have font weight variables': ({pass, fail}) => {
|
|
36
|
+
const vars = ['--fw_base', '--fw_bold'];
|
|
37
|
+
const missing = vars.filter(v => !getVar(v));
|
|
38
|
+
if(missing.length === 0){
|
|
39
|
+
pass('All font weight variables exist');
|
|
40
|
+
} else {
|
|
41
|
+
fail(`Missing font weight variables: ${missing.join(', ')}`);
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
'should have spacer variables': ({pass, fail}) => {
|
|
46
|
+
const vars = ['--spacer', '--spacer_h', '--spacer_q'];
|
|
47
|
+
const missing = vars.filter(v => !getVar(v));
|
|
48
|
+
if(missing.length === 0){
|
|
49
|
+
pass('All spacer variables exist');
|
|
50
|
+
} else {
|
|
51
|
+
fail(`Missing spacer variables: ${missing.join(', ')}`);
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
'should have layout variables': ({pass, fail}) => {
|
|
56
|
+
const vars = ['--line-height', '--container_width', '--animation_ms', '--radius'];
|
|
57
|
+
const missing = vars.filter(v => !getVar(v));
|
|
58
|
+
if(missing.length === 0){
|
|
59
|
+
pass('All layout variables exist');
|
|
60
|
+
} else {
|
|
61
|
+
fail(`Missing layout variables: ${missing.join(', ')}`);
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
'should have background color variables': ({pass, fail}) => {
|
|
66
|
+
const vars = ['--c_bg', '--c_bg__inv', '--c_bg__alt', '--c_overscroll'];
|
|
67
|
+
const missing = vars.filter(v => !getVar(v));
|
|
68
|
+
if(missing.length === 0){
|
|
69
|
+
pass('All background color variables exist');
|
|
70
|
+
} else {
|
|
71
|
+
fail(`Missing background color variables: ${missing.join(', ')}`);
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
'should have border color variables': ({pass, fail}) => {
|
|
76
|
+
const vars = ['--c_border', '--c_border__inv'];
|
|
77
|
+
const missing = vars.filter(v => !getVar(v));
|
|
78
|
+
if(missing.length === 0){
|
|
79
|
+
pass('All border color variables exist');
|
|
80
|
+
} else {
|
|
81
|
+
fail(`Missing border color variables: ${missing.join(', ')}`);
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
'should have semantic color variables': ({pass, fail}) => {
|
|
86
|
+
const vars = [
|
|
87
|
+
'--c_primary', '--c_primary__hover',
|
|
88
|
+
'--c_secondary', '--c_secondary__hover',
|
|
89
|
+
'--c_success', '--c_success__hover',
|
|
90
|
+
'--c_warning', '--c_warning__hover',
|
|
91
|
+
'--c_danger', '--c_danger__hover'
|
|
92
|
+
];
|
|
93
|
+
const missing = vars.filter(v => !getVar(v));
|
|
94
|
+
if(missing.length === 0){
|
|
95
|
+
pass('All semantic color variables exist');
|
|
96
|
+
} else {
|
|
97
|
+
fail(`Missing semantic color variables: ${missing.join(', ')}`);
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
'should have text color variables': ({pass, fail}) => {
|
|
102
|
+
const vars = [
|
|
103
|
+
'--tc', '--tc_dark', '--tc_light', '--tc_inv', '--tc_muted',
|
|
104
|
+
'--tc_on_primary', '--tc_on_secondary', '--tc_on_success',
|
|
105
|
+
'--tc_on_warning', '--tc_on_danger',
|
|
106
|
+
'--tc_primary', '--tc_secondary', '--tc_success', '--tc_warning', '--tc_danger'
|
|
107
|
+
];
|
|
108
|
+
const missing = vars.filter(v => !getVar(v));
|
|
109
|
+
if(missing.length === 0){
|
|
110
|
+
pass('All text color variables exist');
|
|
111
|
+
} else {
|
|
112
|
+
fail(`Missing text color variables: ${missing.join(', ')}`);
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
|
|
116
|
+
'should have button variables': ({pass, fail}) => {
|
|
117
|
+
const vars = [
|
|
118
|
+
'--btn_padding', '--btn_box_shadow', '--btn_box_shadow__hover',
|
|
119
|
+
'--btn_border', '--btn_bg', '--btn_bg__hover', '--btn_tc'
|
|
120
|
+
];
|
|
121
|
+
const missing = vars.filter(v => !getVar(v));
|
|
122
|
+
if(missing.length === 0){
|
|
123
|
+
pass('All button variables exist');
|
|
124
|
+
} else {
|
|
125
|
+
fail(`Missing button variables: ${missing.join(', ')}`);
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
|
|
129
|
+
'should have input variables': ({pass, fail}) => {
|
|
130
|
+
const vars = [
|
|
131
|
+
'--input_padding', '--input_border_width', '--input_bg',
|
|
132
|
+
'--input_tc', '--c_input_accent', '--c_input_border'
|
|
133
|
+
];
|
|
134
|
+
const missing = vars.filter(v => !getVar(v));
|
|
135
|
+
if(missing.length === 0){
|
|
136
|
+
pass('All input variables exist');
|
|
137
|
+
} else {
|
|
138
|
+
fail(`Missing input variables: ${missing.join(', ')}`);
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
|
|
142
|
+
'should have link variables': ({pass, fail}) => {
|
|
143
|
+
const vars = ['--link_decoration', '--tc_link', '--tc_link__hover'];
|
|
144
|
+
const missing = vars.filter(v => !getVar(v));
|
|
145
|
+
if(missing.length === 0){
|
|
146
|
+
pass('All link variables exist');
|
|
147
|
+
} else {
|
|
148
|
+
fail(`Missing link variables: ${missing.join(', ')}`);
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
|
|
152
|
+
'should have focus and shadow variables': ({pass, fail}) => {
|
|
153
|
+
const vars = ['--focus_shadow', '--focus_shadow_on_primary', '--c_overlay'];
|
|
154
|
+
const missing = vars.filter(v => !getVar(v));
|
|
155
|
+
if(missing.length === 0){
|
|
156
|
+
pass('All focus and shadow variables exist');
|
|
157
|
+
} else {
|
|
158
|
+
fail(`Missing focus and shadow variables: ${missing.join(', ')}`);
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
|
|
162
|
+
'should have highlight variable': ({pass, fail}) => {
|
|
163
|
+
const value = getVar('--c_highlight');
|
|
164
|
+
if(value){
|
|
165
|
+
pass('Highlight variable exists');
|
|
166
|
+
} else {
|
|
167
|
+
fail('Missing --c_highlight variable');
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
};
|