@@ -124,18 +124,33 @@ describe('PostHTML-Parser test', function() {
124124 } ) ;
125125
126126 it ( 'should be parse directive' , function ( ) {
127- var customDirectives = { directives : [
128- { name : '?php' , start : '<' , end : '>' }
129- ] } ;
127+ var options = {
128+ directives : [
129+ { name : '?php' , start : '<' , end : '>' }
130+ ]
131+ } ;
130132
131- expect ( parser ( '<?php echo "Hello word"; ?>' , customDirectives ) ) . to . eql ( [ '<?php echo "Hello word"; ?>' ] ) ;
133+ expect ( parser ( '<?php echo "Hello word"; ?>' , options ) ) . to . eql ( [ '<?php echo "Hello word"; ?>' ] ) ;
134+ } ) ;
135+
136+ it ( 'should be parse regular expression directive' , function ( ) {
137+ var options = {
138+ directives : [
139+ { name : / \? ( p h p | = ) .* / , start : '<' , end : '>' }
140+ ]
141+ } ;
142+
143+ expect ( parser ( '<?php echo "Hello word"; ?>' , options ) ) . to . eql ( [ '<?php echo "Hello word"; ?>' ] ) ;
144+ expect ( parser ( '<?="Hello word"?>' , options ) ) . to . eql ( [ '<?="Hello word"?>' ] ) ;
132145 } ) ;
133146
134147 it ( 'should be parse directives and tag' , function ( ) {
135- var customDirectives = { directives : [
136- { name : '!doctype' , start : '<' , end : '>' } ,
137- { name : '?php' , start : '<' , end : '>' }
138- ] } ;
148+ var options = {
149+ directives : [
150+ { name : '!doctype' , start : '<' , end : '>' } ,
151+ { name : '?php' , start : '<' , end : '>' }
152+ ]
153+ } ;
139154
140155 var html = '<!doctype html><html><?php echo \"Hello word\"; ?></html>' ;
141156 var tree = [
@@ -146,7 +161,7 @@ describe('PostHTML-Parser test', function() {
146161 }
147162 ] ;
148163
149- expect ( parser ( html , customDirectives ) ) . to . eql ( tree ) ;
164+ expect ( parser ( html , options ) ) . to . eql ( tree ) ;
150165 } ) ;
151166
152167 it ( 'should be parse tag' , function ( ) {
0 commit comments