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

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

Loading…
Cancel
Save