move get tests to test tab logic

pull/3094/head
Iuri Matias 6 years ago committed by yann300
parent 4637102674
commit f55b60f8d1
  1. 17
      src/app/tabs/test-tab.js
  2. 15
      src/app/tabs/testTab/testTab.js

@ -41,7 +41,7 @@ module.exports = class TestTab extends ApiFactory {
})
this.fileManager.event.register('currentFileChanged', (file, provider) => {
this.getTests((error, tests) => {
this.testTabLogic.getTests((error, tests) => {
if (error) return tooltip(error)
this.data.allTests = tests
this.data.selectedTests = [...this.data.allTests]
@ -59,21 +59,6 @@ module.exports = class TestTab extends ApiFactory {
})
}
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)
for (var file in files) {
if (/.(_test.sol)$/.exec(file)) tests.push(provider.type + '/' + file)
}
cb(null, tests)
})
}
listTests () {
return this.data.allTests.map(test => yo`<label class="singleTestLabel"><input class="singleTest" onchange =${(e) => this.toggleCheckbox(e.target.checked, test)} type="checkbox" checked="true">${test} </label>`)
}

@ -18,6 +18,21 @@ class TestTabLogic {
})
}
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)
for (var file in files) {
if (/.(_test.sol)$/.exec(file)) tests.push(provider.type + '/' + file)
}
cb(null, tests)
})
}
generateTestContractSample () {
return `pragma solidity >=0.4.0 <0.6.0;
import "remix_tests.sol"; // this import is automatically injected by Remix.

Loading…
Cancel
Save