Skip to content

Commit

Permalink
standart
Browse files Browse the repository at this point in the history
  • Loading branch information
LianaHus committed Jun 18, 2020
1 parent 02f62ef commit 318cd11
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
10 changes: 3 additions & 7 deletions src/app/tabs/test-tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@ module.exports = class TestTab extends ViewPlugin {
})

this.fileManager.events.on('noFileSelected', () => {
//this.updateGenerateFileAction()
//this.updateRunAction()
//this.updateTestFileList()
// todo no need for this
})

this.fileManager.events.on('currentFileChanged', (file, provider) => this.updateForNewCurrent(file))
Expand Down Expand Up @@ -354,7 +350,7 @@ module.exports = class TestTab extends ViewPlugin {
})
}

updateCurrentPath(e) {
updateCurrentPath (e) {
this.testTabLogic.setCurrentPath(e.target.value)
this.updateRunAction()
this.updateForNewCurrent()
Expand Down Expand Up @@ -507,11 +503,11 @@ module.exports = class TestTab extends ViewPlugin {
id="utPath"
name="utPath"
style="background-image: var(--primary);"
onchange=${(e)=>this.updateCurrentPath(e)}/>
onchange=${(e) => this.updateCurrentPath(e)}/>
${this.uiPathList}
</div>
`
let options = this.allPaths()
let options = ['browser', 'browser/test'] // this.allPaths()
options.forEach((path) => {
this.uiPathList.appendChild(yo`<option>${path}</option>`)
})
Expand Down
10 changes: 5 additions & 5 deletions src/app/tabs/testTab/testTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ class TestTabLogic {
this.currentPath = 'browser/tests'
}

setCurrentPath(path) {
if (path.indexOf('/') == 0) return
setCurrentPath (path) {
if (path.indexOf('/') === 0) return
this.currentPath = path
const fileProvider = this.fileManager.fileProviderOf(path.split('/')[0])
fileProvider.exists(path, (err, res) => { if(!res) fileProvider.createDir(path)})
fileProvider.exists(path, (e, res) => { if (!res) fileProvider.createDir(path) })
}

generateTestFile () {
let fileName = this.fileManager.currentFile()
const hasCurrent = !!fileName && this.fileManager.currentFile().split('.').pop().toLowerCase() == 'sol'
const hasCurrent = !!fileName && this.fileManager.currentFile().split('.').pop().toLowerCase() === 'sol'
if (!hasCurrent) fileName = this.currentPath + '/newFile.sol'
const fileProvider = this.fileManager.fileProviderOf(this.currentPath)
if (!fileProvider) return
Expand Down Expand Up @@ -51,7 +51,7 @@ class TestTabLogic {
// 'contractName' should be <compiledContractName> + '_testSuite'
generateTestContractSample (hasCurrent, fileToImport, contractName = 'testSuite') {
let relative = remixPath.relative(this.currentPath, remixPath.dirname(fileToImport))
if (relative == '') relative = '.'
if (relative === '') relative = '.'
const comment = hasCurrent ? `import "${relative}/${remixPath.basename(fileToImport)}";` : '// Import here the file to test.'
return `pragma solidity >=0.4.22 <0.7.0;
import "remix_tests.sol"; // this import is automatically injected by Remix.
Expand Down

0 comments on commit 318cd11

Please sign in to comment.