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
75b5ac61
Commit
75b5ac61
authored
Mar 07, 2019
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix test tab
parent
f5155392
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
19 deletions
+29
-19
test-tab.js
src/app/tabs/test-tab.js
+22
-15
testTab.js
src/app/tabs/testTab/testTab.js
+7
-4
No files found.
src/app/tabs/test-tab.js
View file @
75b5ac61
...
...
@@ -12,12 +12,12 @@ module.exports = class TestTab extends ApiFactory {
super
()
this
.
compileTab
=
compileTab
this
.
_view
=
{
el
:
null
}
this
.
compileTab
=
compileTab
this
.
fileManager
=
fileManager
this
.
filePanel
=
filePanel
this
.
testTabLogic
=
new
TestTabLogic
(
fileManager
)
this
.
data
=
{}
this
.
testList
=
yo
`<div class=
${
css
.
testList
}
></div>`
this
.
listenToEvents
()
}
get
profile
()
{
...
...
@@ -31,6 +31,13 @@ module.exports = class TestTab extends ApiFactory {
}
}
activate
()
{
this
.
listenToEvents
()
}
deactivate
()
{
}
listenToEvents
()
{
this
.
filePanel
.
event
.
register
(
'newTestFileCreated'
,
file
=>
{
var
testList
=
this
.
view
.
querySelector
(
"[class^='testList']"
)
...
...
@@ -40,7 +47,7 @@ module.exports = class TestTab extends ApiFactory {
this
.
data
.
selectedTests
.
push
(
file
)
})
this
.
fileManager
.
event
.
register
(
'currentFileChanged'
,
(
file
,
provider
)
=>
{
this
.
fileManager
.
event
s
.
on
(
'currentFileChanged'
,
(
file
,
provider
)
=>
{
this
.
testTabLogic
.
getTests
((
error
,
tests
)
=>
{
if
(
error
)
return
tooltip
(
error
)
this
.
data
.
allTests
=
tests
...
...
@@ -93,9 +100,9 @@ module.exports = class TestTab extends ApiFactory {
if
(
result
.
type
===
'contract'
)
{
this
.
testsOutput
.
appendChild
(
yo
`<div class=
${
css
.
outputTitle
}
>
${
result
.
filename
}
(
${
result
.
value
}
)</div>`
)
}
else
if
(
result
.
type
===
'testPass'
)
{
this
.
testsOutput
.
appendChild
(
yo
`<div class=
'
${
css
.
testPass
}
${
css
.
testLog
}
'
>✓ (
${
result
.
value
}
)</div>`
)
this
.
testsOutput
.
appendChild
(
yo
`<div class=
"
${
css
.
testPass
}
${
css
.
testLog
}
bg-success"
>✓ (
${
result
.
value
}
)</div>`
)
}
else
if
(
result
.
type
===
'testFailure'
)
{
this
.
testsOutput
.
appendChild
(
yo
`<div class=
'
${
css
.
testFailure
}
${
css
.
testLog
}
'
>✘ (
${
result
.
value
}
)</div>`
)
this
.
testsOutput
.
appendChild
(
yo
`<div class=
"
${
css
.
testFailure
}
${
css
.
testLog
}
bg-danger"
>✘ (
${
result
.
value
}
)</div>`
)
}
}
...
...
@@ -110,21 +117,21 @@ module.exports = class TestTab extends ApiFactory {
updateFinalResult
(
_err
,
result
,
filename
)
{
this
.
testsSummary
.
hidden
=
false
if
(
_err
)
{
this
.
testsSummary
.
appendChild
(
yo
`<div class=
${
css
.
testFailureSummary
}
>
${
_err
.
message
}
</div>`
)
this
.
testsSummary
.
appendChild
(
yo
`<div class=
"
${
css
.
testFailureSummary
}
text-danger"
>
${
_err
.
message
}
</div>`
)
return
}
this
.
testsSummary
.
appendChild
(
yo
`<div class=
${
css
.
summaryTitle
}
>
${
filename
}
</div>`
)
if
(
result
.
totalPassing
>
0
)
{
this
.
testsSummary
.
appendChild
(
yo
`<div>
${
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>`
)
}
if
(
result
.
totalFailing
>
0
)
{
this
.
testsSummary
.
appendChild
(
yo
`<div>
${
result
.
totalFailing
}
failing</div>`
)
this
.
testsSummary
.
appendChild
(
yo
`<div
class="text-danger"
>
${
result
.
totalFailing
}
failing</div>`
)
this
.
testsSummary
.
appendChild
(
yo
`<br>`
)
}
result
.
errors
.
forEach
((
error
,
index
)
=>
{
this
.
testsSummary
.
appendChild
(
yo
`<div>
${
error
.
context
}
-
${
error
.
value
}
</div>`
)
this
.
testsSummary
.
appendChild
(
yo
`<div class=
${
css
.
testFailureSummary
}
>
${
error
.
message
}
</div>`
)
this
.
testsSummary
.
appendChild
(
yo
`<div
class="text-danger"
>
${
error
.
context
}
-
${
error
.
value
}
</div>`
)
this
.
testsSummary
.
appendChild
(
yo
`<div class=
"
${
css
.
testFailureSummary
}
text-danger"
>
${
error
.
message
}
</div>`
)
this
.
testsSummary
.
appendChild
(
yo
`<br>`
)
})
}
...
...
@@ -134,7 +141,7 @@ module.exports = class TestTab extends ApiFactory {
if
(
error
)
return
var
runningTest
=
{}
runningTest
[
testFilePath
]
=
{
content
}
remixTests
.
runTestSources
(
runningTest
,
this
.
testCallback
,
this
.
resultsCallback
,
(
error
,
result
)
=>
{
remixTests
.
runTestSources
(
runningTest
,
(
result
)
=>
{
this
.
testCallback
(
result
)
},
(
_err
,
result
,
cb
)
=>
{
this
.
resultsCallback
(
_err
,
result
,
cb
)
}
,
(
error
,
result
)
=>
{
this
.
updateFinalResult
(
error
,
result
,
testFilePath
)
callback
(
error
)
},
(
url
,
cb
)
=>
{
...
...
@@ -151,8 +158,8 @@ module.exports = class TestTab extends ApiFactory {
}
render
()
{
this
.
testsOutput
=
yo
`<div class=
${
css
.
container
}
hidden='true' id="tests"></div>`
this
.
testsSummary
=
yo
`<div class=
${
css
.
container
}
hidden='true' id="tests"></div>`
this
.
testsOutput
=
yo
`<div class=
"
${
css
.
container
}
border border-primary border-right-0 border-left-0 border-bottom-0"
hidden='true' id="tests"></div>`
this
.
testsSummary
=
yo
`<div class=
"
${
css
.
container
}
border border-primary border-right-0 border-left-0 border-bottom-0"
hidden='true' id="tests"></div>`
var
el
=
yo
`
<div class="
${
css
.
testTabView
}
card" id="testView">
...
...
@@ -165,12 +172,12 @@ module.exports = class TestTab extends ApiFactory {
<br/>
For more details, see
How to test smart contracts guide in our documentation.
<div class="
${
css
.
generateTestFile
}
" onclick="
${
this
.
testTabLogic
.
generateTestFile
(
this
)}
">Generate test file</div>
<div class="
${
css
.
generateTestFile
}
btn btn-primary m-1
" onclick="
${
this
.
testTabLogic
.
generateTestFile
(
this
)}
">Generate test file</div>
</div>
<div class="
${
css
.
tests
}
">
${
this
.
testList
}
<div class="
${
css
.
buttons
}
">
<div class="
${
css
.
runButton
}
" onclick="
${
this
.
runTests
.
bind
(
this
)}
">Run Tests</div>
<div class="
${
css
.
buttons
}
btn-group
">
<div class="
${
css
.
runButton
}
btn btn-primary m-1
" onclick="
${
this
.
runTests
.
bind
(
this
)}
">Run Tests</div>
<label class="
${
css
.
label
}
" for="checkAllTests">
<input id="checkAllTests"
type="checkbox"
...
...
src/app/tabs/testTab/testTab.js
View file @
75b5ac61
...
...
@@ -18,19 +18,22 @@ class TestTabLogic {
})
}
getTests
(
cb
)
{
async
getTests
(
cb
)
{
var
path
=
this
.
fileManager
.
currentPath
()
if
(
!
path
)
return
cb
(
null
,
[])
var
provider
=
this
.
fileManager
.
fileProviderOf
(
path
)
if
(
!
provider
)
return
cb
(
null
,
[])
var
tests
=
[]
this
.
fileManager
.
filesFromPath
(
path
,
(
error
,
files
)
=>
{
if
(
error
)
return
cb
(
error
)
let
files
try
{
files
=
await
this
.
fileManager
.
getFilesFromPath
(
path
)
}
catch
(
e
)
{
cb
(
e
.
message
)
}
for
(
var
file
in
files
)
{
if
(
/.
(
_test.sol
)
$/
.
exec
(
file
))
tests
.
push
(
provider
.
type
+
'/'
+
file
)
}
cb
(
null
,
tests
)
})
}
generateTestContractSample
()
{
...
...
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