8000 add tests comment range · murindwaz/purgecss@92f6850 · GitHub
Skip to content

Commit 92f6850

Browse files
committed
add tests comment range
1 parent 5faebc5 commit 92f6850

3 files changed

Lines changed: 51 additions & 0 deletions

File tree

__tests__/purgecssDefault.test.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,26 @@ describe('purge methods with files and default extractor', () => {
199199
})
200200
})
201201

202+
describe('ignore comment range', () => {
203+
let purgecssResult
204+
beforeAll(() => {
205+
purgecssResult = new Purgecss({
206+
content: [`${root}ignore_comment_range/index.html`],
207+
css: [`${root}ignore_comment_range/index.css`]
208+
}).purge()[0].css
209+
})
210+
211+
it('ignores h1, h3, h5, h6', () => {
212+
['h1', 'h3', 'h5', 'h6'].forEach(selector => {
213+
expect(purgecssResult.includes(selector)).toBe(true)
214+
})
215+
})
216+
217+
it('removes h4', () => {
218+
expect(purgecssResult.includes('h4')).toBe(false)
219+
})
220+
})
221+
202222
describe('font-face', () => {
203223
it('keeps font-face', () => {
204224
const purgecss = new Purgecss({
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/* purgecss start ignore */
2+
h1 {
3+
color: blue;
4+
}
5+
6+
h3 {
7+
color: green;
8+
}
9+
/* purgecss end ignore */
10+
11+
h4 {
12+
color: purple;
13+
}
14+
15+
/* purgecss start ignore */
16+
h5 {
17+
color: pink;
18+
}
19+
20+
h6 {
21+
color: lightcoral;
22+
}
23+
24+
/* purgecss end ignore */
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<html>
2+
3+
<body>
4+
<h2>Hmmmm</h2>
5+
</body>
6+
7+
</html>

0 commit comments

Comments
 (0)