|
|
|
@ -88,15 +88,14 @@ export const SolidityUnitTesting = (props: Record<string, any>) => { |
|
|
|
|
updateTestFileList() |
|
|
|
|
clearResults() |
|
|
|
|
try { |
|
|
|
|
testTabLogic.getTests(async (error: any, tests: any) => { |
|
|
|
|
if (error) return setToasterMsg(error)
|
|
|
|
|
allTests.current = tests |
|
|
|
|
selectedTests.current = [...allTests.current] |
|
|
|
|
updateTestFileList() |
|
|
|
|
if (!areTestsRunning) await updateRunAction(file) |
|
|
|
|
}) |
|
|
|
|
} catch (e) { |
|
|
|
|
const tests = await testTabLogic.getTests() |
|
|
|
|
allTests.current = tests |
|
|
|
|
selectedTests.current = [...allTests.current] |
|
|
|
|
updateTestFileList() |
|
|
|
|
if (!areTestsRunning) await updateRunAction(file) |
|
|
|
|
} catch (e: any) { |
|
|
|
|
console.log(e) |
|
|
|
|
setToasterMsg(e) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -135,11 +134,11 @@ export const SolidityUnitTesting = (props: Record<string, any>) => { |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
testTab.on('filePanel', 'setWorkspace', async () => { |
|
|
|
|
setCurrentPath(defaultPath) |
|
|
|
|
await setCurrentPath(defaultPath) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
testTab.fileManager.events.on('noFileSelected', () => { }) // eslint-disable-line
|
|
|
|
|
testTab.fileManager.events.on('currentFileChanged', (file: any, provider: any) => updateForNewCurrent(file)) |
|
|
|
|
testTab.fileManager.events.on('currentFileChanged', async(file: any, provider: any) => await updateForNewCurrent(file)) |
|
|
|
|
|
|
|
|
|
}, []) // eslint-disable-line
|
|
|
|
|
|
|
|
|
@ -157,7 +156,7 @@ export const SolidityUnitTesting = (props: Record<string, any>) => { |
|
|
|
|
if (e.key === 'Enter') { |
|
|
|
|
if (await testTabLogic.pathExists(testDirInput)) { |
|
|
|
|
testTabLogic.setCurrentPath(testDirInput) |
|
|
|
|
updateForNewCurrent() |
|
|
|
|
await updateForNewCurrent() |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -174,17 +173,19 @@ export const SolidityUnitTesting = (props: Record<string, any>) => { |
|
|
|
|
if (await testTabLogic.pathExists(testDirInput)) { |
|
|
|
|
setDisableCreateButton(true) |
|
|
|
|
setDisableGenerateButton(false) |
|
|
|
|
testTabLogic.setCurrentPath(testDirInput) |
|
|
|
|
updateForNewCurrent() |
|
|
|
|
await setCurrentPath(testDirInput) |
|
|
|
|
} else { |
|
|
|
|
// Enable Create button
|
|
|
|
|
setDisableCreateButton(false) |
|
|
|
|
// Disable Generate button because dir does not exist
|
|
|
|
|
setDisableGenerateButton(true) |
|
|
|
|
await setCurrentPath(testDirInput) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
updateDirList('/') |
|
|
|
|
await setCurrentPath('/') |
|
|
|
|
setDisableCreateButton(true) |
|
|
|
|
setDisableGenerateButton(false) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -194,8 +195,7 @@ export const SolidityUnitTesting = (props: Record<string, any>) => { |
|
|
|
|
setInputPathValue(inputPath) |
|
|
|
|
if (disableCreateButton) { |
|
|
|
|
if (await testTabLogic.pathExists(inputPath)) { |
|
|
|
|
testTabLogic.setCurrentPath(inputPath) |
|
|
|
|
updateForNewCurrent() |
|
|
|
|
await setCurrentPath(inputPath) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -211,7 +211,7 @@ export const SolidityUnitTesting = (props: Record<string, any>) => { |
|
|
|
|
setDisableGenerateButton(false) |
|
|
|
|
testTabLogic.setCurrentPath(inputPath) |
|
|
|
|
await updateRunAction() |
|
|
|
|
updateForNewCurrent() |
|
|
|
|
await updateForNewCurrent() |
|
|
|
|
pathOptions.push(inputPath) |
|
|
|
|
setPathOptions(pathOptions) |
|
|
|
|
} |
|
|
|
@ -648,7 +648,6 @@ export const SolidityUnitTesting = (props: Record<string, any>) => { |
|
|
|
|
} |
|
|
|
|
</datalist> |
|
|
|
|
<input |
|
|
|
|
placeholder={defaultPath} |
|
|
|
|
list="utPathList" |
|
|
|
|
className="inputFolder custom-select" |
|
|
|
|
id="utPath" |
|
|
|
@ -659,6 +658,7 @@ export const SolidityUnitTesting = (props: Record<string, any>) => { |
|
|
|
|
style={{ backgroundImage: "var(--primary)" }} |
|
|
|
|
onKeyUp={handleTestDirInput} |
|
|
|
|
onChange={handleEnter} |
|
|
|
|
onClick = {() => { if (inputPathValue === '/') setInputPathValue('')} } |
|
|
|
|
/> |
|
|
|
|
<button |
|
|
|
|
className="btn border ml-2" |
|
|
|
@ -679,9 +679,9 @@ export const SolidityUnitTesting = (props: Record<string, any>) => { |
|
|
|
|
data-id="testTabGenerateTestFile" |
|
|
|
|
title="Generate sample test file." |
|
|
|
|
disabled={disableGenerateButton} |
|
|
|
|
onClick={() => { |
|
|
|
|
onClick={async () => { |
|
|
|
|
testTabLogic.generateTestFile((err:any) => { if (err) setToasterMsg(err)}) |
|
|
|
|
updateForNewCurrent() |
|
|
|
|
await updateForNewCurrent() |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
Generate |
|
|
|
|