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
fd2fbce7
Commit
fd2fbce7
authored
Feb 25, 2019
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bootstrap unit testing
parent
38cb9139
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
29 deletions
+18
-29
test-tab-styles.js
src/app/tabs/styles/test-tab-styles.js
+0
-11
test-tab.js
src/app/tabs/test-tab.js
+18
-18
No files found.
src/app/tabs/styles/test-tab-styles.js
View file @
fd2fbce7
var
csjs
=
require
(
'csjs-inject'
)
var
csjs
=
require
(
'csjs-inject'
)
var
styleGuide
=
require
(
'../../ui/styles-guide/theme-chooser'
)
var
styles
=
styleGuide
.
chooser
()
var
css
=
csjs
`
var
css
=
csjs
`
.testTabView {}
.testTabView {}
.infoBox {
.infoBox {
${
styles
.
rightPanel
.
testTab
.
box_listTests
}
;
margin: 2%;
margin: 2%;
}
}
.tests {}
.tests {}
.testList {
.testList {
${
styles
.
rightPanel
.
testTab
.
box_listTests
}
;
line-height: 2em;
line-height: 2em;
display: flex;
display: flex;
flex-direction: column;
flex-direction: column;
margin: 2%;
margin: 2%;
}
}
.container {
.container {
${
styles
.
rightPanel
.
testTab
.
box_listTests
}
;
margin: 2%;
margin: 2%;
padding-bottom: 5%;
padding-bottom: 5%;
}
}
...
@@ -29,7 +24,6 @@ var css = csjs`
...
@@ -29,7 +24,6 @@ var css = csjs`
font-weight: bold;
font-weight: bold;
}
}
.testPass {
.testPass {
background-color:
${
styles
.
rightPanel
.
testTab
.
color_testPass
}
;
}
}
.testLog {
.testLog {
margin-bottom: 1%;
margin-bottom: 1%;
...
@@ -37,22 +31,17 @@ var css = csjs`
...
@@ -37,22 +31,17 @@ var css = csjs`
padding: 1% 1% 1% 5%;
padding: 1% 1% 1% 5%;
}
}
.testFailure {
.testFailure {
background-color:
${
styles
.
rightPanel
.
testTab
.
color_testFail
}
;
}
}
.testFailureSummary {
.testFailureSummary {
color:
${
styles
.
appProperties
.
errorText_Color
}
;
}
}
.buttons {
.buttons {
${
styles
.
rightPanel
.
testTab
.
box_listTests
}
;
margin: 2%;
margin: 2%;
display: flex;
display: flex;
align-items: center;
align-items: center;
}
}
.runButton {
.runButton {
${
styles
.
rightPanel
.
testTab
.
button_runTests
}
;
}
}
.generateTestFile {
.generateTestFile {
${
styles
.
rightPanel
.
testTab
.
button_generateTestFile
}
;
min-width: 100px
min-width: 100px
}
}
.title {
.title {
...
...
src/app/tabs/test-tab.js
View file @
fd2fbce7
...
@@ -35,17 +35,17 @@ module.exports = class TestTab {
...
@@ -35,17 +35,17 @@ module.exports = class TestTab {
}
}
render
()
{
render
()
{
const
self
=
this
const
self
=
this
var
testsOutput
=
yo
`<div class=
${
css
.
container
}
hidden='true' id="tests"></div>`
var
testsOutput
=
yo
`<div class=
"
${
css
.
container
}
border border-primary border-right-0 border-left-0 border-bottom-0"
hidden='true' id="tests"></div>`
var
testsSummary
=
yo
`<div class=
${
css
.
container
}
hidden='true' id="tests"></div>`
var
testsSummary
=
yo
`<div class=
"
${
css
.
container
}
border border-primary border-right-0 border-left-0 border-bottom-0"
hidden='true' id="tests"></div>`
var
testCallback
=
function
(
result
)
{
var
testCallback
=
function
(
result
)
{
testsOutput
.
hidden
=
false
testsOutput
.
hidden
=
false
if
(
result
.
type
===
'contract'
)
{
if
(
result
.
type
===
'contract'
)
{
testsOutput
.
appendChild
(
yo
`<div class=
${
css
.
outputTitle
}
>
${
result
.
filename
}
(
${
result
.
value
}
)</div>`
)
testsOutput
.
appendChild
(
yo
`<div class=
"
${
css
.
outputTitle
}
"
>
${
result
.
filename
}
(
${
result
.
value
}
)</div>`
)
}
else
if
(
result
.
type
===
'testPass'
)
{
}
else
if
(
result
.
type
===
'testPass'
)
{
testsOutput
.
appendChild
(
yo
`<div class=
'
${
css
.
testPass
}
${
css
.
testLog
}
'
>✓ (
${
result
.
value
}
)</div>`
)
testsOutput
.
appendChild
(
yo
`<div class=
"
${
css
.
testPass
}
${
css
.
testLog
}
bg-success"
>✓ (
${
result
.
value
}
)</div>`
)
}
else
if
(
result
.
type
===
'testFailure'
)
{
}
else
if
(
result
.
type
===
'testFailure'
)
{
testsOutput
.
appendChild
(
yo
`<div class=
'
${
css
.
testFailure
}
${
css
.
testLog
}
'
>✘ (
${
result
.
value
}
)</div>`
)
testsOutput
.
appendChild
(
yo
`<div class=
"
${
css
.
testFailure
}
${
css
.
testLog
}
bg-danger"
>✘ (
${
result
.
value
}
)</div>`
)
}
}
}
}
...
@@ -60,21 +60,21 @@ module.exports = class TestTab {
...
@@ -60,21 +60,21 @@ module.exports = class TestTab {
var
updateFinalResult
=
function
(
_err
,
result
,
filename
)
{
var
updateFinalResult
=
function
(
_err
,
result
,
filename
)
{
testsSummary
.
hidden
=
false
testsSummary
.
hidden
=
false
if
(
_err
)
{
if
(
_err
)
{
testsSummary
.
appendChild
(
yo
`<div class=
${
css
.
testFailureSummary
}
>
${
_err
.
message
}
</div>`
)
testsSummary
.
appendChild
(
yo
`<div class=
"
${
css
.
testFailureSummary
}
text-danger"
>
${
_err
.
message
}
</div>`
)
return
return
}
}
testsSummary
.
appendChild
(
yo
`<div class=
${
css
.
summaryTitle
}
>
${
filename
}
</div>`
)
testsSummary
.
appendChild
(
yo
`<div class=
${
css
.
summaryTitle
}
>
${
filename
}
</div>`
)
if
(
result
.
totalPassing
>
0
)
{
if
(
result
.
totalPassing
>
0
)
{
testsSummary
.
appendChild
(
yo
`<div>
${
result
.
totalPassing
}
passing (
${
result
.
totalTime
}
s)</div>`
)
testsSummary
.
appendChild
(
yo
`<div
class="text-success"
>
${
result
.
totalPassing
}
passing (
${
result
.
totalTime
}
s)</div>`
)
testsSummary
.
appendChild
(
yo
`<br>`
)
testsSummary
.
appendChild
(
yo
`<br>`
)
}
}
if
(
result
.
totalFailing
>
0
)
{
if
(
result
.
totalFailing
>
0
)
{
testsSummary
.
appendChild
(
yo
`<div>
${
result
.
totalFailing
}
failing</div>`
)
testsSummary
.
appendChild
(
yo
`<div
class="text-danger"
>
${
result
.
totalFailing
}
failing</div>`
)
testsSummary
.
appendChild
(
yo
`<br>`
)
testsSummary
.
appendChild
(
yo
`<br>`
)
}
}
result
.
errors
.
forEach
((
error
,
index
)
=>
{
result
.
errors
.
forEach
((
error
,
index
)
=>
{
testsSummary
.
appendChild
(
yo
`<div>
${
error
.
context
}
-
${
error
.
value
}
</div>`
)
testsSummary
.
appendChild
(
yo
`<div
class="text-danger"
>
${
error
.
context
}
-
${
error
.
value
}
</div>`
)
testsSummary
.
appendChild
(
yo
`<div class=
${
css
.
testFailureSummary
}
>
${
error
.
message
}
</div>`
)
testsSummary
.
appendChild
(
yo
`<div class=
"
${
css
.
testFailureSummary
}
text-danger"
>
${
error
.
message
}
</div>`
)
testsSummary
.
appendChild
(
yo
`<br>`
)
testsSummary
.
appendChild
(
yo
`<br>`
)
})
})
}
}
...
@@ -87,7 +87,7 @@ module.exports = class TestTab {
...
@@ -87,7 +87,7 @@ module.exports = class TestTab {
remixTests
.
runTestSources
(
runningTest
,
testCallback
,
resultsCallback
,
(
error
,
result
)
=>
{
remixTests
.
runTestSources
(
runningTest
,
testCallback
,
resultsCallback
,
(
error
,
result
)
=>
{
updateFinalResult
(
error
,
result
,
testFilePath
)
updateFinalResult
(
error
,
result
,
testFilePath
)
callback
(
error
)
callback
(
error
)
},
(
url
,
cb
)
=>
{
self
.
compileTab
.
importFileCb
(
url
,
cb
)
})
},
(
url
,
cb
)
=>
{
self
.
compileTab
.
compileTabLogic
.
importFileCb
(
url
,
cb
)
})
}
}
})
})
}
}
...
@@ -171,8 +171,7 @@ module.exports = class TestTab {
...
@@ -171,8 +171,7 @@ module.exports = class TestTab {
}
}
var
runTests
=
function
()
{
var
runTests
=
function
()
{
testsOutput
.
innerHTML
=
''
testsOutput
.
innerHTML
=
'Running tests ...'
testsSummary
.
innerHTML
=
''
var
tests
=
self
.
data
.
selectedTests
var
tests
=
self
.
data
.
selectedTests
async
.
eachOfSeries
(
tests
,
(
value
,
key
,
callback
)
=>
{
runTest
(
value
,
callback
)
})
async
.
eachOfSeries
(
tests
,
(
value
,
key
,
callback
)
=>
{
runTest
(
value
,
callback
)
})
}
}
...
@@ -194,9 +193,9 @@ module.exports = class TestTab {
...
@@ -194,9 +193,9 @@ module.exports = class TestTab {
}
}
var
el
=
yo
`
var
el
=
yo
`
<div class="
${
css
.
testTabView
}
" id="testView">
<div class="
${
css
.
testTabView
}
card
" id="testView">
<div class="
${
css
.
infoBox
}
">
<div class="
${
css
.
infoBox
}
">
<
div class="
${
css
.
title
}
">Unit Testing</div
>
<
h2 class="
${
css
.
title
}
">Unit Testing</h2
>
Test your smart contract by creating a foo_test.sol file (open ballot_test.sol to see the example).
Test your smart contract by creating a foo_test.sol file (open ballot_test.sol to see the example).
<br/>
<br/>
You will find more informations in the <a href="https://remix.readthedocs.io/en/latest/unittesting_tab.html">documentation</a>
You will find more informations in the <a href="https://remix.readthedocs.io/en/latest/unittesting_tab.html">documentation</a>
...
@@ -205,12 +204,13 @@ module.exports = class TestTab {
...
@@ -205,12 +204,13 @@ module.exports = class TestTab {
<br/>
<br/>
For more details, see
For more details, see
How to test smart contracts guide in our documentation.
How to test smart contracts guide in our documentation.
<div class="
${
css
.
generateTestFile
}
" onclick="
${
generateTestFile
}
">Generate test file</div>
<br/>
<button class="
${
css
.
generateTestFile
}
btn btn-primary m-1" onclick="
${
generateTestFile
}
">Generate test file</button>
</div>
</div>
<div class="
${
css
.
tests
}
">
<div class="
${
css
.
tests
}
">
${
self
.
testList
}
${
self
.
testList
}
<div class="
${
css
.
buttons
}
">
<div class="
${
css
.
buttons
}
btn-group
">
<
div class="
${
css
.
runButton
}
" onclick="
${
runTests
}
">Run Tests</div
>
<
button class="
${
css
.
runButton
}
btn btn-primary m-1" onclick="
${
runTests
}
">Run Tests</button
>
<label class="
${
css
.
label
}
" for="checkAllTests">
<label class="
${
css
.
label
}
" for="checkAllTests">
<input id="checkAllTests"
<input id="checkAllTests"
type="checkbox"
type="checkbox"
...
...
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