Commit 9ad00485 authored by LianaHus's avatar LianaHus Committed by Aniket

ignore checkboxes

parent 47e35676
...@@ -30,6 +30,8 @@ module.exports = class TestTab extends ViewPlugin { ...@@ -30,6 +30,8 @@ module.exports = class TestTab extends ViewPlugin {
this.appManager = appManager this.appManager = appManager
this.renderer = renderer this.renderer = renderer
this.hasBeenStopped = false this.hasBeenStopped = false
this.runningTestsNumber = 0
this.readyTestsNumber = 0
this.baseurl = 'https://solc-bin.ethereum.org/bin' this.baseurl = 'https://solc-bin.ethereum.org/bin'
appManager.event.on('activate', (name) => { appManager.event.on('activate', (name) => {
if (name === 'solidity') this.updateRunAction(fileManager.currentFile()) if (name === 'solidity') this.updateRunAction(fileManager.currentFile())
...@@ -94,8 +96,10 @@ module.exports = class TestTab extends ViewPlugin { ...@@ -94,8 +96,10 @@ module.exports = class TestTab extends ViewPlugin {
if (eChecked) { if (eChecked) {
checkAll.checked = true checkAll.checked = true
runBtn.removeAttribute('disabled') if ((this.readyTestsNumber === this.runningTestsNumber || this.hasBeenStopped) && document.getElementById('runTestsTabStopAction').innerText === 'Stop') {
runBtn.setAttribute('title', 'Run tests') runBtn.removeAttribute('disabled')
runBtn.setAttribute('title', 'Run tests')
}
} else if (!selectedTests.length) { } else if (!selectedTests.length) {
checkAll.checked = false checkAll.checked = false
runBtn.setAttribute('disabled', 'disabled') runBtn.setAttribute('disabled', 'disabled')
...@@ -129,6 +133,7 @@ module.exports = class TestTab extends ViewPlugin { ...@@ -129,6 +133,7 @@ module.exports = class TestTab extends ViewPlugin {
// result.passingNum // result.passingNum
// result.failureNum // result.failureNum
// result.timePassed // result.timePassed
this.testsSummary.hidden = false
cb() cb()
} }
...@@ -164,17 +169,19 @@ module.exports = class TestTab extends ViewPlugin { ...@@ -164,17 +169,19 @@ module.exports = class TestTab extends ViewPlugin {
this.testsSummary.appendChild(yo`<br>`) this.testsSummary.appendChild(yo`<br>`)
}) })
} }
if (this.hasBeenStopped) { if (this.hasBeenStopped && (this.readyTestsNumber !== this.runningTestsNumber)) {
this.testsExecutionStopped.hidden = false this.testsExecutionStopped.hidden = false
} }
if (this.hasBeenStopped || this.readyTestsNumber === this.data.selectedTests.length) { if (this.hasBeenStopped || this.readyTestsNumber === this.runningTestsNumber) {
// All tests are ready or the operation has been canceled // All tests are ready or the operation has been canceled
const stopBtn = document.getElementById('runTestsTabStopAction') const stopBtn = document.getElementById('runTestsTabStopAction')
stopBtn.setAttribute('disabled', 'disabled') stopBtn.setAttribute('disabled', 'disabled')
const stopBtnLabel = document.getElementById('runTestsTabStopActionLabel') const stopBtnLabel = document.getElementById('runTestsTabStopActionLabel')
stopBtnLabel.innerText = 'Stop' stopBtnLabel.innerText = 'Stop'
const runBtn = document.getElementById('runTestsTabRunAction') if (this.data.selectedTests.length !== 0) {
runBtn.removeAttribute('disabled') const runBtn = document.getElementById('runTestsTabRunAction')
runBtn.removeAttribute('disabled')
}
} }
} }
...@@ -244,6 +251,7 @@ module.exports = class TestTab extends ViewPlugin { ...@@ -244,6 +251,7 @@ module.exports = class TestTab extends ViewPlugin {
runTests () { runTests () {
this.hasBeenStopped = false this.hasBeenStopped = false
this.readyTestsNumber = 0 this.readyTestsNumber = 0
this.runningTestsNumber = this.data.selectedTests.length
yo.update(this.resultStatistics, this.createResultLabel()) yo.update(this.resultStatistics, this.createResultLabel())
const stopBtn = document.getElementById('runTestsTabStopAction') const stopBtn = document.getElementById('runTestsTabStopAction')
stopBtn.removeAttribute('disabled') stopBtn.removeAttribute('disabled')
...@@ -251,7 +259,9 @@ module.exports = class TestTab extends ViewPlugin { ...@@ -251,7 +259,9 @@ module.exports = class TestTab extends ViewPlugin {
runBtn.setAttribute('disabled', 'disabled') runBtn.setAttribute('disabled', 'disabled')
this.call('editor', 'clearAnnotations') this.call('editor', 'clearAnnotations')
this.testsOutput.innerHTML = '' this.testsOutput.innerHTML = ''
this.testsOutput.hidden = true
this.testsSummary.innerHTML = '' this.testsSummary.innerHTML = ''
this.testsSummary.hidden = true
this.testsExecutionStopped.hidden = true this.testsExecutionStopped.hidden = true
const tests = this.data.selectedTests const tests = this.data.selectedTests
if (!tests) return if (!tests) return
...@@ -366,14 +376,14 @@ module.exports = class TestTab extends ViewPlugin { ...@@ -366,14 +376,14 @@ module.exports = class TestTab extends ViewPlugin {
createResultLabel () { createResultLabel () {
if (!this.data.selectedTests) return yo`<span></span>` if (!this.data.selectedTests) return yo`<span></span>`
const ready = this.readyTestsNumber ? `${this.readyTestsNumber}` : '0' const ready = this.readyTestsNumber ? `${this.readyTestsNumber}` : '0'
return yo`<span class='text-info ml-1'>Progress: ${ready} finished (out of ${this.data.selectedTests.length})</span>` return yo`<span class='text-info h6'>Progress: ${ready} finished (of ${this.runningTestsNumber})</span>`
} }
render () { render () {
this.onActivationInternal() this.onActivationInternal()
this.testsOutput = yo`<div class="${css.container} mx-3 border-top border-primary" hidden='true' id="solidityUnittestsOutput" data-id="testTabSolidityUnitTestsOutput"></a>` this.testsOutput = yo`<div class="${css.container} mx-3 border-top border-primary" hidden='true' id="solidityUnittestsOutput" data-id="testTabSolidityUnitTestsOutput"></a>`
this.testsSummary = yo`<div class="${css.container} mx-3 pt-2 border-top border-primary" hidden='true' id="solidityUnittestsSummary" data-id="testTabSolidityUnitTestsSummary"></div>` this.testsSummary = yo`<div class="${css.container} mx-3 pt-2 border-top border-primary" hidden='true' id="solidityUnittestsSummary" data-id="testTabSolidityUnitTestsSummary"></div>`
this.testsExecutionStopped = yo`<label class="text-warning h5">The test execution has been stopped</label>` this.testsExecutionStopped = yo`<label class="text-warning h6">The test execution has been stopped</label>`
this.testsExecutionStopped.hidden = true this.testsExecutionStopped.hidden = true
this.resultStatistics = this.createResultLabel() this.resultStatistics = this.createResultLabel()
this.resultStatistics.hidden = true this.resultStatistics.hidden = true
...@@ -394,8 +404,8 @@ module.exports = class TestTab extends ViewPlugin { ...@@ -394,8 +404,8 @@ module.exports = class TestTab extends ViewPlugin {
</div> </div>
${this.selectAll()} ${this.selectAll()}
${this.updateTestFileList()} ${this.updateTestFileList()}
<div class="align-items-start flex-column mt-2 mb-0"> <div class="align-items-start flex-column mt-2 mx-3 mb-0">
<h6>${this.resultStatistics}</h6> ${this.resultStatistics}
${this.testsExecutionStopped} ${this.testsExecutionStopped}
</div> </div>
${this.testsOutput} ${this.testsOutput}
......
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