/
01-basic.js
57 lines (53 loc) · 1.24 KB
/
01-basic.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
(function () {
function RunningInNode () {
return(
(typeof require) == "function"
&&
(typeof exports) == "object"
&&
(typeof module) == "object"
&&
(typeof __filename) == "string"
&&
(typeof __dirname) == "string"
);
}
if (!RunningInNode()) {
if (!this.Tautologistics)
this.Tautologistics = {};
if (!this.Tautologistics.NodeHtmlParser)
this.Tautologistics.NodeHtmlParser = {};
if (!this.Tautologistics.NodeHtmlParser.Tests)
this.Tautologistics.NodeHtmlParser.Tests = [];
exports = {};
this.Tautologistics.NodeHtmlParser.Tests.push(exports);
}
exports.name = "Basic test";
exports.html = "<html><title>The Title</title><body>Hello world</body></html>";
exports.expected =
[ { raw: 'html'
, data: 'html'
, type: 'tag'
, name: 'html'
, children:
[ { raw: 'title'
, data: 'title'
, type: 'tag'
, name: 'title'
, children: [ { raw: 'The Title', data: 'The Title', type: 'text' } ]
}
, { raw: 'body'
, data: 'body'
, type: 'tag'
, name: 'body'
, children:
[ { raw: 'Hello world'
, data: 'Hello world'
, type: 'text'
}
]
}
]
}
];
})();