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) {
16
16
var context = options && typeof options . context === 'string'
17
17
? options . context
18
18
: '' ;
19
- var hashPrefix = options && typeof options . hashPrefix
19
+ var hashPrefix = options && typeof options . hashPrefix === 'string'
20
20
? options . hashPrefix
21
21
: '' ;
22
22
Original file line number Diff line number Diff line change @@ -6,11 +6,16 @@ describe('generic-names', function () {
6
6
7
7
it ( 'should use cwd if no context provided' , function ( ) {
8
8
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 ' ) ;
10
10
} ) ;
11
11
12
12
it ( 'should generate another hash for the provided context' , function ( ) {
13
13
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' ) ;
15
20
} ) ;
16
21
} ) ;
You can’t perform that action at this time.
0 commit comments