Commit a6481b0b authored by lianahus's avatar lianahus Committed by Aniket

listen to event setWorkspace

parent 6ac6b7ee
......@@ -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
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment