Unverified Commit e1ff449b authored by yann300's avatar yann300 Committed by GitHub

Merge pull request #1350 from ethereum/test-tab

Test tab
parents 00a94809 afb18496
......@@ -3,14 +3,36 @@ var async = require('async')
var css = require('./styles/test-tab-styles')
var remixTests = require('remix-tests')
function append (container, txt) {
let child = yo`<div>${txt}</div>`
container.appendChild(child)
}
module.exports = class TestTab {
constructor (api = {}, events = {}, opts = {}) {
const self = this
self._opts = opts
self._api = api
self._events = events
self._view = { el: null }
self._components = {}
self.data = {}
function testTabView (api) {
self._view.el = self.render()
events.app.register('tabChanged', tabName => {
if (tabName !== 'test') return
yo.update(self._view.el, self.render())
self._view.el.style.display = 'block'
})
return { render () { return self._view.el } }
}
render () {
const self = this
const api = self._api
var container = yo`<div class="tests" id="tests"></div>`
function append (container, txt) {
let child = yo`<div>${txt}</div>`
container.appendChild(child)
}
let testCallback = function (result) {
if (result.type === 'contract') {
append(container, '\n ' + result.value)
......@@ -72,7 +94,7 @@ function testTabView (api) {
})
}
return yo`
var el = yo`
<div class="${css.testTabView} "id="testView">
<div>
<div class="${css.infoBox}">
......@@ -84,23 +106,6 @@ function testTabView (api) {
</div>
</div>
`
}
function testTab (api = {}, events = {}, opts = {}) {
let el = testTabView(api)
let gitterIsLoaded = false
events.app.register('tabChanged', (tabName) => {
if (tabName !== 'test' || gitterIsLoaded) {
return
return el
}
yo.update(el, testTabView(api))
el.style.display = 'block'
gitterIsLoaded = true
})
return { render () { return el } }
}
module.exports = testTab
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment