Commit df362b90 authored by LianaHus's avatar LianaHus Committed by Aniket

disable Stop:

parent 8fec5d48
...@@ -150,6 +150,7 @@ module.exports = class TestTab extends ViewPlugin { ...@@ -150,6 +150,7 @@ module.exports = class TestTab extends ViewPlugin {
this.testsSummary.appendChild(yo`<div class="text-success" >${result.totalPassing} passing (${result.totalTime}s)</div>`) this.testsSummary.appendChild(yo`<div class="text-success" >${result.totalPassing} passing (${result.totalTime}s)</div>`)
this.testsSummary.appendChild(yo`<br>`) this.testsSummary.appendChild(yo`<br>`)
} }
if (result) {
if (result.totalFailing > 0) { if (result.totalFailing > 0) {
this.testsSummary.appendChild(yo`<div class="text-danger" >${result.totalFailing} failing</div>`) this.testsSummary.appendChild(yo`<div class="text-danger" >${result.totalFailing} failing</div>`)
this.testsSummary.appendChild(yo`<br>`) this.testsSummary.appendChild(yo`<br>`)
...@@ -159,9 +160,15 @@ module.exports = class TestTab extends ViewPlugin { ...@@ -159,9 +160,15 @@ module.exports = class TestTab extends ViewPlugin {
this.testsSummary.appendChild(yo`<div class="${css.testFailureSummary} text-danger" >${error.message}</div>`) this.testsSummary.appendChild(yo`<div class="${css.testFailureSummary} text-danger" >${error.message}</div>`)
this.testsSummary.appendChild(yo`<br>`) this.testsSummary.appendChild(yo`<br>`)
}) })
}
if (this.hasBeenStopped) { if (this.hasBeenStopped) {
this.testsSummary.appendChild(yo`<label class="text-warning h5">The test execution has been stopped</label>`) this.testsSummary.appendChild(yo`<label class="text-warning h5">The test execution has been stopped</label>`)
} }
const stopBtn = document.getElementById('runTestsTabStopAction')
const stopBtnLabel = document.getElementById('runTestsTabStopActionLabel')
stopBtnLabel.innerText = 'Stop'
stopBtn.setAttribute('disabled', 'disabled')
} }
async testFromPath (path) { async testFromPath (path) {
...@@ -229,6 +236,9 @@ module.exports = class TestTab extends ViewPlugin { ...@@ -229,6 +236,9 @@ module.exports = class TestTab extends ViewPlugin {
} }
runTests () { runTests () {
this.hasBeenStopped = false;
const stopBtn = document.getElementById('runTestsTabStopAction')
stopBtn.removeAttribute('disabled')
this.call('editor', 'clearAnnotations') this.call('editor', 'clearAnnotations')
this.testsOutput.innerHTML = '' this.testsOutput.innerHTML = ''
this.testsSummary.innerHTML = '' this.testsSummary.innerHTML = ''
...@@ -240,6 +250,8 @@ module.exports = class TestTab extends ViewPlugin { ...@@ -240,6 +250,8 @@ module.exports = class TestTab extends ViewPlugin {
stopTests () { stopTests () {
this.hasBeenStopped = true this.hasBeenStopped = true
const stopBtnLabel = document.getElementById('runTestsTabStopActionLabel')
stopBtnLabel.innerText = 'Stopping...'
} }
updateGenerateFileAction (currentFile) { updateGenerateFileAction (currentFile) {
...@@ -258,9 +270,9 @@ module.exports = class TestTab extends ViewPlugin { ...@@ -258,9 +270,9 @@ module.exports = class TestTab extends ViewPlugin {
updateRunAction (currentFile) { updateRunAction (currentFile) {
let el = yo` let el = yo`
<button id="runTestsTabRunAction" data-id="testTabRunTestsTabRunAction" class="w-50 btn btn-primary" onclick="${() => { this.hasBeenStopped = false; this.runTests() }}"> <button id="runTestsTabRunAction" data-id="testTabRunTestsTabRunAction" class="w-50 btn btn-primary" onclick="${() => this.runTests()}">
<span class="fas fa-play ml-2"></span> <span class="fas fa-play ml-2"></span>
<label class="btn btn-primary p-1 ml-2 m-0">Run</label> <label class="btn bg-transparent p-1 ml-2 m-0">Run</label>
</button> </button>
` `
const isSolidityActive = this.appManager.actives.includes('solidity') const isSolidityActive = this.appManager.actives.includes('solidity')
...@@ -281,17 +293,12 @@ module.exports = class TestTab extends ViewPlugin { ...@@ -281,17 +293,12 @@ module.exports = class TestTab extends ViewPlugin {
} }
updateStopAction () { updateStopAction () {
const runBtn = document.getElementById('runTestsTabRunAction') return yo`
const stopBtn = yo` <button id="runTestsTabStopAction" class="w-50 pl-2 ml-2 btn btn-secondary" disabled="disabled" title="Stop running tests" onclick=${() => this.stopTests()}">
<button id="runTestsTabStopAction" class="w-50 pl-2 ml-2 btn btn-secondary" title="Stop running tests" onclick=${() => this.stopTests()}">
<span class="fas fa-stop ml-2"></span> <span class="fas fa-stop ml-2"></span>
<label class="btn btn-secondary p-1 ml-2 m-0">Stop</label> <label class="btn bg-transparent p-1 ml-2 m-0" id="runTestsTabStopActionLabel">Stop</label>
</button> </button>
` `
if (runBtn && runBtn.getAttribute('disabled')) {
runBtn.setAttribute('disabled', 'disabled')
}
return stopBtn
} }
updateTestFileList (tests) { updateTestFileList (tests) {
......
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