Skip to content

Commit

Permalink
Fix broken tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonkemp committed Jun 1, 2022
1 parent b86a2a2 commit b5898a4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
5 changes: 4 additions & 1 deletion packages/list-stylesheets/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ function decodeHTMLEntities(str) {
}

module.exports = (html, options) => {
const opts = options || {};
const results = {};
const codeBlocks = {
EJS: { start: '<%', end: '%>' },
Expand Down Expand Up @@ -44,7 +45,9 @@ module.exports = (html, options) => {
const encodeEntities = _html => encodeCodeBlocks(_html);
const decodeEntities = _html => decodeCodeBlocks(_html);

const dom = new JSDOM(encodeEntities(html));
const dom = new JSDOM(encodeEntities(html), {
contentType: opts.xmlMode ? 'application/xhtml+xml' : 'text/html'
});

results.hrefs = [];

Expand Down
7 changes: 4 additions & 3 deletions packages/style-data/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ const mediaQueryText = require('mediaquery-text');
const jsdom = require('jsdom');
const { JSDOM } = jsdom;

// const pick = require('pick-util');

function replaceCodeBlock(html, re, block) {
return html.replace(re, () => block);
}
Expand All @@ -13,6 +11,7 @@ function decodeHTMLEntities(str) {
}

module.exports = (html, options, callback) => {
const opts = options || {};
const results = {};

const codeBlocks = {
Expand Down Expand Up @@ -54,7 +53,9 @@ module.exports = (html, options, callback) => {
let styleDataList;
let styleData;

const dom = new JSDOM(encodeEntities(html));
const dom = new JSDOM(encodeEntities(html), {
contentType: opts.xmlMode ? 'application/xhtml+xml' : 'text/html'
});

results.css = [];

Expand Down
3 changes: 2 additions & 1 deletion test/expected/codeblocks.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<html>
<head></head>
<head>
</head>
<body style="color: red;">
{{#if `age <= 40`}}<p style="color: red;">Young</p>{{/if}}
</body>
Expand Down

0 comments on commit b5898a4

Please sign in to comment.