Repository navigation
Expand file tree
/
Copy pathindex.js
More file actions
46 lines (41 loc) · 1.49 KB
/
Copy pathindex.js
File metadata and controls
46 lines (41 loc) · 1.49 KB
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
var sys = require("sys");
exports.tests = {
build_window : function() {
var window = jsdom.jsdom().createWindow();
assertNotNull("window must be a new object!", window);
assertNotNull(window.document);
},
jsdom_takes_html : function() {
var document = jsdom.jsdom('<a href="#test">');
assertEquals("Passing html into jsdom() should populate the resulting doc",
document.documentElement.getAttribute("href"),
"#test");
},
jsdom_method_creates_default_document : function() {
var doc = jsdom.jsdom();
assertEquals("Calling jsdom.jsdom() should automatically populate the doc",
doc.documentElement.nodeName,
"HTML");
},
jquerify : function() {
jsdom.jQueryify(jsdom.jsdom().createWindow(),
__dirname + "/../../example/jquery/jquery.js",
function(window, jQuery)
{
assertNotNull("jQuery should be attached to the window", window.jQuery.find);
assertNotNull("jQuery should be attached to the window", jQuery.find);
var caught = false;
try {
jQuery("#a .test", window.body);
} catch (e) {
caught = true;
}
assertFalse("compareDocumentPosition should not fail", caught);
});
},
plain_window_document : function() {
var window = (jsdom.createWindow());
assertTrue("jsdom.createWindow() should create a documentless window",
typeof window.document === 'undefined');
},
};