forked from ashi009/node-fast-html-parser
-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
const { parse } = require('@test/test-target'); | ||
|
||
// https://github.com/taoqf/node-html-parser/issues/203 | ||
describe.only('issue 203', function () { | ||
it('code element should not be null', function () { | ||
const root = parse(`<html><body><pre><code class="language-typescript">type Foo = { foo: 'bar' }</code></pre></body></html>`, { | ||
blockTextElements: { | ||
script: true, | ||
noscript: true, | ||
style: true, | ||
} | ||
}); | ||
const t = root.firstChild.firstChild.firstChild.firstChild; | ||
t.toString().should.eql(`<code class="language-typescript">type Foo = { foo: 'bar' }</code>`); | ||
|
||
const code = root.querySelector("code"); | ||
code.toString().should.eql(`<code class="language-typescript">type Foo = { foo: 'bar' }</code>`); | ||
}); | ||
it('code element should not be null', function () { | ||
const root = parse(` <div class="clip_details-description description-wrapper iris_desc"> | ||
<p class="first">Country music legend, Trish Cotton, has something to say.</p> | ||
<p> | ||
Written by Kyle Kasabian (@kylekasabian) <br /> | ||
Directed by Derek Mari (@directorderek)<br /> | ||
Director of Photography: Peter Mickelsen<br /> | ||
Produced by Derek Mari and Kyle Kasabian<br /> | ||
Edited by Derek Mari | ||
</p> | ||
<p>Starring: Alyssa Sabo, Janine Hogan, and Kyle Kasabian</p> | ||
<p> | ||
Assistant Camera: Casey Schoch<br /> | ||
Production Sound: David Alvarez<br /> | ||
Production Assistant: Keith Ahlstrom | ||
</p> | ||
<p>Music by Morgan Matthews</p> | ||
<p> | ||
Blink & Miss Productions<br /> | ||
Bad Cat Films | ||
</p> | ||
</div> | ||
</div>`,); | ||
const description = root.querySelector('.description-wrapper'); | ||
description.toString().should.not.eql(null); | ||
}); | ||
}); |