From ad9292272522dd211bd3395ade4c2300bf0b8450 Mon Sep 17 00:00:00 2001 From: Aniket-Engg Date: Mon, 22 Nov 2021 13:31:23 +0530 Subject: [PATCH] update test files on generate file --- .../src/lib/logic/testTabLogic.ts | 12 ++++++------ .../src/lib/solidity-unit-testing.tsx | 5 ++++- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/libs/remix-ui/solidity-unit-testing/src/lib/logic/testTabLogic.ts b/libs/remix-ui/solidity-unit-testing/src/lib/logic/testTabLogic.ts index b22db30ca6..df19fb665d 100644 --- a/libs/remix-ui/solidity-unit-testing/src/lib/logic/testTabLogic.ts +++ b/libs/remix-ui/solidity-unit-testing/src/lib/logic/testTabLogic.ts @@ -47,12 +47,12 @@ export class TestTabLogic { const splittedFileName = fileName.split('/') const fileNameToImport = (!hasCurrent) ? fileName : this.currentPath + '/' + splittedFileName[splittedFileName.length - 1] this.helper.createNonClashingNameWithPrefix(fileNameToImport, fileProvider, '_test', (error: any, newFile: any) => { - // if (error) return modalDialogCustom.alert('Failed to create file. ' + newFile + ' ' + error) - const isFileCreated = fileProvider.set(newFile, this.generateTestContractSample(hasCurrent, fileName)) - console.log('isFileCreated---->', isFileCreated) - // if (!isFileCreated) return modalDialogCustom.alert('Failed to create test file ' + newFile) - this.fileManager.open(newFile) - this.fileManager.syncEditor(newFile) + // if (error) return modalDialogCustom.alert('Failed to create file. ' + newFile + ' ' + error) + const isFileCreated = fileProvider.set(newFile, this.generateTestContractSample(hasCurrent, fileName)) + console.log('isFileCreated---->', isFileCreated) + // if (!isFileCreated) return modalDialogCustom.alert('Failed to create test file ' + newFile) + this.fileManager.open(newFile) + this.fileManager.syncEditor(newFile) }) } diff --git a/libs/remix-ui/solidity-unit-testing/src/lib/solidity-unit-testing.tsx b/libs/remix-ui/solidity-unit-testing/src/lib/solidity-unit-testing.tsx index f6d30589d7..8515bf0ae6 100644 --- a/libs/remix-ui/solidity-unit-testing/src/lib/solidity-unit-testing.tsx +++ b/libs/remix-ui/solidity-unit-testing/src/lib/solidity-unit-testing.tsx @@ -324,7 +324,10 @@ export const SolidityUnitTesting = (props: any) => { data-id="testTabGenerateTestFile" title="Generate sample test file." disabled={disableGenerateButton} - onClick={testTabLogic.generateTestFile.bind(testTabLogic)} + onClick={() => { + testTabLogic.generateTestFile() + updateForNewCurrent() + }} > Generate