@@ -11,6 +11,68 @@ describe('UNIT: Directive', function () {
1111 }
1212 }
1313
14+ describe ( '.split()' , function ( ) {
15+
16+ it ( 'should return array with one empty string for empty string' , function ( ) {
17+ var e = Directive . split ( '' )
18+ assert . strictEqual ( e . length , 1 )
19+ assert . strictEqual ( e [ 0 ] , '' )
20+ } )
21+
22+ it ( 'should return array with the string if it\'s a single clause' , function ( ) {
23+ var e ,
24+ test1 = 'fsef' ,
25+ test2 = 'ffsef + "fse,fsef"' ,
26+ test3 = 'fsef + \'fesfsfe\'' ,
27+ test4 = '\"fsefsf,fsef,fsef\"'
28+
29+ e = Directive . split ( test1 )
30+ assert . strictEqual ( e . length , 1 )
31+ assert . strictEqual ( e [ 0 ] , test1 )
32+
33+ e = Directive . split ( test2 )
34+ assert . strictEqual ( e . length , 1 )
35+ assert . strictEqual ( e [ 0 ] , test2 )
36+
37+ e = Directive . split ( test3 )
38+ assert . strictEqual ( e . length , 1 )
39+ assert . strictEqual ( e [ 0 ] , test3 )
40+
41+ e = Directive . split ( test4 )
42+ assert . strictEqual ( e . length , 1 )
43+ assert . strictEqual ( e [ 0 ] , test4 )
44+ } )
45+
46+ it ( 'should return split multiple clauses correctly' , function ( ) {
47+ var e ,
48+ test1 = [ 'fsef' , 'fsf:fsefsef' ] ,
49+ test2 = [ 'asf-fsef:fsf' , '"efs,sefsf"' ] ,
50+ test3 = [ '\'fsef,sef\'' , 'fse:fsf' ] ,
51+ test4 = [ '\"fsef,fsef\"' , 'sefsef\'fesfsf' ]
52+
53+ e = Directive . split ( test1 . join ( ',' ) )
54+ assert . strictEqual ( e . length , 2 )
55+ assert . strictEqual ( e [ 0 ] , test1 [ 0 ] )
56+ assert . strictEqual ( e [ 1 ] , test1 [ 1 ] )
57+
58+ e = Directive . split ( test2 . join ( ',' ) )
59+ assert . strictEqual ( e . length , 2 )
60+ assert . strictEqual ( e [ 0 ] , test2 [ 0 ] )
61+ assert . strictEqual ( e [ 1 ] , test2 [ 1 ] )
62+
63+ e = Directive . split ( test3 . join ( ',' ) )
64+ assert . strictEqual ( e . length , 2 )
65+ assert . strictEqual ( e [ 0 ] , test3 [ 0 ] )
66+ assert . strictEqual ( e [ 1 ] , test3 [ 1 ] )
67+
68+ e = Directive . split ( test4 . join ( ',' ) )
69+ assert . strictEqual ( e . length , 2 )
70+ assert . strictEqual ( e [ 0 ] , test4 [ 0 ] )
71+ assert . strictEqual ( e [ 1 ] , test4 [ 1 ] )
72+ } )
73+
74+ } )
75+
1476 describe ( '.parse()' , function ( ) {
1577
1678 it ( 'should return undefined if directive name does not have correct prefix' , function ( ) {
0 commit comments