Skip to content

Commit

Permalink
move MS tests on getElementsByClassName
Browse files Browse the repository at this point in the history
  • Loading branch information
deniak authored and Ms2ger committed Jan 22, 2014
1 parent 3d8364a commit d03b32e
Show file tree
Hide file tree
Showing 26 changed files with 243 additions and 280 deletions.
2 changes: 1 addition & 1 deletion dom/nodes/getElementsByClassName-01.htm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</head>
<body class="a">
<div id="log"></div>
<script> test(function() {assert_array_equals(document.getElementsByClassName("\ta\n"),
<script> test(function() {assert_array_equals(document.getElementsByClassName("\ta\n"),
[document.documentElement, document.body])}) </script>
</body>
</html>
2 changes: 1 addition & 1 deletion dom/nodes/getElementsByClassName-08.htm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<div id="log"></div>
<script> test(function() {
document.getElementsByClassName("a\fa"), [document.body]
})
})
</script>
</body>
</html>
2 changes: 1 addition & 1 deletion dom/nodes/getElementsByClassName-09.htm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<div id="log"></div>
<script>test(function() {
assert_array_equals(document.getElementsByClassName("A a"), [document.documentElement])
})
})
</script>
</body>
</html>
2 changes: 1 addition & 1 deletion dom/nodes/getElementsByClassName-10.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<x class="a"/>
<g:x class="a"/>
<script>test(function() {
assert_array_equals(document.getElementsByClassName("a"),
assert_array_equals(document.getElementsByClassName("a"),
document.getElementsByTagName("x"));
})
</script>
Expand Down
2 changes: 1 addition & 1 deletion dom/nodes/getElementsByClassName-11.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="log" />
<div id="log" />
<x class="a"/>
<g:x class="a"/>
<x t:class="a" h:class="a" g:class="a"/>
Expand Down
2 changes: 1 addition & 1 deletion dom/nodes/getElementsByClassName-14.htm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<body class="a a">
<div id="log"></div>
<script>test(function() {
assert_array_equals(document.getElementsByClassName("A a"),
assert_array_equals(document.getElementsByClassName("A a"),
[document.documentElement, document.body]);
})
</script>
Expand Down
2 changes: 1 addition & 1 deletion dom/nodes/getElementsByClassName-15.htm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
">
<div id="log"></div>
<script>test(function () {
assert_array_equals(document.getElementsByClassName(["a\n"]),
assert_array_equals(document.getElementsByClassName(["a\n"]),
[document.documentElement, document.body]);
})
</script>
Expand Down
2 changes: 1 addition & 1 deletion dom/nodes/getElementsByClassName-18.htm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<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"]),
assert_array_equals(document.documentElement.getElementsByClassName(["\fa","b\n"]),
[document.body])
})
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
</table>
<div class="xt te">xt te</div>

<script type="text/javascript">
test(function ()
<script type="text/javascript">
test(function ()
{
var collection = document.getElementsByClassName("text");
assert_equals(collection.length, 4);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
</tfoot>
</table>
<div class="xt te">xt te</div>

<script type="text/javascript">
test(function()
{
Expand All @@ -49,7 +49,7 @@
newDiv.setAttribute("class", "text");
newDiv.innerHTML = "text newDiv";
document.getElementsByTagName("table")[0].tBodies[0].rows[0].cells[0].appendChild(newDiv);

assert_equals(collection.length, 5);
assert_equals(collection[0].parentNode.nodeName, "DIV");
assert_equals(collection[1].parentNode.nodeName, "DIV");
Expand All @@ -58,5 +58,4 @@
assert_equals(collection[4].parentNode.nodeName, "TR");
}, "get elements in document then add element to collection");
</script>

</body></html>
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,14 @@
</tfoot>
</table>
<div class="xt te">xt te</div>

<script type="text/javascript">
test(function()
{
var collection = document.getElementsByClassName("text1");
assert_equals(collection.length, 1)
document.getElementsByTagName("table")[0].deleteRow(1);

assert_equals(collection.length, 0);
}, "delete element from collection");
</script>

</body></html>
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,20 @@
</tfoot>
</table>
<div class="xt te">xt te</div>

<script type="text/javascript">
test(function()
{
var collection = document.getElementsByClassName("text");
assert_equals(collection.length, 4);
var boldText = document.getElementsByTagName("b")[0];
document.getElementsByTagName("table")[0].tBodies[0].rows[0].cells[0].appendChild(boldText);

assert_equals(collection.length, 4);
assert_equals(collection[0].parentNode.nodeName, "DIV");
assert_equals(collection[1].parentNode.nodeName, "TABLE");
assert_equals(collection[2].parentNode.nodeName, "TD");
assert_equals(collection[3].parentNode.nodeName, "TR");
}, "move item in collection order");
</script>

</body></html>
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,4 @@
assert_equals(collection[1].parentNode.nodeName, "BODY");
}, "multiple defined classes");
</script>

</body></html>
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<b class="text">text</b>
</div>
<div class="ΔЙあ叶葉 קم">ΔЙあ叶葉 קم</div>

<script type="text/javascript">
test(function()
{
Expand All @@ -26,5 +26,5 @@
assert_equals(collection[1].parentNode.nodeName, "BODY");
}, "handle unicode chars");
</script>

</body></html>
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,19 @@
</tfoot>
</table>
<div class="xt te">xt te</div>

<script type="text/javascript">
test(function()
{
var collection = document.getElementsByClassName("text ");
assert_equals(collection.length, 4);
var boldText = document.getElementsByTagName("b")[0];
document.getElementsByTagName("table")[0].tBodies[0].rows[0].cells[0].appendChild(boldText);


assert_equals(collection.length, 4);
assert_equals(collection[0].parentNode.nodeName, "DIV");
assert_equals(collection[1].parentNode.nodeName, "TABLE");
assert_equals(collection[2].parentNode.nodeName, "TD");
assert_equals(collection[3].parentNode.nodeName, "TR");
}, "verify spacing is handled correctly");
</script>

</body></html>
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,14 @@
<b class="text">text</b>
</div>
<div class="xt te">xt te</div>

<script type="text/javascript">
test(function()
{
var collection = document.getElementsByClassName("te xt");

assert_equals(collection.length, 2);
assert_equals(collection[0].parentNode.nodeName, "BODY");
assert_equals(collection[1].parentNode.nodeName, "BODY");
}, "multiple class attributes");
</script>

</body></html>
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@
test(function()
{
var collection = document.getElementsByClassName("te xt");

assert_equals(collection.length, 3);
assert_equals(collection[0].parentNode.nodeName, "BODY");
assert_equals(collection[1].parentNode.nodeName, "DIV");
assert_equals(collection[2].parentNode.nodeName, "BODY");
}, "generic element listed");
</script>

</body></html>
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,10 @@
test(function()
{
var collection = document.getElementsByClassName("te xt");

assert_equals(collection.length, 3);
assert_equals(collection[0].parentNode.nodeName, "BODY");
assert_equals(collection[1].parentNode.nodeName, "DIV");
assert_equals(collection[2].parentNode.nodeName, "BODY");
assert_equals(collection.length, 3);
assert_equals(collection[0].parentNode.nodeName, "BODY");
assert_equals(collection[1].parentNode.nodeName, "DIV");
assert_equals(collection[2].parentNode.nodeName, "BODY");
}, "generic element listed");
</script>

</body></html>
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
</tfoot>
</table>
<div class="xt te">xt te</div>

<script type="text/javascript">
test(function()
{
Expand All @@ -48,5 +48,4 @@
assert_equals(collection[0].parentNode.nodeName, "TR");
}, "get class from children of element");
</script>

</body></html>
Loading

0 comments on commit d03b32e

Please sign in to comment.