File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ module.exports = function createGenerator(pattern, options) {
1616 var context = options && typeof options . context === 'string'
1717 ? options . context
1818 : '' ;
19- var hashPrefix = options && typeof options . hashPrefix
19+ var hashPrefix = options && typeof options . hashPrefix === 'string'
2020 ? options . hashPrefix
2121 : '' ;
2222
Original file line number Diff line number Diff line change @@ -6,11 +6,16 @@ describe('generic-names', function () {
66
77 it ( 'should use cwd if no context provided' , function ( ) {
88 var generate = genericNames ( '[name]__[local]___[hash:base64:5]' ) ;
9- assert . equal ( generate ( 'foo' , '/test/case/source.css' ) , 'source__foo___2bpA4 ' ) ;
9+ assert . equal ( generate ( 'foo' , '/test/case/source.css' ) , 'source__foo___2e670 ' ) ;
1010 } ) ;
1111
1212 it ( 'should generate another hash for the provided context' , function ( ) {
1313 var generate = genericNames ( '[name]__[local]___[hash:base64:5]' , { context : '/test' } ) ;
14- assert . equal ( generate ( 'foo' , '/test/case/source.css' ) , 'source__foo___CEQPZ' ) ;
14+ assert . equal ( generate ( 'foo' , '/test/case/source.css' ) , 'source__foo___19xFw' ) ;
15+ } ) ;
16+
17+ it ( 'should generate another hash for the provided hashPrefix' , function ( ) {
18+ var generate = genericNames ( '[name]__[local]___[hash:base64:5]' , { context : '/test' , hashPrefix : '--' } ) ;
19+ assert . equal ( generate ( 'foo' , '/test/case/source.css' ) , 'source__foo___3T0Un' ) ;
1520 } ) ;
1621} ) ;
You can’t perform that action at this time.
0 commit comments