Merge pull request #1861 from pygy/restore-attr-nodeValue

[test-utils/domMock] restore Attr.nodeValue for backwards compatibility
This commit is contained in:
Pierre-Yves Gérardy 2017-05-29 14:04:34 +02:00 committed by GitHub
commit 29bc42b574
2 changed files with 9 additions and 0 deletions

View file

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

View file

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