Skip to content

Commit f561e6b

Browse files
committed
test: node property closeAs, issue #48
1 parent 6892ede commit f561e6b

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

test/test-core.spec.ts

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import fs from 'fs';
22
import path from 'path';
33
import test from 'ava';
44
import render from '../src';
5-
import {closingSingleTagEnum, quoteStyleEnum} from '../types/index.d';
5+
import {closingSingleTagOptionEnum, closingSingleTagTypeEnum, quoteStyleEnum} from '../types/index.d';
66
import tree from './templates/parser';
77

88
const html = fs.readFileSync(path.resolve(__dirname, 'templates/render.html'), 'utf8');
@@ -259,7 +259,7 @@ test('{Options} {singleTag} Attrs', t => {
259259
});
260260

261261
test('{Options} {closingSingleTag} Tag', t => {
262-
const options = {closingSingleTag: closingSingleTagEnum.Tag};
262+
const options = {closingSingleTag: closingSingleTagOptionEnum.tag};
263263

264264
const fixture = {tag: 'br'};
265265
const expected = '<br></br>';
@@ -268,7 +268,7 @@ test('{Options} {closingSingleTag} Tag', t => {
268268
});
269269

270270
test('{Options} {closingSingleTag} Slash', t => {
271-
const options = {closingSingleTag: closingSingleTagEnum.Slash};
271+
const options = {closingSingleTag: closingSingleTagOptionEnum.slash};
272272

273273
const fixture = {tag: 'br'};
274274
const expected = '<br />';
@@ -277,7 +277,7 @@ test('{Options} {closingSingleTag} Slash', t => {
277277
});
278278

279279
test('{Options} {closingSingleTag} Slash with content', t => {
280-
const options = {closingSingleTag: closingSingleTagEnum.Slash};
280+
const options = {closingSingleTag: closingSingleTagOptionEnum.slash};
281281

282282
const fixture = {tag: 'br', content: ['test']};
283283
const expected = '<br />test';
@@ -292,6 +292,25 @@ test('{Options} {closingSingleTag} Default', t => {
292292
t.is(render(fixture), expected);
293293
});
294294

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+
295314
test('{Options} {quoteAllAttributes} True', t => {
296315
const options = {quoteAllAttributes: true};
297316

@@ -339,7 +358,7 @@ test('{Options} {quoteAllAttributes} Required Empty', t => {
339358

340359
test('{Options} {quoteAllAttributes} Closing slash', t => {
341360
const options = {
342-
closingSingleTag: closingSingleTagEnum.Slash,
361+
closingSingleTag: closingSingleTagOptionEnum.slash,
343362
quoteAllAttributes: false
344363
};
345364

0 commit comments

Comments
 (0)