From b5cd9f542826a169b9053db67e89f5fdf3d0ab44 Mon Sep 17 00:00:00 2001 From: ninabreznik Date: Mon, 18 Jun 2018 03:34:01 +0100 Subject: [PATCH] Add event trigger/register for new File created --- src/app/tabs/styles/test-tab-styles.js | 79 ++++++++------------------ src/app/tabs/test-tab.js | 26 +++++---- src/app/ui/styles-guide/style-guide.js | 6 ++ 3 files changed, 44 insertions(+), 67 deletions(-) diff --git a/src/app/tabs/styles/test-tab-styles.js b/src/app/tabs/styles/test-tab-styles.js index c7d7c11192..cf5f12b1dd 100644 --- a/src/app/tabs/styles/test-tab-styles.js +++ b/src/app/tabs/styles/test-tab-styles.js @@ -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 diff --git a/src/app/tabs/test-tab.js b/src/app/tabs/test-tab.js index c33bc6f531..81971a394c 100644 --- a/src/app/tabs/test-tab.js +++ b/src/app/tabs/test-tab.js @@ -26,11 +26,10 @@ module.exports = class TestTab { return { render () { return self._view.el } } } render () { - var self = this - var container = yo`
` + const self = this + var container = yo`
` self.data.allTests = getTests() self.data.selectedTests = self.data.allTests - console.log(self.data.selectedTests) function append (container, txt) { var child = yo`
${txt}
` container.appendChild(child) @@ -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`` + testList.appendChild(test) self.data.allTests.push(file) - self.data.selectedTests.push(file) }) function listTests () { @@ -120,15 +121,16 @@ module.exports = class TestTab { var el = yo`
-
-
-
+
+ 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.
-
-
- ${listTests()} +
+
${listTests()}
+
+
Run Tests
-

${container}
diff --git a/src/app/ui/styles-guide/style-guide.js b/src/app/ui/styles-guide/style-guide.js index b2a37fceb8..3890a20d3c 100644 --- a/src/app/ui/styles-guide/style-guide.js +++ b/src/app/ui/styles-guide/style-guide.js @@ -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 }) },