diff --git a/apps/remix-ide/src/app/tabs/test-tab.js b/apps/remix-ide/src/app/tabs/test-tab.js index f76c923743..ad4fbe935d 100644 --- a/apps/remix-ide/src/app/tabs/test-tab.js +++ b/apps/remix-ide/src/app/tabs/test-tab.js @@ -86,7 +86,7 @@ module.exports = class TestTab extends ViewPlugin { } await this.testRunner.init() await this.createTestLibs() - this.updateRunAction() + // this.updateRunAction() } onDeactivation () { @@ -96,23 +96,7 @@ module.exports = class TestTab extends ViewPlugin { this.fileManager.events.removeAllListeners('currentFileChanged') } - 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) - } - }) - + listenToEvents() { 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) { diff --git a/libs/remix-ui/solidity-unit-testing/src/lib/solidity-unit-testing.tsx b/libs/remix-ui/solidity-unit-testing/src/lib/solidity-unit-testing.tsx index 34094fda1b..7d65e2a53d 100644 --- a/libs/remix-ui/solidity-unit-testing/src/lib/solidity-unit-testing.tsx +++ b/libs/remix-ui/solidity-unit-testing/src/lib/solidity-unit-testing.tsx @@ -101,6 +101,27 @@ export const SolidityUnitTesting = (props: Record) => { 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) => {