component load

pull/1862/head
Aniket-Engg 3 years ago committed by Aniket
parent a89a527d11
commit 72e4bdcea2
  1. 13
      apps/remix-ide/src/app/tabs/test-tab.js

@ -50,6 +50,7 @@ module.exports = class TestTab extends ViewPlugin {
this.allFilesInvolved = ['.deps/remix-tests/remix_tests.sol', '.deps/remix-tests/remix_accounts.sol'] this.allFilesInvolved = ['.deps/remix-tests/remix_tests.sol', '.deps/remix-tests/remix_accounts.sol']
this.isDebugging = false this.isDebugging = false
this.currentErrors = [] this.currentErrors = []
this.element = document.createElement('div')
appManager.event.on('activate', (name) => { appManager.event.on('activate', (name) => {
if (name === 'solidity') this.updateRunAction() if (name === 'solidity') this.updateRunAction()
@ -60,6 +61,7 @@ module.exports = class TestTab extends ViewPlugin {
} }
onActivationInternal () { onActivationInternal () {
console.log('onActivationInternal---start->')
this.testTabLogic = new TestTabLogic(this.fileManager) this.testTabLogic = new TestTabLogic(this.fileManager)
this.listenToEvents() this.listenToEvents()
this.call('filePanel', 'registerContextMenuItem', { this.call('filePanel', 'registerContextMenuItem', {
@ -71,6 +73,7 @@ module.exports = class TestTab extends ViewPlugin {
path: [], path: [],
pattern: [] pattern: []
}) })
console.log('onActivationInternal---end->')
} }
async setTestFolderPath (event) { async setTestFolderPath (event) {
@ -92,6 +95,7 @@ module.exports = class TestTab extends ViewPlugin {
} }
async onActivation () { async onActivation () {
console.log('onActivation--->')
const isSolidityActive = await this.call('manager', 'isActive', 'solidity') const isSolidityActive = await this.call('manager', 'isActive', 'solidity')
if (!isSolidityActive) { if (!isSolidityActive) {
await this.call('manager', 'activatePlugin', 'solidity') await this.call('manager', 'activatePlugin', 'solidity')
@ -99,10 +103,10 @@ module.exports = class TestTab extends ViewPlugin {
await this.testRunner.init() await this.testRunner.init()
await this.createTestLibs() await this.createTestLibs()
this.updateRunAction() this.updateRunAction()
this.renderComponent()
} }
onDeactivation () { onDeactivation () {
console.log('onDeactivation--->')
this.off('filePanel', 'newTestFileCreated') this.off('filePanel', 'newTestFileCreated')
this.off('filePanel', 'setWorkspace') this.off('filePanel', 'setWorkspace')
// 'currentFileChanged' event is added more than once // 'currentFileChanged' event is added more than once
@ -110,6 +114,7 @@ module.exports = class TestTab extends ViewPlugin {
} }
listenToEvents () { listenToEvents () {
console.log('listenToEvents--start-->')
this.on('filePanel', 'newTestFileCreated', async file => { this.on('filePanel', 'newTestFileCreated', async file => {
try { try {
await this.testTabLogic.getTests((error, tests) => { await this.testTabLogic.getTests((error, tests) => {
@ -147,6 +152,7 @@ module.exports = class TestTab extends ViewPlugin {
}) })
this.fileManager.events.on('currentFileChanged', (file, provider) => this.updateForNewCurrent(file)) this.fileManager.events.on('currentFileChanged', (file, provider) => this.updateForNewCurrent(file))
console.log('listenToEvents--end-->')
} }
async updateForNewCurrent (file) { async updateForNewCurrent (file) {
@ -796,13 +802,18 @@ module.exports = class TestTab extends ViewPlugin {
} }
render () { render () {
console.log('render--->')
this.onActivationInternal()
this.renderComponent()
return this.element return this.element
} }
renderComponent () { renderComponent () {
console.log('renderComponent-start-->')
ReactDOM.render( ReactDOM.render(
<SolidityUnitTesting api={this}/> <SolidityUnitTesting api={this}/>
, this.element) , this.element)
console.log('renderComponent-end-->')
} }
render2 () { render2 () {

Loading…
Cancel
Save