Tests: Update dom/nodes/attributes.html WPT test

This commit is contained in:
Tim Ledbetter 2025-06-19 07:52:23 +01:00 committed by Tim Ledbetter
commit c6cc7e1874
Notes: github-actions[bot] 2025-06-19 10:02:30 +00:00
3 changed files with 20 additions and 59 deletions

View file

@ -1,29 +1,27 @@
Harness status: OK
Found 70 tests
Found 67 tests
70 Pass
65 Pass
2 Fail
Pass When qualifiedName does not match the Name production, an INVALID_CHARACTER_ERR exception is to be thrown. (toggleAttribute)
Pass When qualifiedName does not match the Name production, an INVALID_CHARACTER_ERR exception is to be thrown, even if the attribute is already present. (toggleAttribute)
Pass toggleAttribute should lowercase its name argument (upper case attribute)
Pass toggleAttribute should lowercase its name argument (mixed case attribute)
Pass toggleAttribute should not throw even when qualifiedName starts with 'xmlns'
Pass Basic functionality should be intact. (toggleAttribute)
Fail Basic functionality should be intact. (toggleAttribute)
Pass toggleAttribute should not change the order of previously set attributes.
Pass toggleAttribute should set the first attribute with the given name
Pass toggleAttribute should set the attribute with the given qualified name
Pass Toggling element with inline style should make inline style disappear
Pass When qualifiedName does not match the Name production, an INVALID_CHARACTER_ERR exception is to be thrown. (setAttribute)
Pass When qualifiedName does not match the Name production, an INVALID_CHARACTER_ERR exception is to be thrown, even if the attribute is already present. (setAttribute)
Pass setAttribute should lowercase its name argument (upper case attribute)
Pass setAttribute should lowercase its name argument (mixed case attribute)
Pass setAttribute should not throw even when qualifiedName starts with 'xmlns'
Pass Basic functionality should be intact.
Fail Basic functionality should be intact.
Pass setAttribute should not change the order of previously set attributes.
Pass setAttribute should set the first attribute with the given name
Pass setAttribute should set the attribute with the given qualified name
Pass When qualifiedName does not match the Name production, an INVALID_CHARACTER_ERR exception is to be thrown. (setAttributeNS)
Pass When qualifiedName does not match the Name production, an INVALID_CHARACTER_ERR exception is to be thrown, even if the attribute is already present. (setAttributeNS)
Pass When qualifiedName does not match the QName production, an INVALID_CHARACTER_ERR exception is to be thrown.
Pass null and the empty string should result in a null namespace.
Pass A namespace is required to use a prefix.

View file

@ -11,11 +11,6 @@
<div id="log"></div>
<span id="test1"></span>
<span class="&amp;&lt;&gt;foo"></span>
<span id="test2">
<span ~=""></span>
<span ~></span>
<span></span>
</span>
<script>
var XML = "http://www.w3.org/XML/1998/namespace"
var XMLNS = "http://www.w3.org/2000/xmlns/"
@ -25,36 +20,25 @@ var XMLNS = "http://www.w3.org/2000/xmlns/"
test(function() {
var el = document.createElement("foo")
for (var i = 0; i < invalid_names.length; i++) {
assert_throws_dom("INVALID_CHARACTER_ERR", function() { el.toggleAttribute(invalid_names[i], true) })
assert_throws_dom(
"INVALID_CHARACTER_ERR",
function() { el.toggleAttribute(invalid_names[i], true) },
`toggleAttribute("${invalid_names[i]}", true)`);
}
for (var i = 0; i < invalid_names.length; i++) {
assert_throws_dom("INVALID_CHARACTER_ERR", function() { el.toggleAttribute(invalid_names[i]) })
assert_throws_dom(
"INVALID_CHARACTER_ERR",
function() { el.toggleAttribute(invalid_names[i]) },
`toggleAttribute("${invalid_names[i]}")`);
}
for (var i = 0; i < invalid_names.length; i++) {
assert_throws_dom("INVALID_CHARACTER_ERR", function() { el.toggleAttribute(invalid_names[i], false) })
assert_throws_dom(
"INVALID_CHARACTER_ERR",
function() { el.toggleAttribute(invalid_names[i], false) },
`toggleAttribute("${invalid_names[i]}", false)`);
}
}, "When qualifiedName does not match the Name production, an " +
"INVALID_CHARACTER_ERR exception is to be thrown. (toggleAttribute)")
test(function() {
var el = document.getElementById("test2")
for (var i = 0; i < el.children.length; i++) {
assert_throws_dom("INVALID_CHARACTER_ERR", function() {
el.children[i].toggleAttribute("~", false)
})
}
for (var i = 0; i < el.children.length; i++) {
assert_throws_dom("INVALID_CHARACTER_ERR", function() {
el.children[i].toggleAttribute("~")
})
}
for (var i = 0; i < el.children.length; i++) {
assert_throws_dom("INVALID_CHARACTER_ERR", function() {
el.children[i].toggleAttribute("~", true)
})
}
}, "When qualifiedName does not match the Name production, an " +
"INVALID_CHARACTER_ERR exception is to be thrown, even if the attribute " +
"is already present. (toggleAttribute)")
// Step 2
test(function() {
@ -151,16 +135,6 @@ test(function() {
}
}, "When qualifiedName does not match the Name production, an " +
"INVALID_CHARACTER_ERR exception is to be thrown. (setAttribute)")
test(function() {
var el = document.getElementById("test2")
for (var i = 0; i < el.children.length; i++) {
assert_throws_dom("INVALID_CHARACTER_ERR", function() {
el.children[i].setAttribute("~", "test")
})
}
}, "When qualifiedName does not match the Name production, an " +
"INVALID_CHARACTER_ERR exception is to be thrown, even if the attribute " +
"is already present. (setAttribute)")
// Step 2
test(function() {
@ -237,17 +211,6 @@ test(function() {
}, "When qualifiedName does not match the Name production, an " +
"INVALID_CHARACTER_ERR exception is to be thrown. (setAttributeNS)")
test(function() {
var el = document.getElementById("test2")
for (var i = 0; i < el.children.length; i++) {
assert_throws_dom("INVALID_CHARACTER_ERR", function() {
el.children[i].setAttributeNS(null, "~", "test")
})
}
}, "When qualifiedName does not match the Name production, an " +
"INVALID_CHARACTER_ERR exception is to be thrown, even if the attribute " +
"is already present. (setAttributeNS)")
// Step 2
test(function() {
var el = document.createElement("foo")

View file

@ -1,3 +1,3 @@
var invalid_names = ["", "invalid^Name", "\\", "'", '"', "0", "0:a"] // XXX
var valid_names = ["x", "X", ":", "a:0"]
var invalid_qnames = [":a", "b:", "x:y:z"] // XXX
var invalid_names = [""] // XXX
var valid_names = ["x", "X", ":", "a:0", "invalid^Name", "\\", "'", '"', "0", "0:a", ":a", "x:y:x", "~"]
var invalid_qnames = ["b:"] // XXX