Permalink
Browse files

Merge commit 'e35a1e99a0a2b6d9116a'

Conflicts:
	test/browser/index.js
  • Loading branch information...
tmpvar committed Aug 12, 2010
2 parents 82ba253 + e35a1e9 commit 3f9410fa61516efc1e159a59b04ddd624594ad56
Showing with 35 additions and 33 deletions.
  1. +35 −33 test/browser/index.js
View
@@ -3,17 +3,17 @@ exports.tests = {
notfound_getelementsbyclassname : function() {
var doc = new browser.Document();
-
+
var html = doc.createElement("html");
doc.appendChild(html);
-
+
var body = doc.createElement("body");
html.appendChild(body);
-
+
var p = doc.createElement("p");
p.className = "unknown";
body.appendChild(p);
-
+
var elements = doc.getElementsByClassName("first-p");
assertEquals("no results", 0, elements.length);
},
@@ -22,38 +22,38 @@ exports.tests = {
basic_getelementsbyclassname : function() {
var doc = new browser.Document();
-
+
var html = doc.createElement("html");
doc.appendChild(html);
-
+
var body = doc.createElement("body");
html.appendChild(body);
-
+
var p = doc.createElement("p");
p.className = "first-p";
body.appendChild(p);
-
+
var elements = doc.getElementsByClassName("first-p");
assertSame("p and first-p", p, elements.item(0));
},
multiple_getelementsbyclassname : function() {
var doc = new browser.Document();
-
+
var html = doc.createElement("html");
doc.appendChild(html);
-
+
var body = doc.createElement("body");
html.appendChild(body);
-
+
var p = doc.createElement("p");
p.className = "first-p second third";
body.appendChild(p);
var first = doc.getElementsByClassName("first-p");
assertSame("p and first-p", p, first.item(0));
-
+
var second = doc.getElementsByClassName("second");
assertSame("p and second", p, second.item(0));
@@ -66,54 +66,54 @@ exports.tests = {
var p = doc.createElement("p");
p.setAttribute("class", "first-p");
assertSame("class attribute is same as className", p.className,"first-p");
-
+
p.className += " second";
assertSame("className getter/setter", p.className,"first-p second");
},
-
+
basic_getelementbyid : function() {
var doc = new browser.Document();
-
+
var html = doc.createElement("html");
doc.appendChild(html);
-
+
var body = doc.createElement("body");
html.appendChild(body);
-
+
var p = doc.createElement("p");
p.id = "theid";
body.appendChild(p);
-
+
var element = doc.getElementById("theid");
assertSame("p and #theid", p, element);
- },
+ },
nonexistant_getelementbyid : function() {
var doc = new browser.Document();
-
+
var html = doc.createElement("html");
doc.appendChild(html);
-
+
var body = doc.createElement("body");
html.appendChild(body);
-
+
var p = doc.createElement("p");
p.id = "theid";
body.appendChild(p);
-
+
var element = doc.getElementById("non-existant-id");
assertSame("p and #theid", null, element);
},
remove_nonexistantattribute : function() {
var doc = new browser.Document();
-
+
var html = doc.createElement("html");
doc.appendChild(html);
-
+
var body = doc.createElement("body");
html.appendChild(body);
-
+
exception = false;
try {
removedNode = body.removeAttribute("non-existant");
@@ -125,9 +125,9 @@ exports.tests = {
},
render_singletag : function() {
var doc = new browser.Document();
-
+
var p = doc.createElement("p");
-
+
var img = doc.createElement("img");
p.appendChild(img);
var out = p.outerHTML;
@@ -136,13 +136,13 @@ exports.tests = {
},
parse_scripttags : function() {
var doc = new browser.Document();
-
+
var head = doc.createElement("head");
var scriptHtml = '<script>alert("hello world")</script>';
head.innerHTML = scriptHtml;
assertSame("original and processed", head.innerHTML, scriptHtml);
-
+
},
parse_styletags : function() {
var doc = new browser.Document();
@@ -156,9 +156,9 @@ exports.tests = {
},
parse_doublespacetags : function() {
var doc = new browser.Document();
-
+
var html = '<html><body class="testing" /></html>';
-
+
exception = false;
try {
doc.innerHTML = html;
@@ -173,6 +173,8 @@ exports.tests = {
doc.appendChild(doc.createElement('html'));
doc.documentElement.style.color = 'black';
doc.documentElement.style.backgroundColor = 'white';
- assertEquals('', '<html style="color: black; background-color: white">\r\n</html>\r\n', require('jsdom/browser/domtohtml').domToHtml(doc));
+ assertEquals('',
+ '<html style="color: black; background-color: white">\r\n</html>\r\n',
+ require('jsdom/browser/domtohtml').domToHtml(doc));
}
};

0 comments on commit 3f9410f

Please sign in to comment.