Skip to content

Commit 750bdcd

Browse files
authored
Ignore 'none' keyword for box-shadows and z-indexes (#98)
* ignore keywords for box-shadows * ignore keywords for z-indexes closes #97
1 parent 77fa882 commit 750bdcd

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

src/analyzer/values/box-shadows.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
const uniquer = require('../../utils/uniquer')
2+
const {KEYWORDS} = require('../../utils/css')
23

34
module.exports = declarations => {
45
const all = declarations
56
.filter(({property}) => property === 'box-shadow')
7+
.filter(({value}) => !KEYWORDS.includes(value))
68
.map(declaration => declaration.value)
79

810
const {unique, totalUnique} = uniquer(all)

test/analyzer/values/box-shadows.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,31 @@ test('It recognizes an advanced box-shadow with multiple shadows', t => {
8080

8181
t.deepEqual(actual, expected)
8282
})
83+
84+
test('It ignores CSS keywords', t => {
85+
const expected = {
86+
total: 0,
87+
totalUnique: 0,
88+
unique: []
89+
}
90+
const actual = analyze([
91+
{
92+
property: 'box-shadow',
93+
value: 'none'
94+
},
95+
{
96+
property: 'box-shadow',
97+
value: 'inherit'
98+
},
99+
{
100+
property: 'box-shadow',
101+
value: 'initial'
102+
},
103+
{
104+
property: 'box-shadow',
105+
value: 'unset'
106+
}
107+
])
108+
109+
t.deepEqual(actual, expected)
110+
})

test/analyzer/values/z-indexes.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,14 @@ test('It ignores keywords, and global values', t => {
4747
{
4848
property: 'z-index',
4949
value: 'unset'
50+
},
51+
{
52+
property: 'z-index',
53+
value: 'initial'
54+
},
55+
{
56+
property: 'z-index',
57+
value: 'inherit'
5058
}
5159
])
5260

0 commit comments

Comments
 (0)