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 {
this.updateDirList(testDirInput)
} else {
// 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.updateGenerateFileAction().disabled = false
} else {
......@@ -636,10 +636,10 @@ module.exports = class TestTab extends ViewPlugin {
name="utPath"
style="background-image: var(--primary);"
onkeyup=${(e) => this.handleTestDirInput(e)}
onchange=${(e) => {
onchange=${async (e) => {
if (this.createTestFolder.disabled) {
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.testTabLogic.setCurrentPath(this.inputPath.value)
this.updateForNewCurrent()
......
......@@ -23,11 +23,12 @@ class TestTabLogic {
})
}
pathExists (path) {
async pathExists (path) {
// Checking to ignore the value which contains only whitespaces
if (!path || !(/\S/.test(path))) return
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 () {
......
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