Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
dd427660
Commit
dd427660
authored
Apr 20, 2020
by
LianaHus
Committed by
Aniket
Apr 24, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implemented Stop
parent
3e614224
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
9 deletions
+27
-9
test-tab.js
src/app/tabs/test-tab.js
+27
-9
No files found.
src/app/tabs/test-tab.js
View file @
dd427660
...
...
@@ -29,6 +29,7 @@ module.exports = class TestTab extends ViewPlugin {
this
.
data
=
{}
this
.
appManager
=
appManager
this
.
renderer
=
renderer
this
.
hasBeenStoped
=
false
this
.
baseurl
=
'https://solc-bin.ethereum.org/bin'
appManager
.
event
.
on
(
'activate'
,
(
name
)
=>
{
if
(
name
===
'solidity'
)
this
.
updateRunAction
(
fileManager
.
currentFile
())
...
...
@@ -158,6 +159,9 @@ module.exports = class TestTab extends ViewPlugin {
this
.
testsSummary
.
appendChild
(
yo
`<div class="
${
css
.
testFailureSummary
}
text-danger" >
${
error
.
message
}
</div>`
)
this
.
testsSummary
.
appendChild
(
yo
`<br>`
)
})
if
(
this
.
hasBeenStoped
)
{
this
.
testsSummary
.
appendChild
(
yo
`<label class="text-warning h5">The test execution has been stopped</label>`
)
}
}
async
testFromPath
(
path
)
{
...
...
@@ -190,6 +194,10 @@ module.exports = class TestTab extends ViewPlugin {
}
runTest
(
testFilePath
,
callback
)
{
if
(
this
.
hasBeenStoped
)
{
this
.
updateFinalResult
()
return
}
this
.
loading
.
hidden
=
false
this
.
fileManager
.
getFile
(
testFilePath
).
then
((
content
)
=>
{
const
runningTest
=
{}
...
...
@@ -224,12 +232,16 @@ module.exports = class TestTab extends ViewPlugin {
this
.
call
(
'editor'
,
'clearAnnotations'
)
this
.
testsOutput
.
innerHTML
=
''
this
.
testsSummary
.
innerHTML
=
''
var
tests
=
this
.
data
.
selectedTests
const
tests
=
this
.
data
.
selectedTests
if
(
!
tests
)
return
this
.
loading
.
hidden
=
tests
.
length
===
0
async
.
eachOfSeries
(
tests
,
(
value
,
key
,
callback
)
=>
{
this
.
runTest
(
value
,
callback
)
})
}
stopTests
()
{
this
.
hasBeenStoped
=
true
}
updateGenerateFileAction
(
currentFile
)
{
let
el
=
yo
`<button class="btn border w-50" data-id="testTabGenerateTestFile" title="Generate sample test file." onclick="
${
this
.
testTabLogic
.
generateTestFile
.
bind
(
this
.
testTabLogic
)}
">Generate</button>`
if
(
!
currentFile
)
{
...
...
@@ -246,17 +258,18 @@ module.exports = class TestTab extends ViewPlugin {
updateRunAction
(
currentFile
)
{
let
el
=
yo
`
<
div id="runTestsTabRunAction" data-id="testTabRunTestsTabRunAction" class="w-50 btn btn-primary" onclick="
${
this
.
runTests
.
bind
(
this
)
}
">
<
button id="runTestsTabRunAction" data-id="testTabRunTestsTabRunAction" class="w-50 btn btn-primary" onclick="
${()
=>
{
this
.
hasBeenStoped
=
false
;
this
.
runTests
()
}
}
">
<span class="
fas
fa
-
play
ml
-
2
"></span>
<label class="
btn
p
-
1
ml
-
2
m
-
0
">Run</label>
</
div
>
</
button
>
`
const isSolidityActive = this.appManager.actives.includes('solidity')
if (!currentFile || !isSolidityActive) {
el.setAttribute('disabled', 'disabled')
if (!currentFile) {
el.setAttribute('title', 'No file selected')
}
else
if
(
!
isSolidityActive
)
el
.
setAttribute
(
'title'
,
'The solidity module should be activated'
)
} else if (!isSolidityActive) el.setAttribute('title', 'The "
Solidity
Plugin
" should be activated')
// @todo(#2747) we can activate the plugin here
}
if (!this.runActionElement) {
...
...
@@ -268,12 +281,17 @@ module.exports = class TestTab extends ViewPlugin {
}
updateStopAction () {
return
yo
`
<div id="runTestsTabStopAction" class="w-50 pl-2 ml-2 btn btn-secondary" title="Stop running tests" onclick="
${
this
.
runTests
.
bind
(
this
)}
">
<span class="fas fa-stop ml-2"></span>
<label class="btn p-1 ml-2 m-0">Stop</label>
</div>
const runBtn = document.getElementById('runTestsTabRunAction')
const stopBtn = yo`
<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
>
<
label
class
=
"btn p-1 ml-2 m-0"
>
Stop
<
/label
>
<
/button
>
`
if (runBtn && runBtn.getAttribute('disabled')) {
runBtn.setAttribute('disabled', 'disabled')
}
return stopBtn
}
updateTestFileList (tests) {
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment