test file creation fix

pull/1862/head
aniket-engg 3 years ago committed by Aniket
parent 3f7b7fd761
commit c1505fb383
  1. 23
      apps/remix-ide/src/app/tabs/test-tab.js
  2. 21
      libs/remix-ui/solidity-unit-testing/src/lib/solidity-unit-testing.tsx

@ -86,7 +86,7 @@ module.exports = class TestTab extends ViewPlugin {
}
await this.testRunner.init()
await this.createTestLibs()
this.updateRunAction()
// this.updateRunAction()
}
onDeactivation () {
@ -97,22 +97,6 @@ module.exports = class TestTab extends ViewPlugin {
}
listenToEvents() {
this.on('filePanel', 'newTestFileCreated', async file => {
try {
await this.testTabLogic.getTests((error, tests) => {
if (error) return tooltip(error)
this.data.allTests = tests
this.data.selectedTests = [...this.data.allTests]
this.updateTestFileList(tests)
if (!this.testsOutput) return // eslint-disable-line
})
} catch (e) {
console.log(e)
this.data.allTests.push(file)
this.data.selectedTests.push(file)
}
})
this.on('filePanel', 'setWorkspace', async () => {
this.setCurrentPath(this.defaultPath)
})
@ -129,11 +113,6 @@ module.exports = class TestTab extends ViewPlugin {
this.emit('compilationFinished', source.target, source, 'soljson', data)
}
})
this.fileManager.events.on('noFileSelected', () => {
})
this.fileManager.events.on('currentFileChanged', (file, provider) => this.updateForNewCurrent(file))
}
async testFromPath (path) {

@ -101,6 +101,27 @@ export const SolidityUnitTesting = (props: Record<string, any>) => {
useEffect(() => {
updateDirList('/')
updateForNewCurrent()
testTab.on('filePanel', 'newTestFileCreated', async (file: any) => {
try {
testTabLogic.getTests((error: any, tests: any) => {
// if (error) return tooltip(error)
allTests = tests
selectedTests = [...allTests]
setSelectedTests(tests)
updateTestFileList()
})
} catch (e) {
console.log(e)
allTests.push(file)
selectedTests.push(file)
setSelectedTests(selectedTests)
}
})
testTab.fileManager.events.on('noFileSelected', () => {})
testTab.fileManager.events.on('currentFileChanged', (file: any, provider: any) => updateForNewCurrent(file))
}, []) // eslint-disable-line
const updateDirList = (path: string) => {

Loading…
Cancel
Save