Add tests for #1870
This commit is contained in:
parent
6c06d41f94
commit
894152440b
3 changed files with 63 additions and 6 deletions
|
|
@ -345,18 +345,22 @@ module.exports = function(options) {
|
|||
if (element.nodeName === "TEXTAREA") {
|
||||
var wasNeverSet = true
|
||||
var value = ""
|
||||
var valueSetter = spy(function(v) {
|
||||
wasNeverSet = false
|
||||
/*eslint-disable no-implicit-coercion*/
|
||||
value = v === null ? "" : "" + v
|
||||
/*eslint-enable no-implicit-coercion*/
|
||||
})
|
||||
Object.defineProperty(element, "value", {
|
||||
get: function() {
|
||||
return wasNeverSet && this.firstChild ? this.firstChild.nodeValue : value
|
||||
},
|
||||
set: function(v) {
|
||||
wasNeverSet = false
|
||||
/*eslint-disable no-implicit-coercion*/
|
||||
value = v === null ? "" : "" + v
|
||||
/*eslint-enable no-implicit-coercion*/
|
||||
},
|
||||
set: valueSetter,
|
||||
enumerable: true,
|
||||
})
|
||||
registerSpies(element, {
|
||||
valueSetter: valueSetter
|
||||
})
|
||||
}
|
||||
|
||||
/* eslint-disable radix */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue