@@ -2,7 +2,7 @@ import fs from 'fs';
2
2
import path from 'path' ;
3
3
import test from 'ava' ;
4
4
import render from '../src' ;
5
- import { closingSingleTagEnum , quoteStyleEnum } from '../types/index.d' ;
5
+ import { closingSingleTagOptionEnum , closingSingleTagTypeEnum , quoteStyleEnum } from '../types/index.d' ;
6
6
import tree from './templates/parser' ;
7
7
8
8
const html = fs . readFileSync ( path . resolve ( __dirname , 'templates/render.html' ) , 'utf8' ) ;
@@ -259,7 +259,7 @@ test('{Options} {singleTag} Attrs', t => {
259
259
} ) ;
260
260
261
261
test ( '{Options} {closingSingleTag} Tag' , t => {
262
- const options = { closingSingleTag : closingSingleTagEnum . Tag } ;
262
+ const options = { closingSingleTag : closingSingleTagOptionEnum . tag } ;
263
263
264
264
const fixture = { tag : 'br' } ;
265
265
const expected = '<br></br>' ;
@@ -268,7 +268,7 @@ test('{Options} {closingSingleTag} Tag', t => {
268
268
} ) ;
269
269
270
270
test ( '{Options} {closingSingleTag} Slash' , t => {
271
- const options = { closingSingleTag : closingSingleTagEnum . Slash } ;
271
+ const options = { closingSingleTag : closingSingleTagOptionEnum . slash } ;
272
272
273
273
const fixture = { tag : 'br' } ;
274
274
const expected = '<br />' ;
@@ -277,7 +277,7 @@ test('{Options} {closingSingleTag} Slash', t => {
277
277
} ) ;
278
278
279
279
test ( '{Options} {closingSingleTag} Slash with content' , t => {
280
- const options = { closingSingleTag : closingSingleTagEnum . Slash } ;
280
+ const options = { closingSingleTag : closingSingleTagOptionEnum . slash } ;
281
281
282
282
const fixture = { tag : 'br' , content : [ 'test' ] } ;
283
283
const expected = '<br />test' ;
@@ -292,6 +292,25 @@ test('{Options} {closingSingleTag} Default', t => {
292
292
t . is ( render ( fixture ) , expected ) ;
293
293
} ) ;
294
294
295
+ test ( '{Options} {closingSingleTag} closeAs' , t => {
296
+ const options = { closingSingleTag : closingSingleTagOptionEnum . closeAs } ;
297
+ const fixture = {
298
+ content : [
299
+ {
300
+ content : [
301
+ {
302
+ content : [ 'Test' , { } ]
303
+ }
304
+ ]
305
+ }
306
+ ] ,
307
+ closeAs : closingSingleTagTypeEnum . default
308
+ } ;
309
+ const expected = '<div><div><div>Test<div></div></div></div>' ;
310
+
311
+ t . is ( render ( fixture , options ) , expected ) ;
312
+ } ) ;
313
+
295
314
test ( '{Options} {quoteAllAttributes} True' , t => {
296
315
const options = { quoteAllAttributes : true } ;
297
316
@@ -339,7 +358,7 @@ test('{Options} {quoteAllAttributes} Required Empty', t => {
339
358
340
359
test ( '{Options} {quoteAllAttributes} Closing slash' , t => {
341
360
const options = {
342
- closingSingleTag : closingSingleTagEnum . Slash ,
361
+ closingSingleTag : closingSingleTagOptionEnum . slash ,
343
362
quoteAllAttributes : false
344
363
} ;
345
364
0 commit comments