From a6481b0b0f91f20f4c33bc484c8fe4fcefafa541 Mon Sep 17 00:00:00 2001 From: lianahus Date: Mon, 3 May 2021 09:42:16 +0200 Subject: [PATCH] listen to event setWorkspace --- apps/remix-ide/src/app/tabs/test-tab.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/apps/remix-ide/src/app/tabs/test-tab.js b/apps/remix-ide/src/app/tabs/test-tab.js index fdeb287c0b..1fa24d05a4 100644 --- a/apps/remix-ide/src/app/tabs/test-tab.js +++ b/apps/remix-ide/src/app/tabs/test-tab.js @@ -53,6 +53,8 @@ module.exports = class TestTab extends ViewPlugin { listenToEvents () { this.filePanel.event.register('newTestFileCreated', file => { + console.log('newTestFileCreated') + var testList = this._view.el.querySelector("[class^='testList']") var test = this.createSingleTest(file) testList.appendChild(test) @@ -60,6 +62,12 @@ module.exports = class TestTab extends ViewPlugin { this.data.selectedTests.push(file) }) + this.on('fileExplorers', 'setWorkspace', async () => { + this.testTabLogic.setCurrentPath(this.defaultPath) + this.inputPath.value = this.defaultPath + this.updateForNewCurrent() + }) + this.fileManager.events.on('noFileSelected', () => { }) @@ -67,7 +75,7 @@ module.exports = class TestTab extends ViewPlugin { } updateForNewCurrent (file) { - this.updateGenerateFileAction(file) + this.updateGenerateFileAction() if (!this.areTestsRunning) this.updateRunAction(file) this.updateTestFileList() this.testTabLogic.getTests((error, tests) => { @@ -462,7 +470,7 @@ module.exports = class TestTab extends ViewPlugin { runBtn.setAttribute('disabled', 'disabled') } - updateGenerateFileAction (currentFile) { + updateGenerateFileAction () { const el = yo`