Skip to content

Commit dfc06de

Browse files
committed
chore: use self-closing tags in tests
1 parent f2e661b commit dfc06de

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

test/cases/html-web-components/expected.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<wcc-picture-frame title="Greenwood">
22
<div class="picture-frame">
3-
<img src="https://www.greenwoodjs.io/assets/greenwood-logo-og.png" alt="Greenwood logo">
4-
<br>
3+
<img src="https://www.greenwoodjs.io/assets/greenwood-logo-og.png" alt="Greenwood logo" />
4+
<br />
55
<span>Author: <span>WCC</span></span>
66
<wcc-caption>
77
<div class="caption">

test/cases/html-web-components/html-web-components.spec.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import chai from 'chai';
1818
import { JSDOM } from 'jsdom';
1919
import fs from 'fs/promises';
2020
import { renderToString } from '../../../src/wcc.js';
21+
import { parseFragment, serialize } from 'parse5';
2122

2223
const expect = chai.expect;
2324

@@ -34,7 +35,8 @@ describe('Run WCC For ', function() {
3435
actualHtml = html;
3536
dom = new JSDOM(actualHtml);
3637
pictureFrame = dom.window.document.querySelectorAll('wcc-picture-frame');
37-
expectedHtml = await fs.readFile(new URL('./expected.html', import.meta.url), 'utf-8');
38+
const rawExpectedHtml = await fs.readFile(new URL('./expected.html', import.meta.url), 'utf-8');
39+
expectedHtml = serialize(parseFragment(rawExpectedHtml));
3840
});
3941

4042
describe(LABEL, function() {
@@ -79,7 +81,7 @@ describe('Run WCC For ', function() {
7981
});
8082

8183
it('should have the expected recursively generated HTML', () => {
82-
expect(expectedHtml.replace(/ /g, '').replace(/\n/g, '')).to.equal(actualHtml.replace(/ /g, '').replace(/\n/g, ''));
84+
expect(actualHtml.replace(/ /g, '').replace(/\n/g, '')).to.equal(expectedHtml.replace(/ /g, '').replace(/\n/g, ''));
8385
});
8486
});
8587
});

0 commit comments

Comments
 (0)