diff options
Diffstat (limited to 'spec/frontend/__helpers__/dom_shims/image_element_properties.js')
-rw-r--r-- | spec/frontend/__helpers__/dom_shims/image_element_properties.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/frontend/__helpers__/dom_shims/image_element_properties.js b/spec/frontend/__helpers__/dom_shims/image_element_properties.js new file mode 100644 index 00000000000..d94c157e44d --- /dev/null +++ b/spec/frontend/__helpers__/dom_shims/image_element_properties.js @@ -0,0 +1,12 @@ +Object.defineProperty(global.HTMLImageElement.prototype, 'src', { + get() { + return this.$_jest_src || this.getAttribute('src'); + }, + set(val) { + this.$_jest_src = val; + + if (this.onload) { + this.onload(); + } + }, +}); |