Skip to content

Commit

Permalink
Bug 952018 - Part b: Update web-platform-tests tests; r=jgraham
Browse files Browse the repository at this point in the history
  • Loading branch information
Ms2ger committed Dec 31, 2013
1 parent 28b9306 commit 4057436
Show file tree
Hide file tree
Showing 35 changed files with 314 additions and 31 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# THIS FILE IS AUTOGENERATED BY parseFailures.py - DO NOT EDIT

MOCHITEST_FILES := \
test_select-named-getter.html.json \
test_select-remove.html.json \
$(NULL)
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"Empty string name": true
}
33 changes: 33 additions & 0 deletions dom/imptests/html/dom/events/test_EventTarget-dispatchEvent.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,37 @@
assert_array_equals(called, ["First", "Second"],
"Should have continued to call other event listeners")
}, "Exceptions from event listeners must not be propagated.")

async_test(function() {
var results = []
var outerb = document.createElement("b")
var middleb = outerb.appendChild(document.createElement("b"))
var innerb = middleb.appendChild(document.createElement("b"))
outerb.addEventListener("x", this.step_func(function() {
middleb.addEventListener("x", this.step_func(function() {
results.push("middle")
}), true)
results.push("outer")
}), true)
innerb.dispatchEvent(new Event("x"))
assert_array_equals(results, ["outer", "middle"])
this.done()
}, "Event listeners added during dispatch should be called");

async_test(function() {
var results = []
var b = document.createElement("b")
b.addEventListener("x", this.step_func(function() {
results.push(1)
}), true)
b.addEventListener("x", this.step_func(function() {
results.push(2)
}), false)
b.addEventListener("x", this.step_func(function() {
results.push(3)
}), true)
b.dispatchEvent(new Event("x"))
assert_array_equals(results, [1, 2, 3])
this.done()
}, "Event listeners should be called in order of addition")
</script>
1 change: 1 addition & 0 deletions dom/imptests/html/dom/nodes/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ MOCHITEST_FILES := \
test_CharacterData-insertData.html \
test_CharacterData-remove.html \
test_CharacterData-replaceData.html \
test_Comment-constructor.html \
test_Document-adoptNode.html \
test_Document-createComment.html \
test_Document-createElement.html \
Expand Down
84 changes: 84 additions & 0 deletions dom/imptests/html/dom/nodes/test_Comment-constructor.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<!doctype html>
<meta charset=utf-8>
<title>Comment constructor</title>
<link rel=help href="http://dom.spec.whatwg.org/#dom-comment">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
test(function() {
var comment = new Comment();
assert_equals(Object.getPrototypeOf(comment),
Comment.prototype, "Prototype chain: Comment");
assert_equals(Object.getPrototypeOf(Object.getPrototypeOf(comment)),
CharacterData.prototype, "Prototype chain: CharacterData");
assert_equals(Object.getPrototypeOf(Object.getPrototypeOf(Object.getPrototypeOf(comment))),
Node.prototype, "Prototype chain: Node");
}, "new Comment(): prototype chain");

test(function() {
var comment = new Comment();
assert_true(comment instanceof Node, "Should be a Node");
assert_true(comment instanceof CharacterData, "Should be a CharacterData");
assert_true(comment instanceof Comment, "Should be a Comment");
}, "new Comment(): instanceof");

test(function() {
var comment = new Comment();
assert_equals(comment.data, "");
assert_equals(comment.nodeValue, "");
assert_equals(comment.ownerDocument, document);
}, "new Comment(): no arguments");

var arguments = [
[undefined, ""],
[null, "null"],
[42, "42"],
["", ""],
["-", "-"],
["--", "--"],
["-->", "-->"],
["<!--", "<!--"],
["\u0000", "\u0000"],
["\u0000test", "\u0000test"],
["&amp;", "&amp;"],
];

arguments.forEach(function(a) {
var argument = a[0], expected = a[1];
test(function() {
var comment = new Comment(argument);
assert_equals(comment.data, expected);
assert_equals(comment.nodeValue, expected);
assert_equals(comment.ownerDocument, document);
}, "new Comment(): " + format_value(argument));
});

test(function() {
var called = [];
var comment = new Comment({
toString: function() {
called.push("first");
return "text";
}
}, {
toString: function() {
called.push("second");
assert_unreached("Should not look at the second argument.");
}
});
assert_equals(comment.data, "text");
assert_equals(comment.nodeValue, "text");
assert_equals(comment.ownerDocument, document);
assert_array_equals(called, ["first"]);
}, "new Comment(): two arguments")

async_test("new Comment() should get the correct ownerDocument across globals").step(function() {
var iframe = document.createElement("iframe");
iframe.onload = this.step_func_done(function() {
var comment = new iframe.contentWindow.Comment();
assert_equals(comment.ownerDocument, iframe.contentDocument);
});
document.body.appendChild(iframe);
});
</script>
3 changes: 2 additions & 1 deletion dom/imptests/html/dom/ranges/Range-test-iframe.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<!doctype html>
<title>Range test iframe</title>
<link rel=author title="Aryeh Gregor" href=[email protected]>
<link rel="author" title="Aryeh Gregor" href=[email protected]>
<meta name=timeout content=long>
<body onload=run()>
<script src=../common.js></script>
<script>
Expand Down
1 change: 1 addition & 0 deletions dom/imptests/html/dom/ranges/test_Range-attributes.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<!DOCTYPE html>
<title>Range attributes</title>
<link rel="author" title="Ms2ger" href="mailto:[email protected]">
<meta name=timeout content=long>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id=log></div>
Expand Down
5 changes: 2 additions & 3 deletions dom/imptests/html/dom/ranges/test_Range-cloneContents.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<!doctype html>
<title>Range.cloneContents() tests</title>
<link rel=author title="Aryeh Gregor" href=[email protected]>
<link rel="author" title="Aryeh Gregor" href=[email protected]>
<meta name=timeout content=long>
<p>To debug test failures, add a query parameter "subtest" with the test id (like
"?subtest=5"). Only that test will be run. Then you can look at the resulting
iframe in the DOM.
Expand Down Expand Up @@ -411,8 +412,6 @@
fragTests[i].done();
}

setup({timeout: 60000});

// First test a Range that has the no-op detach() called on it, synchronously
test(function() {
var range = document.createRange();
Expand Down
3 changes: 2 additions & 1 deletion dom/imptests/html/dom/ranges/test_Range-cloneRange.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<!doctype html>
<title>Range.cloneRange() and document.createRange() tests</title>
<link rel=author title="Aryeh Gregor" href=[email protected]>
<link rel="author" title="Aryeh Gregor" href=[email protected]>
<meta name=timeout content=long>
<div id=log></div>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
Expand Down
20 changes: 14 additions & 6 deletions dom/imptests/html/dom/ranges/test_Range-collapse.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<!doctype html>
<title>Range.collapse() and .collapsed tests</title>
<link rel=author title="Aryeh Gregor" href=[email protected]>
<link rel="author" title="Aryeh Gregor" href=[email protected]>
<meta name=timeout content=long>
<div id=log></div>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
Expand All @@ -12,11 +13,9 @@
var range;
if (rangeEndpoints == "detached") {
range = document.createRange();
range.detach();
range.detach(); // should be a no-op and therefore the following should not throw
range.collapse(toStart);
assert_true(range.collapsed,
".collapsed must be set after .collapsed()");
return;
assert_equals(true, range.collapsed);
}

// Have to account for Ranges involving Documents!
Expand All @@ -34,7 +33,11 @@
&& range.startOffset == range.endOffset,
"collapsed must be true if and only if the start and end are equal");

range.collapse(toStart);
if (toStart === undefined) {
range.collapse();
} else {
range.collapse(toStart);
}

assert_equals(range.startContainer, expectedContainer,
"Wrong startContainer");
Expand All @@ -60,6 +63,11 @@
eval(testRanges[i]),
false
]);
tests.push([
"Range " + i + " " + testRanges[i] + ", toStart omitted",
eval(testRanges[i]),
undefined
]);
}
generate_tests(testCollapse, tests);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<!doctype html>
<title>Range.commonAncestorContainer tests</title>
<link rel=author title="Aryeh Gregor" href=[email protected]>
<link rel="author" title="Aryeh Gregor" href=[email protected]>
<meta name=timeout content=long>
<div id=log></div>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<!doctype html>
<title>Range.compareBoundaryPoints() tests</title>
<link rel=author title="Aryeh Gregor" href=[email protected]>
<link rel="author" title="Aryeh Gregor" href=[email protected]>
<meta name=timeout content=long>

<div id=log></div>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<!DOCTYPE html>
<title>Range.comparePoint</title>
<link rel="author" title="Ms2ger" href="mailto:[email protected]">
<meta name=timeout content=long>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id=log></div>
Expand Down
3 changes: 2 additions & 1 deletion dom/imptests/html/dom/ranges/test_Range-comparePoint.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<!doctype html>
<title>Range.comparePoint() tests</title>
<link rel=author title="Aryeh Gregor" href=[email protected]>
<link rel="author" title="Aryeh Gregor" href=[email protected]>
<meta name=timeout content=long>
<div id=log></div>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
Expand Down
5 changes: 2 additions & 3 deletions dom/imptests/html/dom/ranges/test_Range-deleteContents.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<!doctype html>
<title>Range.deleteContents() tests</title>
<link rel=author title="Aryeh Gregor" href=[email protected]>
<link rel="author" title="Aryeh Gregor" href=[email protected]>
<meta name=timeout content=long>
<p>To debug test failures, add a query parameter "subtest" with the test id (like
"?subtest=5"). Only that test will be run. Then you can look at the resulting
iframe in the DOM.
Expand Down Expand Up @@ -290,8 +291,6 @@
positionTests[i].done();
}

setup({timeout: 60000});

// First test a detached Range, synchronously
test(function() {
var range = document.createRange();
Expand Down
1 change: 1 addition & 0 deletions dom/imptests/html/dom/ranges/test_Range-detach.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<!DOCTYPE html>
<title>Range.detach</title>
<link rel="author" title="Ms2ger" href="mailto:[email protected]">
<meta name=timeout content=long>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id=log></div>
Expand Down
5 changes: 2 additions & 3 deletions dom/imptests/html/dom/ranges/test_Range-extractContents.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<!doctype html>
<title>Range.extractContents() tests</title>
<link rel=author title="Aryeh Gregor" href=[email protected]>
<link rel="author" title="Aryeh Gregor" href=[email protected]>
<meta name=timeout content=long>
<p>To debug test failures, add a query parameter "subtest" with the test id (like
"?subtest=5"). Only that test will be run. Then you can look at the resulting
iframe in the DOM.
Expand Down Expand Up @@ -205,8 +206,6 @@
fragTests[i].done();
}

setup({timeout: 60000});

// First test a detached Range, synchronously
test(function() {
var range = document.createRange();
Expand Down
3 changes: 2 additions & 1 deletion dom/imptests/html/dom/ranges/test_Range-insertNode.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<!doctype html>
<title>Range.insertNode() tests</title>
<link rel=author title="Aryeh Gregor" href=[email protected]>
<link rel="author" title="Aryeh Gregor" href=[email protected]>
<meta name=timeout content=long>
<p>To debug test failures, add a query parameter "subtest" with the test id (like
"?subtest=5,16"). Only that test will be run. Then you can look at the resulting
iframes in the DOM.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<!doctype html>
<title>Range.intersectsNode</title>
<link rel="author" title="Ms2ger" href="mailto:[email protected]">
<meta name=timeout content=long>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id=log></div>
Expand Down
3 changes: 2 additions & 1 deletion dom/imptests/html/dom/ranges/test_Range-intersectsNode.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<!doctype html>
<title>Range.intersectsNode() tests</title>
<link rel=author title="Aryeh Gregor" href=[email protected]>
<link rel="author" title="Aryeh Gregor" href=[email protected]>
<meta name=timeout content=long>
<div id=log></div>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
Expand Down
3 changes: 2 additions & 1 deletion dom/imptests/html/dom/ranges/test_Range-isPointInRange.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<!doctype html>
<title>Range.isPointInRange() tests</title>
<link rel=author title="Aryeh Gregor" href=[email protected]>
<link rel="author" title="Aryeh Gregor" href=[email protected]>
<meta name=timeout content=long>
<div id=log></div>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
Expand Down
4 changes: 3 additions & 1 deletion dom/imptests/html/dom/ranges/test_Range-mutations.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<!doctype html>
<title>Range mutation tests</title>
<link rel=author title="Aryeh Gregor" href=[email protected]>
<link rel="author" title="Aryeh Gregor" href=[email protected]>
<meta name=timeout content=long>

<div id=log></div>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
Expand Down
3 changes: 2 additions & 1 deletion dom/imptests/html/dom/ranges/test_Range-selectNode.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<!doctype html>
<title>Range.selectNode() and .selectNodeContents() tests</title>
<link rel=author title="Aryeh Gregor" href=[email protected]>
<link rel="author" title="Aryeh Gregor" href=[email protected]>
<meta name=timeout content=long>
<div id=log></div>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
Expand Down
4 changes: 3 additions & 1 deletion dom/imptests/html/dom/ranges/test_Range-set.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<!doctype html>
<title>Range setting tests</title>
<link rel=author title="Aryeh Gregor" href=[email protected]>
<link rel="author" title="Aryeh Gregor" href=[email protected]>
<meta name=timeout content=long>

<div id=log></div>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<!doctype html>
<meta charset=utf-8>
<title>Range.surroundContents() tests</title>
<link rel=author title="Aryeh Gregor" href=[email protected]>
<link rel="author" title="Aryeh Gregor" href=[email protected]>
<meta name=timeout content=long>
<p>To debug test failures, add a query parameter "subtest" with the test id (like
"?subtest=5,16"). Only that test will be run. Then you can look at the resulting
iframes in the DOM.
Expand Down
Loading

0 comments on commit 4057436

Please sign in to comment.