-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtest.html
66 lines (52 loc) · 2.46 KB
/
test.html
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
58
59
60
61
62
63
64
65
66
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<script type="text/javascript" src="jsse.js"></script>
<script type="text/javascript" src="3rd-party/jquery.js" ></script>
<script type="text/javascript" src="3rd-party/qunit.js"></script>
<link type="text/css" rel="stylesheet" href="3rd-party/qunit.css"/>
<script type="text/javascript">
$(document).ready(function(){
test("new, add, remove, getWords", function() {
expect(7);
var jsse = new Jsse();
equals(jsse.size, 0, "Property size is 0");
jsse.add('Instant search in Google is awesome!', 'quote');
equals(jsse.size, 4, "after add size is 4");
deepEqual(jsse.getWords(), ['instant', 'search', 'google', 'awesome'], "getWords");
jsse.remove('instant', 'quote');
equals(jsse.size, 3, "after remove 'instant' size is 3");
deepEqual(jsse.getWords(), ['search', 'google', 'awesome'], "getWords");
jsse.remove('search in Google is awesome!', 'quote');
equals(jsse.size, 0, "after remove all others size is 0");
deepEqual(jsse.getWords(), [], "getWords returns empty");
});
test("match", function() {
expect(3);
var jsse = new Jsse();
jsse.add('Instant search in Google is awesome!', 'quote');
jsse.add('It will work find after you install that patch.', 'instruction');
jsse.add('I bought a red car.', 'mid-life crisis');
equals(jsse.size, 15, "Property size is 15");
var keys = jsse.match('Instant start with a red car');
deepEqual(keys, [], "match all (no args)");
var keys = jsse.match('Instant start with a red car', 'any');
deepEqual(keys, ['quote', 'mid-life crisis'], "match any");
});
});
</script>
</head>
<body>
<h1 id="qunit-header">Javascript Simple Search Engine - Regression Test</h1>
<p style="font-size:12px;">
<strong>Authors:</strong> <a href="mailto:[email protected]">Martin Drapeau<a/>, <a href="mailto:[email protected]">Sebastien Giroux</a><br/>
<strong>Home:</strong> <a href="http://www.planbox.com/code">www.planbox.com/code</a><br/>
<strong>Demo:</strong> <a href="http://www.planbox.com/html/jsse/demo.html">See it work live here</a><br/>
</p>
<h2 id="qunit-banner"></h2>
<div id="qunit-testrunner-toolbar"></div>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
<div id="qunit-fixture">test markup, will be hidden</div>
</body>
</html>