aboutsummaryrefslogtreecommitdiffstats
path: root/mascara
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2017-09-14 07:45:31 +0800
committerkumavis <aaron@kumavis.me>2017-09-14 07:45:31 +0800
commit56db3999adeaec1733218173b260bf74fa63ccbe (patch)
tree4a85497ce8bbed94935b695283a379686b390212 /mascara
parentdd90e8e364a7023431be081d293d10129b76422c (diff)
downloadtangerine-wallet-browser-56db3999adeaec1733218173b260bf74fa63ccbe.tar.gz
tangerine-wallet-browser-56db3999adeaec1733218173b260bf74fa63ccbe.tar.zst
tangerine-wallet-browser-56db3999adeaec1733218173b260bf74fa63ccbe.zip
tests - start migrating mascara tests to karma
Diffstat (limited to 'mascara')
-rw-r--r--mascara/src/ui.js9
-rw-r--r--mascara/test/test-ui.js13
-rw-r--r--mascara/test/window-load.js5
3 files changed, 20 insertions, 7 deletions
diff --git a/mascara/src/ui.js b/mascara/src/ui.js
index 5f9be542f..5662270c1 100644
--- a/mascara/src/ui.js
+++ b/mascara/src/ui.js
@@ -44,13 +44,18 @@ background.on('ready', (sw) => {
background.removeListener('updatefound', connectApp)
connectApp(sw)
})
-background.on('updatefound', () => window.location.reload())
+background.on('updatefound', windowReload)
background.startWorker()
.then(() => {
setTimeout(() => {
const appContent = document.getElementById(`app-content`)
- if (!appContent.children.length) window.location.reload()
+ if (!appContent.children.length) windowReload()
}, 2000)
})
console.log('hello from MetaMascara ui!')
+
+function windowReload() {
+ if (window.METAMASK_SKIP_RELOAD) return
+ window.location.reload()
+}
diff --git a/mascara/test/test-ui.js b/mascara/test/test-ui.js
new file mode 100644
index 000000000..ebeffe8cb
--- /dev/null
+++ b/mascara/test/test-ui.js
@@ -0,0 +1,13 @@
+const Helper = require('./util/mascara-test-helper.js')
+
+window.METAMASK_SKIP_RELOAD = true
+window.addEventListener('load', () => {
+ // inject app container
+ const body = document.body
+ const container = document.createElement('div')
+ container.id = 'app-content'
+ body.appendChild(container)
+
+ // start ui
+ require('../src/ui.js')
+})
diff --git a/mascara/test/window-load.js b/mascara/test/window-load.js
deleted file mode 100644
index d3f44f05f..000000000
--- a/mascara/test/window-load.js
+++ /dev/null
@@ -1,5 +0,0 @@
-const Helper = require('./util/mascara-test-helper.js')
-
-window.addEventListener('load', () => {
- require('../src/ui.js')
-})