diff --git a/src/app/tabs/styles/test-tab-styles.js b/src/app/tabs/styles/test-tab-styles.js index cf5f12b1dd..8a78a0ec34 100644 --- a/src/app/tabs/styles/test-tab-styles.js +++ b/src/app/tabs/styles/test-tab-styles.js @@ -16,9 +16,28 @@ var css = csjs` flex-direction: column; margin: 2%; } - .testsOutput { + .container { ${styles.rightPanel.testTab.box_listTests}; margin: 2%; + padding-bottom: 5%; + } + .outputTitle { + font-weight: bold; + margin: 10px 0; + } + .summaryTitle { + font-weight: bold; + } + .testPass { + background-color: ${styles.rightPanel.testTab.color_testPass}; + } + .testLog { + margin-bottom: 1%; + border-radius: 4px; + padding: 1% 1% 1% 5%; + } + .testFailure { + background-color: ${styles.rightPanel.testTab.color_testFail}; } .buttons { ${styles.rightPanel.testTab.box_listTests}; diff --git a/src/app/tabs/test-tab.js b/src/app/tabs/test-tab.js index b6f4838ae1..8b09f33e42 100644 --- a/src/app/tabs/test-tab.js +++ b/src/app/tabs/test-tab.js @@ -27,21 +27,19 @@ module.exports = class TestTab { } render () { const self = this - var container = yo`
` + var testsOutput = yo`` + var testsSummary = yo`` self.data.allTests = getTests() self.data.selectedTests = [...self.data.allTests] - function append (container, txt) { - var child = yo`
${txt}
` - container.appendChild(child) - } var testCallback = function (result) { + testsOutput.hidden = false if (result.type === 'contract') { - append(container, '\n ' + result.value) + testsOutput.appendChild(yo`
${result.filename} (${result.value})
`) } else if (result.type === 'testPass') { - append(container, '\t✓ ' + result.value) + testsOutput.appendChild(yo`
✓ (${result.value})
`) } else if (result.type === 'testFailure') { - append(container, '\t✘ ' + result.value) + testsOutput.appendChild(yo`
✘ (${result.value})
`) } } @@ -54,17 +52,17 @@ module.exports = class TestTab { } var updateFinalResult = function (_err, result) { + testsSummary.hidden = false if (result.totalPassing > 0) { - append(container, (' ' + result.totalPassing + ' passing ') + ('(' + result.totalTime + 's)')) + testsSummary.appendChild(yo`
${result.totalPassing} passing (${result.totalTime}s)
`) } if (result.totalFailing > 0) { - append(container, (' ' + result.totalFailing + ' failing')) + testsSummary.appendChild(yo`
${result.totalFailing} failing
`) } - result.errors.forEach((error, index) => { - append(container, ' ' + (index + 1) + ') ' + error.context + ' ' + error.value) - append(container, '') - append(container, ('\t error: ' + error.message)) + testsSummary.appendChild(yo`
${index + 1} ${error.context}} ${error.value}
`) + testsSummary.appendChild(yo`
`) + testsSummary.appendChild(yo`
error: ${error.message}
`) }) } @@ -96,7 +94,7 @@ module.exports = class TestTab { } self._events.filePanel.register('newTestFileCreated', file => { - var testList = document.querySelector(`[class^='testList']`) + var testList = document.querySelector("[class^='testList']") var test = yo`` testList.appendChild(test) self.data.allTests.push(file) @@ -122,7 +120,8 @@ module.exports = class TestTab { } var runTests = function () { - container.innerHTML = '' + testsOutput.innerHTML = '' + testsSummary.innerHTML = '' var tests = self.data.selectedTests async.eachOfSeries(tests, (value, key, callback) => { runTest(value, callback) }) } @@ -139,7 +138,8 @@ module.exports = class TestTab {
Run Tests
- ${container} + ${testsOutput} + ${testsSummary} ` diff --git a/src/app/ui/styles-guide/style-guide.js b/src/app/ui/styles-guide/style-guide.js index 3890a20d3c..7c2874a428 100644 --- a/src/app/ui/styles-guide/style-guide.js +++ b/src/app/ui/styles-guide/style-guide.js @@ -668,7 +668,10 @@ function styleGuide () { BackgroundColor: appProperties.primaryButton_BackgroundColor, BorderColor: appProperties.primaryButton_BorderColor, Color: appProperties.primaryButton_TextColor - }) + }), + + color_testPass: appProperties.success_BackgroundColor, + color_testFail: appProperties.danger_BackgroundColor }, /* ::::::::::::::