Commit a6704d44 authored by lianahus's avatar lianahus Committed by Liana Husikyan

using awaits for proper result

parent 2a05375c
...@@ -606,7 +606,7 @@ module.exports = class TestTab extends ViewPlugin { ...@@ -606,7 +606,7 @@ module.exports = class TestTab extends ViewPlugin {
this.updateDirList(testDirInput) this.updateDirList(testDirInput)
} else { } else {
// If there is no matching folder in the workspace with entered text, enable Create button // If there is no matching folder in the workspace with entered text, enable Create button
if (this.testTabLogic.pathExists(testDirInput)) { if (await this.testTabLogic.pathExists(testDirInput)) {
this.createTestFolder.disabled = true this.createTestFolder.disabled = true
this.updateGenerateFileAction().disabled = false this.updateGenerateFileAction().disabled = false
} else { } else {
...@@ -636,10 +636,10 @@ module.exports = class TestTab extends ViewPlugin { ...@@ -636,10 +636,10 @@ module.exports = class TestTab extends ViewPlugin {
name="utPath" name="utPath"
style="background-image: var(--primary);" style="background-image: var(--primary);"
onkeyup=${(e) => this.handleTestDirInput(e)} onkeyup=${(e) => this.handleTestDirInput(e)}
onchange=${(e) => { onchange=${async (e) => {
if (this.createTestFolder.disabled) { if (this.createTestFolder.disabled) {
this.inputPath.value = this.trimTestDirInput(this.inputPath.value) this.inputPath.value = this.trimTestDirInput(this.inputPath.value)
if (this.testTabLogic.pathExists(this.inputPath.value)) { if (await this.testTabLogic.pathExists(this.inputPath.value)) {
this.inputPath.value = this.trimTestDirInput(this.inputPath.value) this.inputPath.value = this.trimTestDirInput(this.inputPath.value)
this.testTabLogic.setCurrentPath(this.inputPath.value) this.testTabLogic.setCurrentPath(this.inputPath.value)
this.updateForNewCurrent() this.updateForNewCurrent()
......
...@@ -23,11 +23,12 @@ class TestTabLogic { ...@@ -23,11 +23,12 @@ class TestTabLogic {
}) })
} }
pathExists (path) { async pathExists (path) {
// Checking to ignore the value which contains only whitespaces // Checking to ignore the value which contains only whitespaces
if (!path || !(/\S/.test(path))) return if (!path || !(/\S/.test(path))) return
const fileProvider = this.fileManager.fileProviderOf(path.split('/')[0]) const fileProvider = this.fileManager.fileProviderOf(path.split('/')[0])
return fileProvider.exists(path, (e, res) => { return res }) const res = await fileProvider.exists(path, (e, res) => { return res })
return res
} }
generateTestFile () { generateTestFile () {
......
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