forked from ashi009/node-fast-html-parser
-
Notifications
You must be signed in to change notification settings - Fork 104
/
242.js
29 lines (27 loc) · 774 Bytes
/
242.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const { parse } = require('@test/test-target');
describe('issue 242', function () {
it(`a.rawAttrs returns 'href="/" rel="home"' but a.getAttribute("href') returns undefined`, function () {
const html = `<div><a href="/" rel="home">Git Hub</a></div>`;
const root = parse(html);
const links = root.querySelectorAll("a");
const [a] = links;
a.rawAttrs.should.eql('href="/" rel="home"');
a.getAttribute('href').should.eql('/');
});
it(`get code`, function () {
const html = `<pre>
<code>test</code>
</pre>`;
const root = parse(html, {
blockTextElements: {
script: true,
noscript: true,
style: true,
pre: false
}
});
const list = root.getElementsByTagName("code");
const [code] = list;
code.text.should.eql('test');
});
});