Skip to content

Commit

Permalink
test: fix whitelist tests
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickhulce committed Apr 17, 2017
1 parent 67eb71f commit 98150d5
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 8 deletions.
1 change: 1 addition & 0 deletions test/fixtures/non-whitelisted/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
const content = 'whitelist-check'
1 change: 0 additions & 1 deletion test/fixtures/non-whitelisted/non-whitelisted.js

This file was deleted.

2 changes: 1 addition & 1 deletion test/fixtures/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module.exports = {
new NukeCssPlugin({
sources: [`file://${__dirname}/*.html`],
sourceMap: true,
sourceWhitelist: ['whitelisted/'],
sourceWhitelist: ['/whitelisted/'],
sourceBlacklist: ['blacklisted.js'],
nukecssOptions: {
whitelist: ['unused-but-whitelisted']
Expand Down
4 changes: 0 additions & 4 deletions test/fixtures/whitelisted/entry.css
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@
content: 'fa';
}

.non-whitelisted {
content: 'fa';
}

:local .my-local-class :global .fa-table {
content: 'locally scoped';
}
2 changes: 1 addition & 1 deletion test/fixtures/whitelisted/entry.extracted.css
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ a:hover {
content: 'fa';
}

.non-whitelisted {
.whitelist-check {
content: 'fa';
}

Expand Down
2 changes: 2 additions & 0 deletions test/fixtures/whitelisted/entry.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
const data = require('./entry.css')
const data2 = require('./entry.extracted.css')
require('./blacklisted')
require('../non-whitelisted')
const myIcons = {
'fa-address-book-o': true,
'fa': true,
Expand Down
2 changes: 1 addition & 1 deletion test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ describe('NukeCssPlugin', () => {
})

it('should not use non-whitelisted sources', () => {
expect(fileStats['out.css'].content).to.not.contain('.non-whitelisted')
expect(fileStats['out.css'].content).to.not.contain('.whitelist-check')
})

it('should not use blacklisted sources', () => {
Expand Down

0 comments on commit 98150d5

Please sign in to comment.