Skip to content

Commit 41355a6

Browse files
Merge pull request #32 from HenrikJoreteg/test-quotes-in-attr-values
Tests for quotes in attr values
2 parents eadaed1 + 8212d52 commit 41355a6

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

test/parse.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,30 @@ test('parse', function (t) {
385385
voidElement: false,children: [ { content: '\n !function() {\n var cookies = document.cookie ? document.cookie.split(\';\') : [];\n // | this less than is triggering probems\n for (var i = 0; i ', type: 'text' } ]
386386
}], 'should parse a script tag');
387387

388+
html = `<div onclick="alert('hi!')">Click me!</div>`
389+
parsed = HTML.parse(html);
390+
t.deepEqual(parsed, [{
391+
type: 'tag',
392+
name: 'div',
393+
attrs: {
394+
onclick: "alert('hi!')"
395+
},
396+
voidElement: false,
397+
children: [ { content: 'Click me!', type: 'text' } ]
398+
}], 'should parse attr values with quotes');
399+
400+
html = `<div onclick='alert("hi!")'>Click me!</div>`
401+
parsed = HTML.parse(html);
402+
t.deepEqual(parsed, [{
403+
type: 'tag',
404+
name: 'div',
405+
attrs: {
406+
onclick: 'alert("hi!")'
407+
},
408+
voidElement: false,
409+
children: [ { content: 'Click me!', type: 'text' } ],
410+
}], 'should parse attr values with quotes, opposite');
411+
388412
t.end();
389413
});
390414

0 commit comments

Comments
 (0)