diff options
author | Marcello Stanisci <stanisci.m@gmail.com> | 2018-09-04 16:20:34 +0200 |
---|---|---|
committer | Marcello Stanisci <stanisci.m@gmail.com> | 2018-09-04 16:20:34 +0200 |
commit | 78f28f53eac7ac5c3f1dbd6f94f619f8f216339c (patch) | |
tree | 22b8925ff1c841c4e5cb4e7d9f3711b779dccd33 | |
parent | 565d73912ec63c0307a01aa9a2554e6998d27df5 (diff) | |
download | backoffice-78f28f53eac7ac5c3f1dbd6f94f619f8f216339c.tar.gz backoffice-78f28f53eac7ac5c3f1dbd6f94f619f8f216339c.tar.bz2 backoffice-78f28f53eac7ac5c3f1dbd6f94f619f8f216339c.zip |
mocking values for tests
-rw-r--r-- | js/test/main.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/js/test/main.js b/js/test/main.js index 0a8505f..edebe86 100644 --- a/js/test/main.js +++ b/js/test/main.js @@ -46,13 +46,17 @@ ava.test.beforeEach(t => { global.XMLHttpRequest = t.context.xhr;}; function minor_mocks() { var document = {}; + document.createElement = ()=> + {return {innerHTML: "", + setAttribute: function(a, b){}}}; document.addEventListener = ()=>{}; document.getElementsByClassName = ()=> {return [{style: {visibility: "hidden"}}]}; document.getElementById = ()=> /* pacifies code that attempts * to change this property anyway. */ - {return {style: {visibility: "hidden"}}}; + {return {style: {visibility: "hidden"}, + appendChild: function(a){}}}; global.document = document; global.alert = console.log; // disable logging for tests |