From 0358b46cc4eda5c6f629ba08599cc2d94111331a Mon Sep 17 00:00:00 2001 From: yann300 Date: Fri, 6 Jul 2018 11:10:22 +0200 Subject: [PATCH] fix lost refs while rebasing --- src/app.js | 1 + src/app/files/fileManager.js | 1 + src/app/tabs/test-tab.js | 36 ++++++++++++++++-------------------- 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/src/app.js b/src/app.js index 5737abea32..151af22976 100644 --- a/src/app.js +++ b/src/app.js @@ -474,6 +474,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org self._components.filePanel = new FilePanel() self._view.leftpanel.appendChild(self._components.filePanel.render()) self._components.filePanel.event.register('resize', delta => self._adjustLayout('left', delta)) + registry.put({api: self._components.filePanel, name: 'filepanel'}) // ----------------- Renderer ----------------- var renderer = new Renderer() diff --git a/src/app/files/fileManager.js b/src/app/files/fileManager.js index 1bf307e815..fbaf2dc0d7 100644 --- a/src/app/files/fileManager.js +++ b/src/app/files/fileManager.js @@ -154,6 +154,7 @@ class FileManager { } fileProviderOf (file) { + if (!file) return null var provider = file.match(/[^/]*/) if (provider !== null && this._deps.filesProviders[provider[0]]) { return this._deps.filesProviders[provider[0]] diff --git a/src/app/tabs/test-tab.js b/src/app/tabs/test-tab.js index aac2acfb5e..13bf9ea502 100644 --- a/src/app/tabs/test-tab.js +++ b/src/app/tabs/test-tab.js @@ -13,23 +13,16 @@ module.exports = class TestTab { // dependencies self._deps = { fileManager: self._components.registry.get('filemanager').api, - app: self._components.registry.get('app').api + app: self._components.registry.get('app').api, + filePanel: self._components.registry.get('filepanel').api } self.data = {} - self._view.el = self.render() - self._deps.app.event.register('tabChanged', tabName => { - if (tabName !== 'test') return - yo.update(self._view.el, self.render()) - self._view.el.style.display = 'block' - }) - - return { render () { return self._view.el } } } render () { const self = this var testsOutput = yo`` var testsSummary = yo`` - self.data.allTests = getTests() + self.data.allTests = getTests(self) self.data.selectedTests = [...self.data.allTests] var testCallback = function (result) { @@ -61,28 +54,27 @@ module.exports = class TestTab { testsSummary.appendChild(yo`
${result.totalFailing} failing
`) } result.errors.forEach((error, index) => { - testsSummary.appendChild(yo`
${index + 1} ${error.context}} ${error.value}
`) - testsSummary.appendChild(yo`
`) + testsSummary.appendChild(yo`
${error.context}: ${error.value}
`) testsSummary.appendChild(yo`
error: ${error.message}
`) }) } - function runTest (testFilePath, provider, callback) { - provider.get(testFilePath, (error, content) => { + function runTest (testFilePath, callback) { + self._deps.fileManager.fileProviderOf(testFilePath).get(testFilePath, (error, content) => { if (!error) { var runningTest = {} runningTest[testFilePath] = { content } remixTests.runTestSources(runningTest, testCallback, resultsCallback, (error, result) => { updateFinalResult(error, result, testFilePath) callback(error) - }, (url, cb) => { this._deps.app.importFileCb(url, cb) }) + }, (url, cb) => { self._deps.app.importFileCb(url, cb) }) } }) } - function getTests () { - var path = this._deps.fileManager.currentPath() - var provider = this._deps.fileManager.fileProviderOf(path) + function getTests (self) { + var path = self._deps.fileManager.currentPath() + var provider = self._deps.fileManager.fileProviderOf(path) var tests = [] self._deps.fileManager.filesFromPath(path, (error, files) => { if (!error) { @@ -94,7 +86,7 @@ module.exports = class TestTab { return tests } - self._events.filePanel.register('newTestFileCreated', file => { + self._deps.filePanel.event.register('newTestFileCreated', file => { var testList = document.querySelector("[class^='testList']") var test = yo`` testList.appendChild(test) @@ -102,6 +94,9 @@ module.exports = class TestTab { self.data.selectedTests.push(file) }) + self._deps.fileManager.event.register('currentFileChanged', (file, provider) => { + }) + // self._events.filePanel.register('fileRenamed', (oldName, newName, isFolder) => { // debugger // self.data.allTests = self.data.allTests.filter(e => e != oldName) @@ -128,7 +123,7 @@ module.exports = class TestTab { } var el = yo` -
+
Test your smart contract by creating a foo_test.sol file. Open ballot_test.sol to see the example. For more details, see @@ -144,6 +139,7 @@ module.exports = class TestTab {
` + if (!self._view.el) self._view.el = el return el } }