Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions test/security.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,18 @@ test('security', async function (t) {
}
)

await t.test(
'should make sure href attributes render (unsafe)',
async function () {
assert.equal(
toHtml(h('a', {href: 'https://a?b&c'}), {
allowParseErrors: true,
}),
'<a href="https://a?b&c">',
)
}
)

await t.test('should make sure texts are encoded (safe)', async function () {
assert.equal(
toHtml(u('root', u('text', '<script>alert(1)</script>'))),
Expand Down