mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Auto merge of #5880 - Ms2ger:servo-tests, r=jdm
<!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/5880) <!-- Reviewable:end -->
This commit is contained in:
commit
4f6b7b5a94
10 changed files with 132 additions and 111 deletions
|
@ -45,3 +45,48 @@
|
|||
[Interfaces for command]
|
||||
expected: FAIL
|
||||
|
||||
[Interfaces for BGSOUND]
|
||||
expected: FAIL
|
||||
|
||||
[Interfaces for BLOCKQUOTE]
|
||||
expected: FAIL
|
||||
|
||||
[Interfaces for ISINDEX]
|
||||
expected: FAIL
|
||||
|
||||
[Interfaces for KEYGEN]
|
||||
expected: FAIL
|
||||
|
||||
[Interfaces for LISTING]
|
||||
expected: FAIL
|
||||
|
||||
[Interfaces for MARQUEE]
|
||||
expected: FAIL
|
||||
|
||||
[Interfaces for MENU]
|
||||
expected: FAIL
|
||||
|
||||
[Interfaces for NOEMBED]
|
||||
expected: FAIL
|
||||
|
||||
[Interfaces for PLAINTEXT]
|
||||
expected: FAIL
|
||||
|
||||
[Interfaces for SPACER]
|
||||
expected: FAIL
|
||||
|
||||
[Interfaces for TFOOT]
|
||||
expected: FAIL
|
||||
|
||||
[Interfaces for THEAD]
|
||||
expected: FAIL
|
||||
|
||||
[Interfaces for XMP]
|
||||
expected: FAIL
|
||||
|
||||
[Interfaces for DETAILS]
|
||||
expected: FAIL
|
||||
|
||||
[Interfaces for COMMAND]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -83,18 +83,6 @@
|
|||
"url": "/_mozilla/mozilla/collections.html"
|
||||
}
|
||||
],
|
||||
"mozilla/createElement_script.html": [
|
||||
{
|
||||
"path": "mozilla/createElement_script.html",
|
||||
"url": "/_mozilla/mozilla/createElement_script.html"
|
||||
}
|
||||
],
|
||||
"mozilla/create_element.html": [
|
||||
{
|
||||
"path": "mozilla/create_element.html",
|
||||
"url": "/_mozilla/mozilla/create_element.html"
|
||||
}
|
||||
],
|
||||
"mozilla/documentElement.html": [
|
||||
{
|
||||
"path": "mozilla/documentElement.html",
|
||||
|
|
|
@ -9,27 +9,7 @@
|
|||
<script>
|
||||
test(function() {
|
||||
var a = document.getElementsByTagName('p')[0].childNodes[0];
|
||||
assert_equals(a.data, "This is the character data");
|
||||
// append test utf8
|
||||
a.appendData(", append more 資料,測試資料");
|
||||
assert_equals(a.data, "This is the character data, append more 資料,測試資料");
|
||||
|
||||
// length test utf8
|
||||
assert_equals(a.length, 47);
|
||||
|
||||
// insert test non-utf8
|
||||
a.insertData(26, " test");
|
||||
assert_equals(a.data, "This is the character data test, append more 資料,測試資料");
|
||||
// insert test utf8
|
||||
a.insertData(48, "更多");
|
||||
assert_equals(a.data, "This is the character data test, append more 資料,更多測試資料");
|
||||
|
||||
// delete test non-utf8
|
||||
a.deleteData(40, 5);
|
||||
assert_equals(a.data, "This is the character data test, append 資料,更多測試資料");
|
||||
// delete test utf8
|
||||
a.deleteData(45, 2);
|
||||
assert_equals(a.data, "This is the character data test, append 資料,更多資料");
|
||||
a.data = "This is the character data test, append 資料,更多資料";
|
||||
|
||||
// replace test non-utf8
|
||||
a.replaceData(33, 6, "other");
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
var output;
|
||||
test(function() {
|
||||
output = "start";
|
||||
|
||||
var script = document.createElement("script");
|
||||
script.setAttribute('type','text/javascript');
|
||||
script.textContent = "output += ' middle ';";
|
||||
document.body.appendChild(script);
|
||||
|
||||
output += "end";
|
||||
assert_equals(output, "start middle end");
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,21 +0,0 @@
|
|||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
test(function() {
|
||||
var elem = document.createElement("foo");
|
||||
assert_equals(elem.tagName, "FOO");
|
||||
var elem = document.createElement("p");
|
||||
assert_true(elem instanceof HTMLParagraphElement, "Should be HTMLParagraphElement");
|
||||
var elem = document.createElement("sPAn");
|
||||
assert_true(elem instanceof HTMLSpanElement, "Should be HTMLSpanElement");
|
||||
var text = document.createTextNode("hello");
|
||||
assert_true(text instanceof Text, "Should be Text");
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -24,6 +24,14 @@ function testNode(create, type) {
|
|||
assert_equals(node.data, "test")
|
||||
}, type + ".appendData('')")
|
||||
|
||||
test(function() {
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
node.appendData(", append more 資料,測試資料");
|
||||
assert_equals(node.data, "test, append more 資料,測試資料");
|
||||
assert_equals(node.length, 25);
|
||||
}, type + ".appendData(non-ASCII)")
|
||||
|
||||
test(function() {
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
|
|
|
@ -7,22 +7,42 @@
|
|||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
function testNode(node) {
|
||||
function testNode(create, type) {
|
||||
test(function() {
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
|
||||
assert_throws("INDEX_SIZE_ERR", function() { node.deleteData(5, 10) })
|
||||
assert_throws("INDEX_SIZE_ERR", function() { node.deleteData(5, 0) })
|
||||
}, type + ".deleteData() out of bounds")
|
||||
|
||||
test(function() {
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
|
||||
node.deleteData(2, 10)
|
||||
assert_equals(node.data, "te")
|
||||
})
|
||||
}, type + ".deleteData() at the end")
|
||||
|
||||
test(function() {
|
||||
node.data = "test"
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
|
||||
node.deleteData(1, 1)
|
||||
assert_equals(node.data, "tst")
|
||||
})
|
||||
}, type + ".deleteData() in the middle")
|
||||
|
||||
test(function() {
|
||||
var node = create()
|
||||
node.data = "This is the character data test, append more 資料,更多測試資料";
|
||||
|
||||
node.deleteData(40, 5);
|
||||
assert_equals(node.data, "This is the character data test, append 資料,更多測試資料");
|
||||
node.deleteData(45, 2);
|
||||
assert_equals(node.data, "This is the character data test, append 資料,更多資料");
|
||||
}, type + ".deleteData() with non-ascii data")
|
||||
}
|
||||
test(function() {
|
||||
testNode(document.createTextNode("test"))
|
||||
testNode(document.createComment("test"))
|
||||
})
|
||||
|
||||
testNode(function() { return document.createTextNode("test") }, "Text")
|
||||
testNode(function() { return document.createComment("test") }, "Comment")
|
||||
</script>
|
||||
|
|
|
@ -7,22 +7,42 @@
|
|||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
function testNode(node) {
|
||||
function testNode(create, type) {
|
||||
test(function() {
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
|
||||
assert_throws("INDEX_SIZE_ERR", function() { node.insertData(5, "x") })
|
||||
assert_throws("INDEX_SIZE_ERR", function() { node.insertData(5, "") })
|
||||
}, type + ".insertData() out of bounds")
|
||||
|
||||
test(function() {
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
|
||||
node.insertData(2, "X")
|
||||
assert_equals(node.data, "teXst")
|
||||
})
|
||||
}, type + ".insertData() in the middle")
|
||||
|
||||
test(function() {
|
||||
node.data = "test"
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
|
||||
node.insertData(4, "ing")
|
||||
assert_equals(node.data, "testing")
|
||||
})
|
||||
}, type + ".insertData() at the end")
|
||||
|
||||
test(function() {
|
||||
var node = create()
|
||||
node.data = "This is the character data, append more 資料,測試資料";
|
||||
|
||||
node.insertData(26, " test");
|
||||
assert_equals(node.data, "This is the character data test, append more 資料,測試資料");
|
||||
node.insertData(48, "更多");
|
||||
assert_equals(node.data, "This is the character data test, append more 資料,更多測試資料");
|
||||
}, type + ".insertData() with non-ascii data")
|
||||
}
|
||||
test(function() {
|
||||
testNode(document.createTextNode("test"))
|
||||
testNode(document.createComment("test"))
|
||||
})
|
||||
|
||||
testNode(function() { return document.createTextNode("test") }, "Text")
|
||||
testNode(function() { return document.createComment("test") }, "Comment")
|
||||
</script>
|
||||
|
|
|
@ -9,22 +9,25 @@
|
|||
<script src=interfaces.js></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
elements.forEach(function(a) {
|
||||
test(function() {
|
||||
var e = document.createElement(a[0]), i = "HTML" + a[1] + "Element";
|
||||
assert_class_string(e, i,
|
||||
"Element " + a[0] + " should have " + i +
|
||||
" as its primary interface.");
|
||||
assert_true(e instanceof window[i],
|
||||
"Element " + a[0] + " should implement " + i + ".");
|
||||
assert_true(e instanceof HTMLElement,
|
||||
"Element " + a[0] + " should implement HTMLElement.");
|
||||
assert_true(e instanceof Element,
|
||||
"Element " + a[0] + " should implement Element.");
|
||||
assert_true(e instanceof Node,
|
||||
"Element " + a[0] + " should implement Node.");
|
||||
}, "Interfaces for " + a[0])
|
||||
})
|
||||
function do_test(local_name, iface) {
|
||||
test(function() {
|
||||
var e = document.createElement(local_name), i = "HTML" + iface + "Element";
|
||||
assert_class_string(e, i,
|
||||
"Element " + local_name + " should have " + i +
|
||||
" as its primary interface.");
|
||||
assert_true(e instanceof window[i],
|
||||
"Element " + local_name + " should implement " + i + ".");
|
||||
assert_true(e instanceof HTMLElement,
|
||||
"Element " + local_name + " should implement HTMLElement.");
|
||||
assert_true(e instanceof Element,
|
||||
"Element " + local_name + " should implement Element.");
|
||||
assert_true(e instanceof Node,
|
||||
"Element " + local_name + " should implement Node.");
|
||||
}, "Interfaces for " + local_name);
|
||||
}
|
||||
|
||||
elements.forEach(function(a) {
|
||||
do_test(a[0], a[1]);
|
||||
do_test(a[0].toUpperCase(), a[1]);
|
||||
})
|
||||
</script>
|
||||
|
|
|
@ -134,5 +134,6 @@ var elements = [
|
|||
["dialog", "Dialog"],
|
||||
["figcaption", ""],
|
||||
["summary", ""],
|
||||
["track", "Track"]
|
||||
["track", "Track"],
|
||||
["foo", "Unknown"]
|
||||
];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue