[test-utils/domMock] restore Attr.nodeValue for backwards compatibility

This commit is contained in:
Pierre-Yves Gerardy 2017-05-29 13:59:31 +02:00
parent 662e0f1a9a
commit 195263d226
2 changed files with 9 additions and 0 deletions

View file

@ -111,6 +111,10 @@ module.exports = function(options) {
nodeValue = "" + value
/*eslint-enable no-implicit-coercion*/
},
get nodeValue() {return nodeValue},
set nodeValue(value) {
this.value = value
}
}
}
function setAttributeNS(ns, name, value) {

View file

@ -349,6 +349,7 @@ o.spec("domMock", function() {
div.setAttribute("id", "aaa")
o(div.attributes["id"].value).equals("aaa")
o(div.attributes["id"].nodeValue).equals("aaa")
o(div.attributes["id"].namespaceURI).equals(null)
})
o("works w/ number", function() {
@ -381,6 +382,10 @@ o.spec("domMock", function() {
div.attributes["id"].value = 123
o(div.attributes["id"].value).equals("123")
div.attributes["id"].nodeValue = 456
o(div.attributes["id"].value).equals("456")
})
})
o.spec("hasAttribute", function() {