listen to event setWorkspace

pull/1176/head
lianahus 4 years ago committed by Aniket
parent 6ac6b7ee2c
commit a6481b0b0f
  1. 14
      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`
<button
class="btn border w-50"
@ -588,7 +596,7 @@ module.exports = class TestTab extends ViewPlugin {
if (testDirInput) {
if (testDirInput.endsWith('/')) {
// check if the options list already contains the options
if (this.testTabLogic.currentPath === testDirInput) {
if (this.testTabLogic.currentPath === testDirInput.substr(0, testDirInput.length - 1)) {
this.createTestFolder.disabled = true
this.updateGenerateFileAction().disabled = true
}

Loading…
Cancel
Save