Skip to content

Commit

Permalink
fix inferOption #54
Browse files Browse the repository at this point in the history
  • Loading branch information
egoist committed Jan 12, 2018
1 parent 50e3cd2 commit 10d7523
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import Loaders from './loaders'
* Otherwise fallback to default value
*/
function inferOption(option, defaultValue) {
if (option === false) return false
if (option && typeof option === 'object') return option
return option ? {} : defaultValue
}
Expand Down
11 changes: 11 additions & 0 deletions test/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,17 @@ console.log(undefined, undefined);
"
`;

exports[`inject:false: js code 1`] = `
"'use strict';
var css = \\"body {\\\\n color: red;\\\\n}\\\\n\\";
var css$1 = \\".bar {\\\\n color: red;\\\\n}\\\\n\\";
console.log(css, css$1);
"
`;

exports[`inject:top: js code 1`] = `
"'use strict';
Expand Down
8 changes: 8 additions & 0 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,3 +242,11 @@ snapshot({
]
}
})

snapshot({
title: 'inject:false',
input: 'simple/index.js',
options: {
inject: false
}
})

0 comments on commit 10d7523

Please sign in to comment.