Skip to content

Commit

Permalink
Add event trigger/register for new File created
Browse files Browse the repository at this point in the history
  • Loading branch information
ninabreznik authored and yann300 committed Jul 18, 2018
1 parent f24e4d1 commit b5cd9f5
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 67 deletions.
79 changes: 24 additions & 55 deletions src/app/tabs/styles/test-tab-styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,61 +3,30 @@ var styleGuide = require('../../ui/styles-guide/theme-chooser')
var styles = styleGuide.chooser()

var css = csjs`
.opts_li {
display: block;
font-weight: bold;
color: ${styles.rightPanel.text_Teriary};
}
.opts_li.active {
color: ${styles.rightPanel.text_Primary};
}
.opts_li:hover {
color: ${styles.rightPanel.icon_HoverColor_TogglePanel};
}
.solIcon {
margin-left: 10px;
margin-right: 30px;
display: flex;
align-self: center;
height: 29px;
width: 20px;
background-color: ${styles.colors.transparent};
}
a {
color: ${styles.rightPanel.text_link};
}
#optionViews > div {
display: none;
}
#optionViews .pre {
word-wrap: break-word;
background-color: ${styles.rightPanel.BackgroundColor_Pre};
border-radius: 3px;
display: inline-block;
padding: 0 0.6em;
}
#optionViews .hide {
display: none;
}
.infoBox {
${styles.infoTextBox}
margin-bottom: 1em;
}
.textBox {
${styles.textBoxL}
margin-bottom: 1em;
}
.icon {
height: 70%;
margin-right: 2%;
}
.testList {
${styles.rightPanel.testTab.box_listTests}
line-height: 2em;
display: flex;
flex-direction: column;
margin: 2%;
}
.testTabView {}
.infoBox {
${styles.rightPanel.testTab.box_listTests};
margin: 2%;
}
.tests {}
.testList {
${styles.rightPanel.testTab.box_listTests};
line-height: 2em;
display: flex;
flex-direction: column;
margin: 2%;
}
.testsOutput {
${styles.rightPanel.testTab.box_listTests};
margin: 2%;
}
.buttons {
${styles.rightPanel.testTab.box_listTests};
margin: 2%;
}
.runButton {
${styles.rightPanel.testTab.button_runTests};
}
`

module.exports = css
26 changes: 14 additions & 12 deletions src/app/tabs/test-tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@ module.exports = class TestTab {
return { render () { return self._view.el } }
}
render () {
var self = this
var container = yo`<div class="tests" id="tests"></div>`
const self = this
var container = yo`<div class=${css.testsOutput} id="tests"></div>`
self.data.allTests = getTests()
self.data.selectedTests = self.data.allTests
console.log(self.data.selectedTests)
function append (container, txt) {
var child = yo`<div>${txt}</div>`
container.appendChild(child)
Expand Down Expand Up @@ -96,9 +95,11 @@ module.exports = class TestTab {
return tests
}

self._events.app.register('newTestFileCreated', file => {
self._events.filePanel.register('newTestFileCreated', file => {
var testList = document.querySelector(`[class^='testList']`)
var test = yo`<label><input onchange =${(e) => toggleCheckbox(e, file)} type="checkbox">${file} </label>`
testList.appendChild(test)
self.data.allTests.push(file)
self.data.selectedTests.push(file)
})

function listTests () {
Expand All @@ -120,15 +121,16 @@ module.exports = class TestTab {

var el = yo`
<div class="${css.testTabView} "id="testView">
<div>
<div class="${css.infoBox}">
</div>
<div class="${css.infoBox}">
Test your smart contract by creating a foo_test.sol file.
Open ballot_test.sol to see the example. For more details, see
How to test smart contracts guide in our documentation.
</div>
<div class="${css.testList}">
<div class=${css.testList}>
${listTests()}
<div class="${css.tests}">
<div class=${css.testList}>${listTests()}</div>
<div class=${css.buttons}>
<div class=${css.runButton} onclick=${runTests}>Run Tests</div>
</div>
<p><button onclick=${runTests}>Run Tests</button></p>
${container}
</div>
</div>
Expand Down
6 changes: 6 additions & 0 deletions src/app/ui/styles-guide/style-guide.js
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,12 @@ function styleGuide () {
BackgroundColor: appProperties.solidBorderBox_BackgroundColor,
BorderColor: appProperties.solidBorderBox_BackgroundColor,
Color: appProperties.solidBorderBox_TextColor
}),

button_runTests: appProperties.uiElements.button({
BackgroundColor: appProperties.primaryButton_BackgroundColor,
BorderColor: appProperties.primaryButton_BorderColor,
Color: appProperties.primaryButton_TextColor
})
},

Expand Down

0 comments on commit b5cd9f5

Please sign in to comment.