Skip to content

Commit c0851e4

Browse files
author
Thomas
committed
Remove redundant check and extra tests for elevation in boxshadows
1 parent de55ea0 commit c0851e4

File tree

3 files changed

+34
-10
lines changed

3 files changed

+34
-10
lines changed

__tests__/fixtures/outputs/generator/elevationBoxShadow.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,35 @@ module.exports = {
44
shadowOffset: {width: 0, height: 1},
55
shadowOpacity: 1,
66
shadowRadius: 3,
7-
elevation: 1.5,
7+
elevation: 3,
88
},
99
shadowMd: {
1010
shadowColor: '#FFFF00',
1111
shadowOffset: {width: 0, height: 4},
1212
shadowOpacity: 1,
1313
shadowRadius: 6,
14-
elevation: 3,
14+
elevation: 2,
1515
},
1616
shadowLg: {
1717
shadowColor: '#FFFFFF',
1818
shadowOffset: {width: 0, height: 10},
1919
shadowOpacity: 1,
2020
shadowRadius: 15,
21-
elevation: 7.5,
21+
elevation: 1,
2222
},
2323
shadowXl: {
2424
shadowColor: '#00FF00',
2525
shadowOffset: {width: 0, height: 20},
2626
shadowOpacity: 1,
2727
shadowRadius: 25,
28-
elevation: 12.5,
28+
elevation: 20,
2929
},
3030
shadow2xl: {
3131
shadowColor: '#0000FF',
3232
shadowOffset: {width: 0, height: 25},
3333
shadowOpacity: 1,
3434
shadowRadius: 50,
35-
elevation: 25,
35+
elevation: 5,
3636
},
3737
shadowInner: {
3838
shadowColor: 'rgba(0, 0, 0, 0)',
@@ -46,7 +46,7 @@ module.exports = {
4646
shadowOffset: {width: 0, height: 0},
4747
shadowOpacity: 1,
4848
shadowRadius: 0,
49-
elevation: 0,
49+
elevation: 7,
5050
},
5151
shadowNone: {
5252
shadowColor: 'rgba(0, 0, 0, 0)',

__tests__/generator.test.js

+27
Original file line numberDiff line numberDiff line change
@@ -248,3 +248,30 @@ test('shadows with hex colors', () => {
248248
expect(resultBox).toEqual(require('./fixtures/outputs/generator/hexColorBoxShadow'));
249249
expect(resultText).toEqual(require('./fixtures/outputs/generator/hexColorTextShadow'));
250250
});
251+
252+
test('shadows with custom elevation', () => {
253+
const resultBox = generator.generateShadows('shadow', 'shadow', {
254+
default: '0 1px 3px 0 #FF0000, 3',
255+
md: '0 4px 6px -1px #FFFF00, 2',
256+
lg: '0 10px 15px -3px #FFFFFF,1',
257+
xl: '0 20px 25px -5px #00FF00,20',
258+
'2xl': '0 25px 50px -12px #0000FF, 5',
259+
inner: 'inset 0 2px 4px 0 #F0000F,6',
260+
outline: '0 0 0 3px #000FF0,7',
261+
none: 'none',
262+
});
263+
264+
const resultText = generator.generateShadows('text-shadow', 'textShadow', {
265+
default: '0 1px 3px 0 #FF0000, 3',
266+
md: '0 4px 6px -1px #FFFF00, 2',
267+
lg: '0 10px 15px -3px #FFFFFF,1',
268+
xl: '0 20px 25px -5px #00FF00,20',
269+
'2xl': '0 25px 50px -12px #0000FF, 5',
270+
inner: 'inset 0 2px 4px 0 #F0000F,6',
271+
outline: '0 0 0 3px #000FF0,7',
272+
none: 'none',
273+
});
274+
275+
expect(resultBox).toEqual(require('./fixtures/outputs/generator/elevationBoxShadow'));
276+
expect(resultText).toEqual(require('./fixtures/outputs/generator/elevationTextShadow'));
277+
});

util/generator.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,7 @@ export default {
113113
currentColorKeys;
114114

115115
for (color in colors) {
116-
117-
if (colors.hasOwnProperty(color)) {
118-
colorName = color;
119-
}
116+
colorName = color;
120117

121118
currentColor = colors[colorName];
122119

0 commit comments

Comments
 (0)