-
Notifications
You must be signed in to change notification settings - Fork 22
/
index.js
50 lines (45 loc) · 1.33 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
const {lint} = require('./utils')
const SAFE_SCSS_EXAMPLE = `
.Component { color: $gray-500; }
`
describe('stylelint-config-primer', () => {
it('stylelint runs with our config', () => {
return lint('.bold { font-weight: bold; }').then(data => {
expect(data).not.toHaveErrored()
expect(data).toHaveResultsLength(1)
})
})
it('produces zero warnings with valid css', () => {
return lint(`
.selector-x { width: 10%; }
.selector-y { width: 20%; }
.selector-z { width: 30%; }
`).then(data => {
expect(data).not.toHaveErrored()
expect(data).toHaveResultsLength(1)
expect(data).toHaveWarningsLength(0)
})
})
it('generates one warning with invalid css', () => {
return lint(`
.foo {
color: #fff;
top: .2em;
}
`).then(data => {
expect(data).toHaveErrored()
expect(data).toHaveWarningsLength(2)
expect(data).toHaveWarnings([
'Expected "top" to come before "color" (order/properties-order)',
'Expected a leading zero (number-leading-zero)'
])
})
})
it('does not report any deprecations', () => {
return lint(SAFE_SCSS_EXAMPLE).then(data => {
expect(data).not.toHaveErrored()
expect(data).not.toHaveResultsLength(0)
expect(data).toHaveDeprecationsLength(0)
})
})
})