forked from dteviot/WebToEpub
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUtestTranslationChickenParser.js
32 lines (27 loc) · 1.16 KB
/
UtestTranslationChickenParser.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
30
31
32
"use strict";
module("TranslationChicken");
test("findContent", function (assert) {
let dom = new DOMParser().parseFromString(TranslationChickenSample1, "text/html");
let parser = new TranslationChickenParser();
let actual = parser.findContent(dom);
assert.equal(actual.children[0].className, "featured-media");
// check sill OK if called second time
actual = parser.findContent(dom);
assert.equal(actual.children[0].className, "featured-media");
});
let TranslationChickenSample1 =
`<!DOCTYPE html>
<head>
<title>Re:Zero Arc 3 Interlude II [Let’s Eat] (1/2) – START READING HERE – TranslationChicken</title>
<base href="https://translationchicken.com/2016/09/12/rezero-arc-3-interlude-ii-lets-eat-12/" />
</head>
<body>
<div class="featured-media">
<img width="1024" height="576" src="https://translationchicken.files.wordpress.com/2016/09/arc3interludeii.jpg?w=1024" class="attachment-baskerville-2-post-image size-baskerville-2-post-image wp-post-image">
</div>
<div class="post-content clear">
<p style="text-align:center;"><em><strong>**********Note from Translation Chicken**********</strong></em></p>
</div>
</body>
</html>
`