diff --git a/apps/remix-ide/src/app/tabs/test-tab.js b/apps/remix-ide/src/app/tabs/test-tab.js index 826988a401..a87cd7c0f9 100644 --- a/apps/remix-ide/src/app/tabs/test-tab.js +++ b/apps/remix-ide/src/app/tabs/test-tab.js @@ -2,6 +2,7 @@ import React from 'react' // eslint-disable-line import ReactDOM from 'react-dom' import { SolidityUnitTesting } from '@remix-ui/solidity-unit-testing' // eslint-disable-line +import { TestTabLogic } from '@remix-ui/solidity-unit-testing' // eslint-disable-line import { ViewPlugin } from '@remixproject/engine-web' import helper from '../../lib/helper' @@ -16,7 +17,7 @@ var { UnitTestRunner, assertLibCode } = require('@remix-project/remix-tests') const _paq = window._paq = window._paq || [] -const TestTabLogic = require('./testTab/testTab') +// const TestTabLogic = require('./testTab/testTab') const profile = { name: 'solidityUnitTesting', @@ -41,6 +42,7 @@ module.exports = class TestTab extends ViewPlugin { this.appManager = appManager this.renderer = new Renderer(this) this.testRunner = new UnitTestRunner() + this.testTabLogic = new TestTabLogic(this.fileManager, helper) this.hasBeenStopped = false this.runningTestsNumber = 0 this.readyTestsNumber = 0 @@ -61,7 +63,6 @@ module.exports = class TestTab extends ViewPlugin { } onActivationInternal () { - this.testTabLogic = new TestTabLogic(this.fileManager) this.listenToEvents() this.call('filePanel', 'registerContextMenuItem', { id: 'solidityUnitTesting', diff --git a/libs/remix-ui/solidity-unit-testing/src/index.ts b/libs/remix-ui/solidity-unit-testing/src/index.ts index e007a75e38..55a090f9ef 100644 --- a/libs/remix-ui/solidity-unit-testing/src/index.ts +++ b/libs/remix-ui/solidity-unit-testing/src/index.ts @@ -1 +1,2 @@ export * from './lib/solidity-unit-testing'; +export * from './lib/logic/testTabLogic' 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 91f24b2872..b22db30ca6 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 @@ -38,7 +38,7 @@ export class TestTabLogic { } generateTestFile () { - console.log('Inside generateTestFile-1SUT-') + console.log('Inside generateTestFile-1SUT-currentFile-', this.fileManager.currentFile(), this.currentPath) let fileName = this.fileManager.currentFile() const hasCurrent = !!fileName && this.fileManager.currentFile().split('.').pop().toLowerCase() === 'sol' if (!hasCurrent) fileName = this.currentPath + '/newFile.sol' 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 d4eb6b018f..f6d30589d7 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 @@ -1,5 +1,5 @@ import React, { useState, useRef, useEffect } from 'react' // eslint-disable-line -import { TestTabLogic } from './logic/testTabLogic' +// import { TestTabLogic } from './logic/testTabLogic' var async = require('async') var ReactDOM = require('react-dom'); @@ -17,7 +17,7 @@ export const SolidityUnitTesting = (props: any) => { const {helper, testTab} = props - const testTabLogic = new TestTabLogic(testTab.fileManager, helper) + const { testTabLogic } = testTab const [defaultPath, setDefaultPath] = useState('tests') const [disableCreateButton, setDisableCreateButton] = useState(true) @@ -106,13 +106,14 @@ export const SolidityUnitTesting = (props: any) => { } const handleTestDirInput = async (e: any) => { - console.log('handleTestDirInput--e-->', e) + console.log('handleTestDirInput--e-->', e.target) - let testDirInput = trimTestDirInput(inputPathValue) + let testDirInput = trimTestDirInput(e.target.value) + console.log('handleTestDirInput--e-->', testDirInput) testDirInput = helper.removeMultipleSlashes(testDirInput) if (testDirInput !== '/') testDirInput = helper.removeTrailingSlashes(testDirInput) + setInputPathValue(testDirInput) if (e.key === 'Enter') { - setInputPathValue(testDirInput) if (await testTabLogic.pathExists(testDirInput)) { testTabLogic.setCurrentPath(testDirInput) updateForNewCurrent()