Bug 647323 - Part e: Import Opera's getElementsByClassName tests from the WebApps WG repository; r=jhammel

This commit is contained in:
Ms2ger 2012-03-29 23:09:02 +02:00
parent fbf4b3314a
commit b088f0c68b
24 changed files with 358 additions and 0 deletions

View File

@ -12,6 +12,7 @@ DIRS = \
$(NULL)
include $(srcdir)/html.mk
include $(srcdir)/webapps.mk
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk

View File

@ -1 +1,2 @@
html
webapps

View File

@ -0,0 +1,9 @@
{
"webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-10.xml": {
"document.getElementsByClassName(): compound": true
},
"webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-11.xml": {
"document.getElementsByClassName(): \"tricky\" compound": true
}
}

View File

@ -0,0 +1,3 @@
DIRS += \
webapps/DOMCore/tests/submissions/Opera \
$(NULL)

View File

@ -0,0 +1,2 @@
https://dvcs.w3.org/hg/webapps|webapps
DOMCore/tests/submissions/Opera

View File

@ -0,0 +1,41 @@
# THIS FILE IS AUTOGENERATED - DO NOT EDIT
DEPTH = ../../../../../../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
relativesrcdir = dom/tests/mochitest/w3c/webapps/DOMCore/tests/submissions/Opera
DIRS = \
$(NULL)
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
_TESTS = \
test_getElementsByClassName-01.htm \
test_getElementsByClassName-02.htm \
test_getElementsByClassName-03.htm \
test_getElementsByClassName-04.htm \
test_getElementsByClassName-05.htm \
test_getElementsByClassName-06.htm \
test_getElementsByClassName-07.htm \
test_getElementsByClassName-08.htm \
test_getElementsByClassName-09.htm \
test_getElementsByClassName-10.xml \
test_getElementsByClassName-11.xml \
test_getElementsByClassName-12.htm \
test_getElementsByClassName-13.htm \
test_getElementsByClassName-14.htm \
test_getElementsByClassName-15.htm \
test_getElementsByClassName-16.htm \
test_getElementsByClassName-17.htm \
test_getElementsByClassName-18.htm \
$(NULL)
_TESTS += \
$(NULL)
libs:: $(_TESTS)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)

View File

@ -0,0 +1,13 @@
<!doctype html>
<html class="a">
<head>
<title>document.getElementsByClassName(): simple</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body class="a">
<div id="log"></div>
<script> test(function() {assert_array_equals(document.getElementsByClassName("\ta\n"),
[document.documentElement, document.body])}) </script>
</body>
</html>

View File

@ -0,0 +1,14 @@
<!doctype html>
<html class="a
b">
<head>
<title>document.getElementsByClassName(): also simple</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body class="a
">
<div id="log"></div>
<script> test(function() {assert_array_equals(document.getElementsByClassName("a\n"), [document.documentElement, document.body])}) </script>
</body>
</html>

View File

@ -0,0 +1,18 @@
<!doctype html>
<html class="a">
<head>
<title>document.getElementsByClassName(): changing classes</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body class="a">
<div id="log"></div>
<script>
test(function() {
var collection = document.getElementsByClassName("a")
document.body.className = "b"
assert_array_equals(collection, [document.documentElement])
})
</script>
</body>
</html>

View File

@ -0,0 +1,18 @@
<!doctype html>
<html class="a">
<head>
<title>document.getElementsByClassName(): changing classes</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body class="a">
<div id="log"></div>
<script>
test(function() {
var collection = document.getElementsByClassName("a");
document.body.className += "\tb";
assert_array_equals(collection, [document.documentElement, document.body]);
})
</script>
</body>
</html>

View File

@ -0,0 +1,18 @@
<!doctype html>
<html class="a">
<head>
<title>document.getElementsByClassName(): changing classes</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body class="a">
<div id="log"></div>
<script>
test(function() {
var collection = document.getElementsByClassName("a");
document.body.removeAttribute("class");
assert_array_equals(collection, [document.documentElement]);
})
</script>
</body>
</html>

View File

@ -0,0 +1,20 @@
<!doctype html>
<html>
<head>
<title>document.getElementsByClassName(): adding element with class</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body class="a">
<div id="log"></div>
<script>
test(function() {
var collection = document.getElementsByClassName("a");
var ele = document.createElement("foo");
ele.setAttribute("class", "a");
document.body.appendChild(ele);
assert_array_equals(collection, [document.body, ele]);
})
</script>
</body>
</html>

View File

@ -0,0 +1,15 @@
<!doctype html>
<html>
<head>
<title>document.getElementsByClassName(): multiple classes</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body class="a b">
<div id="log"></div>
<script> test(function() {
assert_array_equals(document.getElementsByClassName("b\t\f\n\na\rb"), [document.body]);
})
</script>
</body>
</html>

View File

@ -0,0 +1,15 @@
<!doctype html>
<html>
<head>
<title>document.getElementsByClassName(): multiple classes</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body class="a">
<div id="log"></div>
<script> test(function() {
document.getElementsByClassName("a\fa"), [document.body]
})
</script>
</body>
</html>

View File

@ -0,0 +1,15 @@
<!doctype html>
<html class="a A">
<head>
<title>document.getElementsByClassName(): case sensitive</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body class="a a">
<div id="log"></div>
<script>test(function() {
assert_array_equals(document.getElementsByClassName("A a"), [document.documentElement])
})
</script>
</body>
</html>

View File

@ -0,0 +1,17 @@
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:g="http://www.w3.org/2000/svg">
<head>
<title>document.getElementsByClassName(): compound</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="log"/>
<x class="a"/>
<g:x class="a"/>
<script>test(function() {
assert_array_equals(document.getElementsByClassName("a"),
document.getElementsByTagName("x"));
})
</script>
</body>
</html>

View File

@ -0,0 +1,22 @@
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:g="http://www.w3.org/2000/svg" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:t="http://tc.labs.opera.com/#test">
<head>
<title>document.getElementsByClassName(): "tricky" compound</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="log" />
<x class="a"/>
<g:x class="a"/>
<x t:class="a" h:class="a" g:class="a"/>
<g:x t:class="a" h:class="a" g:class="a"/>
<t:x class="a" t:class="a" h:class="a" g:class="a"/>
<script>
test(function() {
var collection = document.getElementsByClassName("a");
var test = document.getElementsByTagName("x");
assert_array_equals(collection, [test[0], test[1]]);
})
</script>
</body>
</html>

View File

@ -0,0 +1,15 @@
<!doctype html>
<html class="a">
<head>
<title>element.getElementsByClassName(): simple</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body class="a">
<div id="log"></div>
<script>test(function() {
assert_array_equals(document.body.getElementsByClassName("a"), [])
})
</script>
</body>
</html>

View File

@ -0,0 +1,19 @@
<!doctype html>
<html class="a">
<head>
<title>element.getElementsByClassName(): adding an element</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body class="a">
<div id="log"></div>
<script>test(function() {
var collection = document.body.getElementsByClassName("a");
var ele = document.createElement("x-y-z");
ele.className = "a";
document.body.appendChild(ele);
assert_array_equals(collection, [ele]);
})
</script>
</body>
</html>

View File

@ -0,0 +1,16 @@
<!-- quirks mode -->
<html class="a A">
<head>
<title>document.getElementsByClassName(): case-insensitive (quirks mode)</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body class="a a">
<div id="log"></div>
<script>test(function() {
assert_array_equals(document.getElementsByClassName("A a"),
[document.documentElement, document.body]);
})
</script>
</body>
</html>

View File

@ -0,0 +1,18 @@
<!doctype html>
<html class="a
b">
<head>
<title>document.getElementsByClassName(array): "a\n"</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body class="a
">
<div id="log"></div>
<script>test(function () {
assert_array_equals(document.getElementsByClassName(["a\n"]),
[document.documentElement, document.body]);
})
</script>
</body>
</html>

View File

@ -0,0 +1,16 @@
<!doctype html>
<html class="a
b">
<head>
<title>document.getElementsByClassName(array): "b","a"</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body class="b,a">
<div id="log"></div>
<script>test(function() {
assert_array_equals(document.getElementsByClassName(["b", "a"]), [document.body]);
})
</script>
</body>
</html>

View File

@ -0,0 +1,15 @@
<!doctype html>
<html>
<head>
<title>document.getElementsByClassName(array): "b a"</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body class="a b">
<div id="log"></div>
<script>test(function() {
assert_array_equals(document.getElementsByClassName(["b a"]), [document.body]);
})
</script>
</body>
</html>

View File

@ -0,0 +1,17 @@
<!doctype html>
<html class="a,b">
<head>
<title>element.getElementsByClassName(array): "a", "b"</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body class="a,b x">
<div id="log"></div>
<p id="r" class="a,bx"></p>
<script class="xa,b">test(function() {
assert_array_equals(document.documentElement.getElementsByClassName(["\fa","b\n"]),
[document.body])
})
</script>
</body>
</html>