Skip to content

Commit 471b30d

Browse files
author
Bart Veneman
committed
Improve some tests
1 parent f4ce5d2 commit 471b30d

File tree

3 files changed

+31
-3
lines changed

3 files changed

+31
-3
lines changed

src/aggregate-collection.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ class AggregateCollection {
7676
}
7777
}
7878

79+
// TODO: can we avoid this sort()? It's slow
7980
/** @type Number[] */
8081
const sorted = this._items.slice().sort((a, b) => a - b)
8182
const min = sorted[0]

src/values/colors.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,7 @@ Colors('does not report false positives for color keywords', () => {
662662
663663
/* Not the black color keyword */
664664
font-family: Arial Black, Arial Bold, Gadget, sans-serif;
665+
font: 1em/1 Black;
665666
}
666667
`).values.colors
667668
const expected = {

src/values/vendor-prefix.test.js

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,28 @@ VendorPrefix('finds simple prefixes', () => {
1111
width: -webkit-max-content;
1212
box-shadow: 0 0 0 3px -moz-mac-focusring;
1313
position: -webkit-sticky;
14+
-webkit-transition: -webkit-transform 0.3s ease-out;
15+
-moz-transition: -moz-transform 0.3s ease-out;
16+
-o-transition: -o-transform 0.3s ease-out;
1417
}
1518
16-
false-positive {
19+
not-a-prefix {
1720
background: var(--test);
21+
margin: -0.3em;
1822
}
1923
`
2024
const actual = analyze(fixture).values.prefixes
2125
const expected = {
22-
total: 4,
23-
totalUnique: 4,
26+
total: 7,
27+
totalUnique: 7,
2428
unique: {
2529
'-moz-max-content': 1,
2630
'-webkit-max-content': 1,
2731
'0 0 0 3px -moz-mac-focusring': 1,
2832
'-webkit-sticky': 1,
33+
'-webkit-transform 0.3s ease-out': 1,
34+
'-moz-transform 0.3s ease-out': 1,
35+
'-o-transform 0.3s ease-out': 1,
2936
},
3037
uniquenessRatio: 1
3138
}
@@ -61,4 +68,23 @@ VendorPrefix('finds nested prefixes', () => {
6168
assert.equal(actual, expected)
6269
})
6370

71+
VendorPrefix.skip('finds DEEPLY nested prefixes', () => {
72+
const fixture = `
73+
value-vendor-prefix-deeply-nested {
74+
width: var(--test, -webkit-max-content);
75+
}
76+
`
77+
const actual = analyze(fixture).values.prefixes
78+
const expected = {
79+
total: 1,
80+
totalUnique: 1,
81+
unique: {
82+
'var(--test, -webkit-max-content)': 1,
83+
},
84+
uniquenessRatio: 1
85+
}
86+
87+
assert.equal(actual, expected)
88+
})
89+
6490
VendorPrefix.run()

0 commit comments

Comments
 (0)