Skip to content

Commit

Permalink
test: more tests for nonbooleanattributes
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanarmstrong committed Jun 5, 2023
1 parent cefe12d commit cb8d1e2
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1580,4 +1580,17 @@ describe('sanitizeHtml', function() {
assert.equal(sanitizeHtml('<a href target="_blank">hello</a>', {
}), '<a target="_blank">hello</a>');
});
it('should not remove non-boolean attributes that are empty when disabled', function() {
assert.equal(sanitizeHtml('<a href target="_blank">hello</a>', {
nonBooleanAttributes: []
}), '<a href target="_blank">hello</a>');
});
it('should not remove boolean attributes that are empty', function() {
assert.equal(sanitizeHtml('<input checked form type="checkbox" />', {
allowedTags: 'input',
allowedAttributes: {
input: [ 'checked', 'form', 'type' ]
}
}), '<input checked type="checkbox" />');
});
});

0 comments on commit cb8d1e2

Please sign in to comment.