Skip to content

Commit

Permalink
Merge pull request #393 from markedjs/fix-v6
Browse files Browse the repository at this point in the history
  • Loading branch information
UziTech authored Sep 4, 2024
2 parents 82f8e9b + 049cc7f commit 88b25c4
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 33 deletions.
6 changes: 5 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class HtmlDiffer {

// just pass in keys for the left and right html, the original strings are no longer used
// after tokenize()
const diff = htmlDiffer.diff('html1', 'html2');
const diff = htmlDiffer.diff('html1', 'html2', this.options);

return handleMasks(diff);
}
Expand All @@ -58,6 +58,10 @@ export class HtmlDiffer {
* @returns {Boolean}
*/
async isEqual(html1, html2) {
if (html1 === html2) {
return true;
}

const diff = await this.diffHtml(html1, html2);

return (diff.length === 1 && !diff[0].added && !diff[0].removed);
Expand Down
57 changes: 30 additions & 27 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@
"parse5-sax-parser": "^7.0.0"
},
"devDependencies": {
"@markedjs/eslint-config": "^1.0.1",
"@markedjs/eslint-config": "^1.0.2",
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/commit-analyzer": "^13.0.0",
"@semantic-release/git": "^10.0.1",
"@semantic-release/github": "^10.1.3",
"@semantic-release/github": "^10.3.1",
"@semantic-release/npm": "^12.0.1",
"@semantic-release/release-notes-generator": "^14.0.1",
"eslint": "^9.8.0",
"eslint": "^9.9.1",
"globals": "^15.9.0",
"mocha": "^10.7.0",
"mocha": "^10.7.3",
"must": "^0.13.4",
"nyc": "^17.0.0",
"semantic-release": "^24.0.0"
"semantic-release": "^24.1.0"
},
"scripts": {
"test": "npm run lint && npm run unit-test && npm run func-test && npm run logger-test && npm run cover",
Expand Down
7 changes: 7 additions & 0 deletions test/differ/isEqual.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,4 +180,11 @@ describe('\'isEqual\'', function() {

invalidPreset.must.throw(Error);
});

it('blank values are equal', async function() {
const htmlDiffer = new HtmlDiffer();
const isEqual = await htmlDiffer.isEqual('', '');

isEqual.must.be.true();
});
});

0 comments on commit 88b25c4

Please sign in to comment.