Skip to content

Commit

Permalink
test: 💍 improve JSON-ML HTML formatting tests
Browse files Browse the repository at this point in the history
  • Loading branch information
streamich committed Dec 1, 2024
1 parent f51f6cc commit 98429d2
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion src/json-ml/__tests__/toHtml.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,27 @@ test('can format HTML with tabbing', () => {
];
const html = toHtml(ml, ' ');
// console.log(html);
expect(html).toBe('<div>\n <hr foo="bar" />\n <span>\n text\n </span>\n</div>');
expect(html).toBe('<div>\n <hr foo="bar" />\n <span>text</span>\n</div>');
});

test('can format HTML fragment with tabbing', () => {
const ml: JsonMlNode = ['', null,
['hr', {foo: 'bar'}],
['span', null, 'text'],
];
const html = toHtml(ml, ' ');
// console.log(html);
expect(html).toBe('<hr foo="bar" />\n<span>text</span>');
});

test('can format HTML fragment with tabbing - 2', () => {
const ml: JsonMlNode = ['div', null,
['', null,
['hr', {foo: 'bar'}],
['span', null, 'text'],
],
];
const html = toHtml(ml, ' ');
// console.log(html);
expect(html).toBe('<div>\n <hr foo="bar" />\n <span>text</span>\n</div>');
});

0 comments on commit 98429d2

Please sign in to comment.