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 { ...@@ -53,6 +53,8 @@ module.exports = class TestTab extends ViewPlugin {
listenToEvents () { listenToEvents () {
this.filePanel.event.register('newTestFileCreated', file => { this.filePanel.event.register('newTestFileCreated', file => {
console.log('newTestFileCreated')
var testList = this._view.el.querySelector("[class^='testList']") var testList = this._view.el.querySelector("[class^='testList']")
var test = this.createSingleTest(file) var test = this.createSingleTest(file)
testList.appendChild(test) testList.appendChild(test)
...@@ -60,6 +62,12 @@ module.exports = class TestTab extends ViewPlugin { ...@@ -60,6 +62,12 @@ module.exports = class TestTab extends ViewPlugin {
this.data.selectedTests.push(file) 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', () => { this.fileManager.events.on('noFileSelected', () => {
}) })
...@@ -67,7 +75,7 @@ module.exports = class TestTab extends ViewPlugin { ...@@ -67,7 +75,7 @@ module.exports = class TestTab extends ViewPlugin {
} }
updateForNewCurrent (file) { updateForNewCurrent (file) {
this.updateGenerateFileAction(file) this.updateGenerateFileAction()
if (!this.areTestsRunning) this.updateRunAction(file) if (!this.areTestsRunning) this.updateRunAction(file)
this.updateTestFileList() this.updateTestFileList()
this.testTabLogic.getTests((error, tests) => { this.testTabLogic.getTests((error, tests) => {
...@@ -462,7 +470,7 @@ module.exports = class TestTab extends ViewPlugin { ...@@ -462,7 +470,7 @@ module.exports = class TestTab extends ViewPlugin {
runBtn.setAttribute('disabled', 'disabled') runBtn.setAttribute('disabled', 'disabled')
} }
updateGenerateFileAction (currentFile) { updateGenerateFileAction () {
const el = yo` const el = yo`
<button <button
class="btn border w-50" class="btn border w-50"
...@@ -588,7 +596,7 @@ module.exports = class TestTab extends ViewPlugin { ...@@ -588,7 +596,7 @@ module.exports = class TestTab extends ViewPlugin {
if (testDirInput) { if (testDirInput) {
if (testDirInput.endsWith('/')) { if (testDirInput.endsWith('/')) {
// check if the options list already contains the options // 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.createTestFolder.disabled = true
this.updateGenerateFileAction().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