@@ -14,7 +14,7 @@ describe('lib/utils', function() {
1414 sandbox . restore ( ) ;
1515 } ) ;
1616
17- describe ( 'clean' , function ( ) {
17+ describe ( 'clean() ' , function ( ) {
1818 it ( 'should remove the wrapping function declaration' , function ( ) {
1919 expect (
2020 utils . clean ( 'function (one, two, three) {\n//code\n}' ) ,
@@ -149,7 +149,7 @@ describe('lib/utils', function() {
149149 } ) ;
150150 } ) ;
151151
152- describe ( 'stringify' , function ( ) {
152+ describe ( 'stringify() ' , function ( ) {
153153 var stringify = utils . stringify ;
154154
155155 it ( 'should return an object representation of a string created with a String constructor' , function ( ) {
@@ -525,7 +525,7 @@ describe('lib/utils', function() {
525525 } ) ;
526526 } ) ;
527527
528- describe ( 'type' , function ( ) {
528+ describe ( 'type() ' , function ( ) {
529529 /* eslint no-extend-native: off */
530530
531531 var type = utils . type ;
@@ -588,7 +588,7 @@ describe('lib/utils', function() {
588588 } ) ;
589589 } ) ;
590590
591- describe ( 'isPromise' , function ( ) {
591+ describe ( 'isPromise() ' , function ( ) {
592592 it ( 'should return true if the value is Promise-ish' , function ( ) {
593593 expect (
594594 utils . isPromise ( {
@@ -612,7 +612,7 @@ describe('lib/utils', function() {
612612 } ) ;
613613 } ) ;
614614
615- describe ( 'escape' , function ( ) {
615+ describe ( 'escape() ' , function ( ) {
616616 it ( 'replaces the usual xml suspects' , function ( ) {
617617 expect ( utils . escape ( '<a<bc<d<' ) , 'to be' , '<a<bc<d<' ) ;
618618 expect ( utils . escape ( '>a>bc>d>' ) , 'to be' , '>a>bc>d>' ) ;
@@ -634,7 +634,7 @@ describe('lib/utils', function() {
634634 } ) ;
635635 } ) ;
636636
637- describe ( 'deprecate' , function ( ) {
637+ describe ( 'deprecate() ' , function ( ) {
638638 var emitWarning ;
639639
640640 beforeEach ( function ( ) {
@@ -674,7 +674,7 @@ describe('lib/utils', function() {
674674 } ) ;
675675 } ) ;
676676
677- describe ( 'warn' , function ( ) {
677+ describe ( 'warn() ' , function ( ) {
678678 var emitWarning ;
679679
680680 beforeEach ( function ( ) {
@@ -710,21 +710,25 @@ describe('lib/utils', function() {
710710 } ) ;
711711 } ) ;
712712
713- describe ( 'sQuote/dQuote ' , function ( ) {
713+ describe ( 'sQuote() ' , function ( ) {
714714 var str = 'xxx' ;
715715
716716 it ( 'should return its input as string wrapped in single quotes' , function ( ) {
717717 var expected = "'xxx'" ;
718718 expect ( utils . sQuote ( str ) , 'to be' , expected ) ;
719719 } ) ;
720+ } ) ;
721+
722+ describe ( 'dQuote()' , function ( ) {
723+ var str = 'xxx' ;
720724
721725 it ( 'should return its input as string wrapped in double quotes' , function ( ) {
722726 var expected = '"xxx"' ;
723727 expect ( utils . dQuote ( str ) , 'to be' , expected ) ;
724728 } ) ;
725729 } ) ;
726730
727- describe ( 'createMap' , function ( ) {
731+ describe ( 'createMap() ' , function ( ) {
728732 it ( 'should return an object with a null prototype' , function ( ) {
729733 expect ( Object . getPrototypeOf ( utils . createMap ( ) ) , 'to be' , null ) ;
730734 } ) ;
@@ -743,4 +747,26 @@ describe('lib/utils', function() {
743747 ) ;
744748 } ) ;
745749 } ) ;
750+
751+ describe ( 'slug()' , function ( ) {
752+ it ( 'should convert the string to lowercase' , function ( ) {
753+ expect ( utils . slug ( 'FOO' ) , 'to be' , 'foo' ) ;
754+ } ) ;
755+
756+ it ( 'should convert whitespace to dashes' , function ( ) {
757+ expect (
758+ utils . slug ( 'peanut butter\nand\tjelly' ) ,
759+ 'to be' ,
760+ 'peanut-butter-and-jelly'
761+ ) ;
762+ } ) ;
763+
764+ it ( 'should strip non-alphanumeric and non-dash characters' , function ( ) {
765+ expect ( utils . slug ( 'murder-hornets!!' ) , 'to be' , 'murder-hornets' ) ;
766+ } ) ;
767+
768+ it ( 'should disallow consecutive dashes' , function ( ) {
769+ expect ( utils . slug ( 'poppies & fritz' ) , 'to be' , 'poppies-fritz' ) ;
770+ } ) ;
771+ } ) ;
746772} ) ;
0 commit comments