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,223 +1,223 @@
|
|
|
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 button element': ({pass, fail}) => {
|
|
13
|
-
const btn = document.createElement('button');
|
|
14
|
-
btn.textContent = 'Test';
|
|
15
|
-
document.body.appendChild(btn);
|
|
16
|
-
const display = getStyle(btn, 'display');
|
|
17
|
-
const cursor = getStyle(btn, 'cursor');
|
|
18
|
-
const borderRadius = parseFloat(getStyle(btn, 'borderRadius'));
|
|
19
|
-
btn.remove();
|
|
20
|
-
if(display === 'inline-block' && cursor === 'pointer' && borderRadius > 0){
|
|
21
|
-
pass('Button has correct base styling');
|
|
22
|
-
} else {
|
|
23
|
-
fail(`Expected inline-block/pointer/radius, got display: ${display}, cursor: ${cursor}, radius: ${borderRadius}`);
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
'should style .btn class': ({pass, fail}) => {
|
|
28
|
-
const el = document.createElement('a');
|
|
29
|
-
el.className = 'btn';
|
|
30
|
-
document.body.appendChild(el);
|
|
31
|
-
const display = getStyle(el, 'display');
|
|
32
|
-
const cursor = getStyle(el, 'cursor');
|
|
33
|
-
el.remove();
|
|
34
|
-
if(display === 'inline-block' && cursor === 'pointer'){
|
|
35
|
-
pass('.btn class applies button styling');
|
|
36
|
-
} else {
|
|
37
|
-
fail(`Expected inline-block/pointer, got ${display}/${cursor}`);
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
'should style input[type="button"]': ({pass, fail}) => {
|
|
42
|
-
const input = document.createElement('input');
|
|
43
|
-
input.type = 'button';
|
|
44
|
-
input.value = 'Test';
|
|
45
|
-
document.body.appendChild(input);
|
|
46
|
-
const cursor = getStyle(input, 'cursor');
|
|
47
|
-
input.remove();
|
|
48
|
-
if(cursor === 'pointer'){
|
|
49
|
-
pass('input[type="button"] has pointer cursor');
|
|
50
|
-
} else {
|
|
51
|
-
fail(`Expected pointer, got ${cursor}`);
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
|
|
55
|
-
'should style input[type="submit"]': ({pass, fail}) => {
|
|
56
|
-
const input = document.createElement('input');
|
|
57
|
-
input.type = 'submit';
|
|
58
|
-
document.body.appendChild(input);
|
|
59
|
-
const cursor = getStyle(input, 'cursor');
|
|
60
|
-
input.remove();
|
|
61
|
-
if(cursor === 'pointer'){
|
|
62
|
-
pass('input[type="submit"] has pointer cursor');
|
|
63
|
-
} else {
|
|
64
|
-
fail(`Expected pointer, got ${cursor}`);
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
|
|
68
|
-
'should apply .primary button style': ({pass, fail}) => {
|
|
69
|
-
const btn = document.createElement('button');
|
|
70
|
-
btn.className = 'primary';
|
|
71
|
-
document.body.appendChild(btn);
|
|
72
|
-
const bg = getStyle(btn, 'backgroundColor');
|
|
73
|
-
btn.remove();
|
|
74
|
-
if(bg && bg !== 'rgba(0, 0, 0, 0)'){
|
|
75
|
-
pass(`.primary button has background: ${bg}`);
|
|
76
|
-
} else {
|
|
77
|
-
fail('Primary button should have background color');
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
|
|
81
|
-
'should apply .secondary button style': ({pass, fail}) => {
|
|
82
|
-
const btn = document.createElement('button');
|
|
83
|
-
btn.className = 'secondary';
|
|
84
|
-
document.body.appendChild(btn);
|
|
85
|
-
const bg = getStyle(btn, 'backgroundColor');
|
|
86
|
-
btn.remove();
|
|
87
|
-
if(bg && bg !== 'rgba(0, 0, 0, 0)'){
|
|
88
|
-
pass(`.secondary button has background: ${bg}`);
|
|
89
|
-
} else {
|
|
90
|
-
fail('Secondary button should have background color');
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
|
|
94
|
-
'should apply .success button style': ({pass, fail}) => {
|
|
95
|
-
const btn = document.createElement('button');
|
|
96
|
-
btn.className = 'success';
|
|
97
|
-
document.body.appendChild(btn);
|
|
98
|
-
const bg = getStyle(btn, 'backgroundColor');
|
|
99
|
-
btn.remove();
|
|
100
|
-
if(bg && bg.includes('0, 1') || bg.includes('rgb(0')){
|
|
101
|
-
pass(`.success button has green background: ${bg}`);
|
|
102
|
-
} else {
|
|
103
|
-
fail(`Expected green, got ${bg}`);
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
|
|
107
|
-
'should apply .warning button style': ({pass, fail}) => {
|
|
108
|
-
const btn = document.createElement('button');
|
|
109
|
-
btn.className = 'warning';
|
|
110
|
-
document.body.appendChild(btn);
|
|
111
|
-
const bg = getStyle(btn, 'backgroundColor');
|
|
112
|
-
btn.remove();
|
|
113
|
-
if(bg && bg !== 'rgba(0, 0, 0, 0)'){
|
|
114
|
-
pass(`.warning button has background: ${bg}`);
|
|
115
|
-
} else {
|
|
116
|
-
fail('Warning button should have background color');
|
|
117
|
-
}
|
|
118
|
-
},
|
|
119
|
-
|
|
120
|
-
'should apply .danger button style': ({pass, fail}) => {
|
|
121
|
-
const btn = document.createElement('button');
|
|
122
|
-
btn.className = 'danger';
|
|
123
|
-
document.body.appendChild(btn);
|
|
124
|
-
const bg = getStyle(btn, 'backgroundColor');
|
|
125
|
-
btn.remove();
|
|
126
|
-
if(bg && bg !== 'rgba(0, 0, 0, 0)'){
|
|
127
|
-
pass(`.danger button has background: ${bg}`);
|
|
128
|
-
} else {
|
|
129
|
-
fail('Danger button should have background color');
|
|
130
|
-
}
|
|
131
|
-
},
|
|
132
|
-
|
|
133
|
-
'should apply .link button style': ({pass, fail}) => {
|
|
134
|
-
const btn = document.createElement('button');
|
|
135
|
-
btn.className = 'link';
|
|
136
|
-
document.body.appendChild(btn);
|
|
137
|
-
const bg = getStyle(btn, 'backgroundColor');
|
|
138
|
-
const border = getStyle(btn, 'borderStyle');
|
|
139
|
-
btn.remove();
|
|
140
|
-
if(bg === 'rgba(0, 0, 0, 0)' || bg === 'transparent'){
|
|
141
|
-
pass('.link button has transparent background');
|
|
142
|
-
} else {
|
|
143
|
-
fail(`Expected transparent, got ${bg}`);
|
|
144
|
-
}
|
|
145
|
-
},
|
|
146
|
-
|
|
147
|
-
'should reduce opacity on disabled button': ({pass, fail}) => {
|
|
148
|
-
const btn = document.createElement('button');
|
|
149
|
-
btn.disabled = true;
|
|
150
|
-
document.body.appendChild(btn);
|
|
151
|
-
const opacity = parseFloat(getStyle(btn, 'opacity'));
|
|
152
|
-
btn.remove();
|
|
153
|
-
if(opacity < 1){
|
|
154
|
-
pass(`Disabled button has reduced opacity: ${opacity}`);
|
|
155
|
-
} else {
|
|
156
|
-
fail(`Expected opacity < 1, got ${opacity}`);
|
|
157
|
-
}
|
|
158
|
-
},
|
|
159
|
-
|
|
160
|
-
'should style .btn-grp as inline-flex': ({pass, fail}) => {
|
|
161
|
-
const grp = document.createElement('div');
|
|
162
|
-
grp.className = 'btn-grp';
|
|
163
|
-
document.body.appendChild(grp);
|
|
164
|
-
const display = getStyle(grp, 'display');
|
|
165
|
-
grp.remove();
|
|
166
|
-
if(display === 'inline-flex'){
|
|
167
|
-
pass('.btn-grp displays as inline-flex');
|
|
168
|
-
} else {
|
|
169
|
-
fail(`Expected inline-flex, got ${display}`);
|
|
170
|
-
}
|
|
171
|
-
},
|
|
172
|
-
|
|
173
|
-
'should remove border radius on middle buttons in .btn-grp': ({pass, fail}) => {
|
|
174
|
-
const grp = document.createElement('div');
|
|
175
|
-
grp.className = 'btn-grp';
|
|
176
|
-
const btn1 = document.createElement('button');
|
|
177
|
-
const btn2 = document.createElement('button');
|
|
178
|
-
const btn3 = document.createElement('button');
|
|
179
|
-
grp.appendChild(btn1);
|
|
180
|
-
grp.appendChild(btn2);
|
|
181
|
-
grp.appendChild(btn3);
|
|
182
|
-
document.body.appendChild(grp);
|
|
183
|
-
const btn2TLRadius = parseFloat(getStyle(btn2, 'borderTopLeftRadius'));
|
|
184
|
-
const btn2TRRadius = parseFloat(getStyle(btn2, 'borderTopRightRadius'));
|
|
185
|
-
grp.remove();
|
|
186
|
-
if(btn2TLRadius === 0 && btn2TRRadius === 0){
|
|
187
|
-
pass('Middle button in .btn-grp has no border radius');
|
|
188
|
-
} else {
|
|
189
|
-
fail(`Expected 0 radius, got TL: ${btn2TLRadius}, TR: ${btn2TRRadius}`);
|
|
190
|
-
}
|
|
191
|
-
},
|
|
192
|
-
|
|
193
|
-
'should style .no-btn as unstyled button': ({pass, fail}) => {
|
|
194
|
-
const btn = document.createElement('button');
|
|
195
|
-
btn.className = 'no-btn';
|
|
196
|
-
document.body.appendChild(btn);
|
|
197
|
-
const bg = getStyle(btn, 'backgroundColor');
|
|
198
|
-
const border = getStyle(btn, 'borderStyle');
|
|
199
|
-
btn.remove();
|
|
200
|
-
if((bg === 'rgba(0, 0, 0, 0)' || bg === 'transparent') && border === 'none'){
|
|
201
|
-
pass('.no-btn removes button styling');
|
|
202
|
-
} else {
|
|
203
|
-
fail(`Expected transparent/none, got bg: ${bg}, border: ${border}`);
|
|
204
|
-
}
|
|
205
|
-
},
|
|
206
|
-
|
|
207
|
-
'should apply .full class for full width': ({pass, fail}) => {
|
|
208
|
-
const container = document.createElement('div');
|
|
209
|
-
container.style.width = '500px';
|
|
210
|
-
const btn = document.createElement('button');
|
|
211
|
-
btn.className = 'full';
|
|
212
|
-
container.appendChild(btn);
|
|
213
|
-
document.body.appendChild(container);
|
|
214
|
-
const btnWidth = parseFloat(getStyle(btn, 'width'));
|
|
215
|
-
container.remove();
|
|
216
|
-
// .full should make the button take full container width
|
|
217
|
-
if(btnWidth >= 490){
|
|
218
|
-
pass(`.full makes button full width: ${btnWidth}px`);
|
|
219
|
-
} else {
|
|
220
|
-
fail(`Expected ~500px width, got ${btnWidth}px`);
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
};
|
|
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 button element': ({pass, fail}) => {
|
|
13
|
+
const btn = document.createElement('button');
|
|
14
|
+
btn.textContent = 'Test';
|
|
15
|
+
document.body.appendChild(btn);
|
|
16
|
+
const display = getStyle(btn, 'display');
|
|
17
|
+
const cursor = getStyle(btn, 'cursor');
|
|
18
|
+
const borderRadius = parseFloat(getStyle(btn, 'borderRadius'));
|
|
19
|
+
btn.remove();
|
|
20
|
+
if(display === 'inline-block' && cursor === 'pointer' && borderRadius > 0){
|
|
21
|
+
pass('Button has correct base styling');
|
|
22
|
+
} else {
|
|
23
|
+
fail(`Expected inline-block/pointer/radius, got display: ${display}, cursor: ${cursor}, radius: ${borderRadius}`);
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
'should style .btn class': ({pass, fail}) => {
|
|
28
|
+
const el = document.createElement('a');
|
|
29
|
+
el.className = 'btn';
|
|
30
|
+
document.body.appendChild(el);
|
|
31
|
+
const display = getStyle(el, 'display');
|
|
32
|
+
const cursor = getStyle(el, 'cursor');
|
|
33
|
+
el.remove();
|
|
34
|
+
if(display === 'inline-block' && cursor === 'pointer'){
|
|
35
|
+
pass('.btn class applies button styling');
|
|
36
|
+
} else {
|
|
37
|
+
fail(`Expected inline-block/pointer, got ${display}/${cursor}`);
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
'should style input[type="button"]': ({pass, fail}) => {
|
|
42
|
+
const input = document.createElement('input');
|
|
43
|
+
input.type = 'button';
|
|
44
|
+
input.value = 'Test';
|
|
45
|
+
document.body.appendChild(input);
|
|
46
|
+
const cursor = getStyle(input, 'cursor');
|
|
47
|
+
input.remove();
|
|
48
|
+
if(cursor === 'pointer'){
|
|
49
|
+
pass('input[type="button"] has pointer cursor');
|
|
50
|
+
} else {
|
|
51
|
+
fail(`Expected pointer, got ${cursor}`);
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
'should style input[type="submit"]': ({pass, fail}) => {
|
|
56
|
+
const input = document.createElement('input');
|
|
57
|
+
input.type = 'submit';
|
|
58
|
+
document.body.appendChild(input);
|
|
59
|
+
const cursor = getStyle(input, 'cursor');
|
|
60
|
+
input.remove();
|
|
61
|
+
if(cursor === 'pointer'){
|
|
62
|
+
pass('input[type="submit"] has pointer cursor');
|
|
63
|
+
} else {
|
|
64
|
+
fail(`Expected pointer, got ${cursor}`);
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
'should apply .primary button style': ({pass, fail}) => {
|
|
69
|
+
const btn = document.createElement('button');
|
|
70
|
+
btn.className = 'primary';
|
|
71
|
+
document.body.appendChild(btn);
|
|
72
|
+
const bg = getStyle(btn, 'backgroundColor');
|
|
73
|
+
btn.remove();
|
|
74
|
+
if(bg && bg !== 'rgba(0, 0, 0, 0)'){
|
|
75
|
+
pass(`.primary button has background: ${bg}`);
|
|
76
|
+
} else {
|
|
77
|
+
fail('Primary button should have background color');
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
'should apply .secondary button style': ({pass, fail}) => {
|
|
82
|
+
const btn = document.createElement('button');
|
|
83
|
+
btn.className = 'secondary';
|
|
84
|
+
document.body.appendChild(btn);
|
|
85
|
+
const bg = getStyle(btn, 'backgroundColor');
|
|
86
|
+
btn.remove();
|
|
87
|
+
if(bg && bg !== 'rgba(0, 0, 0, 0)'){
|
|
88
|
+
pass(`.secondary button has background: ${bg}`);
|
|
89
|
+
} else {
|
|
90
|
+
fail('Secondary button should have background color');
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
|
|
94
|
+
'should apply .success button style': ({pass, fail}) => {
|
|
95
|
+
const btn = document.createElement('button');
|
|
96
|
+
btn.className = 'success';
|
|
97
|
+
document.body.appendChild(btn);
|
|
98
|
+
const bg = getStyle(btn, 'backgroundColor');
|
|
99
|
+
btn.remove();
|
|
100
|
+
if(bg && bg.includes('0, 1') || bg.includes('rgb(0')){
|
|
101
|
+
pass(`.success button has green background: ${bg}`);
|
|
102
|
+
} else {
|
|
103
|
+
fail(`Expected green, got ${bg}`);
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
|
|
107
|
+
'should apply .warning button style': ({pass, fail}) => {
|
|
108
|
+
const btn = document.createElement('button');
|
|
109
|
+
btn.className = 'warning';
|
|
110
|
+
document.body.appendChild(btn);
|
|
111
|
+
const bg = getStyle(btn, 'backgroundColor');
|
|
112
|
+
btn.remove();
|
|
113
|
+
if(bg && bg !== 'rgba(0, 0, 0, 0)'){
|
|
114
|
+
pass(`.warning button has background: ${bg}`);
|
|
115
|
+
} else {
|
|
116
|
+
fail('Warning button should have background color');
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
|
|
120
|
+
'should apply .danger button style': ({pass, fail}) => {
|
|
121
|
+
const btn = document.createElement('button');
|
|
122
|
+
btn.className = 'danger';
|
|
123
|
+
document.body.appendChild(btn);
|
|
124
|
+
const bg = getStyle(btn, 'backgroundColor');
|
|
125
|
+
btn.remove();
|
|
126
|
+
if(bg && bg !== 'rgba(0, 0, 0, 0)'){
|
|
127
|
+
pass(`.danger button has background: ${bg}`);
|
|
128
|
+
} else {
|
|
129
|
+
fail('Danger button should have background color');
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
|
|
133
|
+
'should apply .link button style': ({pass, fail}) => {
|
|
134
|
+
const btn = document.createElement('button');
|
|
135
|
+
btn.className = 'link';
|
|
136
|
+
document.body.appendChild(btn);
|
|
137
|
+
const bg = getStyle(btn, 'backgroundColor');
|
|
138
|
+
const border = getStyle(btn, 'borderStyle');
|
|
139
|
+
btn.remove();
|
|
140
|
+
if(bg === 'rgba(0, 0, 0, 0)' || bg === 'transparent'){
|
|
141
|
+
pass('.link button has transparent background');
|
|
142
|
+
} else {
|
|
143
|
+
fail(`Expected transparent, got ${bg}`);
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
|
|
147
|
+
'should reduce opacity on disabled button': ({pass, fail}) => {
|
|
148
|
+
const btn = document.createElement('button');
|
|
149
|
+
btn.disabled = true;
|
|
150
|
+
document.body.appendChild(btn);
|
|
151
|
+
const opacity = parseFloat(getStyle(btn, 'opacity'));
|
|
152
|
+
btn.remove();
|
|
153
|
+
if(opacity < 1){
|
|
154
|
+
pass(`Disabled button has reduced opacity: ${opacity}`);
|
|
155
|
+
} else {
|
|
156
|
+
fail(`Expected opacity < 1, got ${opacity}`);
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
|
|
160
|
+
'should style .btn-grp as inline-flex': ({pass, fail}) => {
|
|
161
|
+
const grp = document.createElement('div');
|
|
162
|
+
grp.className = 'btn-grp';
|
|
163
|
+
document.body.appendChild(grp);
|
|
164
|
+
const display = getStyle(grp, 'display');
|
|
165
|
+
grp.remove();
|
|
166
|
+
if(display === 'inline-flex'){
|
|
167
|
+
pass('.btn-grp displays as inline-flex');
|
|
168
|
+
} else {
|
|
169
|
+
fail(`Expected inline-flex, got ${display}`);
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
|
|
173
|
+
'should remove border radius on middle buttons in .btn-grp': ({pass, fail}) => {
|
|
174
|
+
const grp = document.createElement('div');
|
|
175
|
+
grp.className = 'btn-grp';
|
|
176
|
+
const btn1 = document.createElement('button');
|
|
177
|
+
const btn2 = document.createElement('button');
|
|
178
|
+
const btn3 = document.createElement('button');
|
|
179
|
+
grp.appendChild(btn1);
|
|
180
|
+
grp.appendChild(btn2);
|
|
181
|
+
grp.appendChild(btn3);
|
|
182
|
+
document.body.appendChild(grp);
|
|
183
|
+
const btn2TLRadius = parseFloat(getStyle(btn2, 'borderTopLeftRadius'));
|
|
184
|
+
const btn2TRRadius = parseFloat(getStyle(btn2, 'borderTopRightRadius'));
|
|
185
|
+
grp.remove();
|
|
186
|
+
if(btn2TLRadius === 0 && btn2TRRadius === 0){
|
|
187
|
+
pass('Middle button in .btn-grp has no border radius');
|
|
188
|
+
} else {
|
|
189
|
+
fail(`Expected 0 radius, got TL: ${btn2TLRadius}, TR: ${btn2TRRadius}`);
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
|
|
193
|
+
'should style .no-btn as unstyled button': ({pass, fail}) => {
|
|
194
|
+
const btn = document.createElement('button');
|
|
195
|
+
btn.className = 'no-btn';
|
|
196
|
+
document.body.appendChild(btn);
|
|
197
|
+
const bg = getStyle(btn, 'backgroundColor');
|
|
198
|
+
const border = getStyle(btn, 'borderStyle');
|
|
199
|
+
btn.remove();
|
|
200
|
+
if((bg === 'rgba(0, 0, 0, 0)' || bg === 'transparent') && border === 'none'){
|
|
201
|
+
pass('.no-btn removes button styling');
|
|
202
|
+
} else {
|
|
203
|
+
fail(`Expected transparent/none, got bg: ${bg}, border: ${border}`);
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
|
|
207
|
+
'should apply .full class for full width': ({pass, fail}) => {
|
|
208
|
+
const container = document.createElement('div');
|
|
209
|
+
container.style.width = '500px';
|
|
210
|
+
const btn = document.createElement('button');
|
|
211
|
+
btn.className = 'full';
|
|
212
|
+
container.appendChild(btn);
|
|
213
|
+
document.body.appendChild(container);
|
|
214
|
+
const btnWidth = parseFloat(getStyle(btn, 'width'));
|
|
215
|
+
container.remove();
|
|
216
|
+
// .full should make the button take full container width
|
|
217
|
+
if(btnWidth >= 490){
|
|
218
|
+
pass(`.full makes button full width: ${btnWidth}px`);
|
|
219
|
+
} else {
|
|
220
|
+
fail(`Expected ~500px width, got ${btnWidth}px`);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
};
|