forked from azer/strip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
29 lines (22 loc) · 762 Bytes
/
test.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
var test = require('tap').test;
var strip = require("./");
test('strips html tags', function(t){
var html = '<p> hello <a href="http://foo.com/?q=123">world</a> </p>';
t.equal(strip(html), 'hello world');
t.end();
});
test('html comments do not fail', function(t){
var html = '<div>this has a <!--comment--> in it</div>';
t.equal(strip(html), 'this has a <!--comment--> in it');
t.end();
});
test('html markup inside comments do not fail', function(t){
var html = '<div>this has markup in a <!--comment <p>markup</p>--> in it</div>';
t.equal(strip(html), 'this has markup in a <!--comment markup--> in it');
t.end();
});
test('undefined html arg returns empty string', function(t){
var html;
t.equal(strip(html), '');
t.end();
});