fix testTabLogic

pull/1862/head
Aniket-Engg 3 years ago committed by Aniket
parent e2f205cc89
commit 297096759b
  1. 5
      apps/remix-ide/src/app/tabs/test-tab.js
  2. 1
      libs/remix-ui/solidity-unit-testing/src/index.ts
  3. 2
      libs/remix-ui/solidity-unit-testing/src/lib/logic/testTabLogic.ts
  4. 11
      libs/remix-ui/solidity-unit-testing/src/lib/solidity-unit-testing.tsx

@ -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',

@ -1 +1,2 @@
export * from './lib/solidity-unit-testing';
export * from './lib/logic/testTabLogic'

@ -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'

@ -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()

Loading…
Cancel
Save