code improvement

pull/1864/head^2
aniket-engg 3 years ago committed by Aniket
parent 2a3a32fc3a
commit 26bec429fb
  1. 16
      libs/remix-ui/solidity-unit-testing/src/lib/solidity-unit-testing.tsx

@ -116,12 +116,10 @@ export const SolidityUnitTesting = (props: Record<string, any>) => {
useEffect(() => { useEffect(() => {
testTab.on('filePanel', 'newTestFileCreated', async (file: string) => { testTab.on('filePanel', 'newTestFileCreated', async (file: string) => {
try { try {
testTabLogic.getTests((error: any, tests: any) => { const tests = await testTabLogic.getTests()
if (error) return setToasterMsg(error) allTests.current = tests
allTests.current = tests selectedTests.current = [...allTests.current]
selectedTests.current = [...allTests.current] updateTestFileList()
updateTestFileList()
})
} catch (e) { } catch (e) {
console.log(e) console.log(e)
allTests.current.push(file) allTests.current.push(file)
@ -134,7 +132,7 @@ export const SolidityUnitTesting = (props: Record<string, any>) => {
}) })
testTab.fileManager.events.on('noFileSelected', () => { }) // eslint-disable-line testTab.fileManager.events.on('noFileSelected', () => { }) // eslint-disable-line
testTab.fileManager.events.on('currentFileChanged', async(file: any, provider: any) => await updateForNewCurrent(file)) testTab.fileManager.events.on('currentFileChanged', async (file: any, provider: any) => await updateForNewCurrent(file))
}, []) // eslint-disable-line }, []) // eslint-disable-line
@ -169,14 +167,14 @@ export const SolidityUnitTesting = (props: Record<string, any>) => {
if (await testTabLogic.pathExists(testDirInput)) { if (await testTabLogic.pathExists(testDirInput)) {
setDisableCreateButton(true) setDisableCreateButton(true)
setDisableGenerateButton(false) setDisableGenerateButton(false)
await setCurrentPath(testDirInput)
} else { } else {
// Enable Create button // Enable Create button
setDisableCreateButton(false) setDisableCreateButton(false)
// Disable Generate button because dir does not exist // Disable Generate button because dir does not exist
setDisableGenerateButton(true) setDisableGenerateButton(true)
await setCurrentPath(testDirInput)
} }
await setCurrentPath(testDirInput)
} }
} else { } else {
await setCurrentPath('/') await setCurrentPath('/')

Loading…
Cancel
Save