pull/1176/head
aniket-engg 4 years ago committed by Aniket
parent 24bf64bf2c
commit a4525c8dee
  1. 18
      apps/remix-ide/src/app/tabs/test-tab.js

@ -556,13 +556,19 @@ module.exports = class TestTab extends ViewPlugin {
})
}
trimTestDirInput (input) {
if(input.includes('/')) return input.split('/').map(e => e.trim()).join('/')
else return input.trim()
}
handleTestDirInput () {
if (this.inputPath.value && this.inputPath.value.endsWith('/')) {
this.updateDirList(this.inputPath.value)
} else {
const testDirInput = this.trimTestDirInput(this.inputPath.value)
if (testDirInput) {
if (testDirInput.endsWith('/')) this.updateDirList(testDirInput)
else {
let matchFound = false
for (const option of this.uiPathList.querySelectorAll('option')) {
if (option.innerHTML === this.inputPath.value) matchFound = true
if (option.innerHTML === testDirInput) matchFound = true
}
// If there is no matching folder in the workspace with entered text, enable Create button
if (!matchFound) {
@ -575,6 +581,9 @@ module.exports = class TestTab extends ViewPlugin {
this.updateGenerateFileAction().disabled = false
}
}
} else {
this.updateDirList('/')
}
}
render () {
@ -600,6 +609,7 @@ module.exports = class TestTab extends ViewPlugin {
title="Create a test folder"
disabled=true
onclick=${(e) => {
this.inputPath.value = this.trimTestDirInput(this.inputPath.value)
this.testTabLogic.generateTestFolder(this.inputPath.value)
this.createTestFolder.disabled = true
this.updateGenerateFileAction().disabled = false

Loading…
Cancel
Save