Commit 2e792872 authored by serapath's avatar serapath

testTab: refactor prepare class

parent 00a94809
...@@ -8,7 +8,7 @@ function append (container, txt) { ...@@ -8,7 +8,7 @@ function append (container, txt) {
container.appendChild(child) container.appendChild(child)
} }
function testTabView (api) { function render (api) {
var container = yo`<div class="tests" id="tests"></div>` var container = yo`<div class="tests" id="tests"></div>`
let testCallback = function (result) { let testCallback = function (result) {
...@@ -87,7 +87,7 @@ function testTabView (api) { ...@@ -87,7 +87,7 @@ function testTabView (api) {
} }
function testTab (api = {}, events = {}, opts = {}) { function testTab (api = {}, events = {}, opts = {}) {
let el = testTabView(api) let el = render(api)
let gitterIsLoaded = false let gitterIsLoaded = false
events.app.register('tabChanged', (tabName) => { events.app.register('tabChanged', (tabName) => {
...@@ -95,7 +95,7 @@ function testTab (api = {}, events = {}, opts = {}) { ...@@ -95,7 +95,7 @@ function testTab (api = {}, events = {}, opts = {}) {
return return
} }
yo.update(el, testTabView(api)) yo.update(el, render(api))
el.style.display = 'block' el.style.display = 'block'
gitterIsLoaded = true gitterIsLoaded = true
}) })
...@@ -103,4 +103,9 @@ function testTab (api = {}, events = {}, opts = {}) { ...@@ -103,4 +103,9 @@ function testTab (api = {}, events = {}, opts = {}) {
return { render () { return el } } return { render () { return el } }
} }
module.exports = testTab const prototype = {
constructor: testTab,
render: render
}
prototype.constructor.prototype = prototype
module.exports = prototype.constructor
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