Merge branch 'master' into fix_theme_lowercase

pull/1941/head
Liana Husikyan 3 years ago committed by GitHub
commit ba26d55c46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      libs/remix-ui/solidity-unit-testing/src/lib/logic/testTabLogic.ts
  2. 4
      libs/remix-ui/solidity-unit-testing/src/lib/solidity-unit-testing.tsx

@ -21,23 +21,20 @@ export class TestTabLogic {
this.currentPath = this.helper.removeMultipleSlashes(this.helper.removeTrailingSlashes(path)) this.currentPath = this.helper.removeMultipleSlashes(this.helper.removeTrailingSlashes(path))
} }
generateTestFolder (path:string) { async generateTestFolder (path:string) {
// Todo move this check to File Manager after refactoring // Todo move this check to File Manager after refactoring
// 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
path = this.helper.removeMultipleSlashes(path) path = this.helper.removeMultipleSlashes(path)
const fileProvider = this.fileManager.fileProviderOf(path.split('/')[0]) const fileProvider = this.fileManager.fileProviderOf(path.split('/')[0])
fileProvider.exists(path).then((res: boolean) => { if(!await fileProvider.exists(path)) fileProvider.createDir(path)
if (!res) fileProvider.createDir(path)
})
} }
async pathExists (path: string) { async pathExists (path: string) {
// 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])
const res = await fileProvider.exists(path, (e: Error, res: boolean) => { return res }) return await fileProvider.exists(path)
return res
} }
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any

@ -222,7 +222,8 @@ export const SolidityUnitTesting = (props: Record<string, any>) => { // eslint-d
if (path !== '/') path = helper.removeTrailingSlashes(path) if (path !== '/') path = helper.removeTrailingSlashes(path)
if (inputPath === '') inputPath = defaultPath if (inputPath === '') inputPath = defaultPath
setInputPathValue(path) setInputPathValue(path)
testTabLogic.generateTestFolder(inputPath) await testTabLogic.generateTestFolder(inputPath)
setToasterMsg('Folder created successfully')
setDisableCreateButton(true) setDisableCreateButton(true)
setDisableGenerateButton(false) setDisableGenerateButton(false)
testTabLogic.setCurrentPath(inputPath) testTabLogic.setCurrentPath(inputPath)
@ -672,6 +673,7 @@ export const SolidityUnitTesting = (props: Record<string, any>) => { // eslint-d
value={inputPathValue} value={inputPathValue}
title="Press 'Enter' to change the path for test files." title="Press 'Enter' to change the path for test files."
style={{ backgroundImage: "var(--primary)" }} style={{ backgroundImage: "var(--primary)" }}
onKeyDown={() => { if (inputPathValue === '/') setInputPathValue('')} }
onKeyUp={handleTestDirInput} onKeyUp={handleTestDirInput}
onChange={handleEnter} onChange={handleEnter}
onClick = {() => { if (inputPathValue === '/') setInputPathValue('')} } onClick = {() => { if (inputPathValue === '/') setInputPathValue('')} }

Loading…
Cancel
Save