@@ -133,6 +133,28 @@ describe('highlight', () => {
133133 validateHtmlAsync ( result , done ) ;
134134 } ) ;
135135
136+ it ( 'wrap: false (with mark)' , done => {
137+ const result = highlight ( testString , { gutter : false , wrap : false , hljs : true , lang : 'json' , mark : '1' } ) ;
138+ hljs . configure ( { classPrefix : 'hljs-' } ) ;
139+ result . should . eql ( [
140+ '<pre><code class="hljs json">' ,
141+ hljs . highlight ( 'json' , testString ) . value . replace ( '{' , '<mark>{</mark>' ) ,
142+ '</code></pre>'
143+ ] . join ( '' ) ) ;
144+ validateHtmlAsync ( result , done ) ;
145+ } ) ;
146+
147+ it ( 'wrap: false (retain trailing newline)' , done => {
148+ const result = highlight ( testString + '\n' , { gutter : false , wrap : false , hljs : true , lang : 'json' } ) ;
149+ hljs . configure ( { classPrefix : 'hljs-' } ) ;
150+ result . should . eql ( [
151+ '<pre><code class="hljs json">' ,
152+ hljs . highlight ( 'json' , testString ) . value ,
153+ '\n</code></pre>'
154+ ] . join ( '' ) ) ;
155+ validateHtmlAsync ( result , done ) ;
156+ } ) ;
157+
136158 it ( 'firstLine' , done => {
137159 const result = highlight ( testString , { firstLine : 3 } ) ;
138160 assertResult ( result , gutter ( 3 , 6 ) , code ( testString ) ) ;
@@ -203,24 +225,38 @@ describe('highlight', () => {
203225 } ) ;
204226
205227 it ( 'tab' , done => {
228+ const spaces = ' ' ;
206229 const str = [
207230 'function fib(i){' ,
208231 '\tif (i <= 1) return i;' ,
209232 '\treturn fib(i - 1) + fib(i - 2);' ,
210233 '}'
211234 ] . join ( '\n' ) ;
212235
213- const result = highlight ( str , { tab : ' ' , lang : 'js' } ) ;
236+ const result = highlight ( str , { tab : spaces , lang : 'js' } ) ;
214237
215238 result . should . eql ( [
216239 '<figure class="highlight js"><table><tr>' ,
217240 gutter ( 1 , 4 ) ,
218- code ( str . replace ( / \t / g, ' ' ) , 'js' ) ,
241+ code ( str . replace ( / \t / g, spaces ) , 'js' ) ,
219242 end
220243 ] . join ( '' ) ) ;
221244 validateHtmlAsync ( result , done ) ;
222245 } ) ;
223246
247+ it ( 'tab with wrap:false' , done => {
248+ const spaces = ' ' ;
249+ const result = highlight ( '\t' + testString , { gutter : false , wrap : false , hljs : true , lang : 'json' , tab : spaces } ) ;
250+ hljs . configure ( { classPrefix : 'hljs-' } ) ;
251+ result . should . eql ( [
252+ '<pre><code class="hljs json">' ,
253+ spaces ,
254+ hljs . highlight ( 'json' , testString ) . value ,
255+ '</code></pre>'
256+ ] . join ( '' ) ) ;
257+ validateHtmlAsync ( result , done ) ;
258+ } ) ;
259+
224260 it ( 'escape html entity' , done => {
225261 const str = [
226262 'deploy:' ,
0 commit comments