Skip to content

Commit 414b96f

Browse files
authored
Merge pull request #1582 from ethereum/yann300-patch-32
Fixes: Error count in badge in solidity compiler & current file & autocompile in URL params
2 parents 93bddf6 + 0052bfe commit 414b96f

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

apps/remix-ide-e2e/src/tests/url.spec.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,16 @@ module.exports = {
1919

2020
'Should load the code from URL params (code param)': function (browser: NightwatchBrowser) {
2121
browser
22+
.waitForElementVisible('[for="autoCompile"]')
23+
.click('[for="autoCompile"]') // we set it too false in the local storage
2224
.pause(5000)
23-
.url('http://127.0.0.1:8080/#optimize=true&runs=300&evmVersion=istanbul&version=soljson-v0.7.4+commit.3f05b770.js&code=cHJhZ21hIHNvbGlkaXR5ID49MC42LjAgPDAuNy4wOwoKaW1wb3J0ICJodHRwczovL2dpdGh1Yi5jb20vT3BlblplcHBlbGluL29wZW56ZXBwZWxpbi1jb250cmFjdHMvYmxvYi9tYXN0ZXIvY29udHJhY3RzL2FjY2Vzcy9Pd25hYmxlLnNvbCI7Cgpjb250cmFjdCBHZXRQYWlkIGlzIE93bmFibGUgewogIGZ1bmN0aW9uIHdpdGhkcmF3KCkgZXh0ZXJuYWwgb25seU93bmVyIHsKICB9Cn0')
25+
.url('http://127.0.0.1:8080/#autoCompile=true&optimize=true&runs=300&evmVersion=istanbul&version=soljson-v0.7.4+commit.3f05b770.js&code=cHJhZ21hIHNvbGlkaXR5ID49MC42LjAgPDAuNy4wOwoKaW1wb3J0ICJodHRwczovL2dpdGh1Yi5jb20vT3BlblplcHBlbGluL29wZW56ZXBwZWxpbi1jb250cmFjdHMvYmxvYi9tYXN0ZXIvY29udHJhY3RzL2FjY2Vzcy9Pd25hYmxlLnNvbCI7Cgpjb250cmFjdCBHZXRQYWlkIGlzIE93bmFibGUgewogIGZ1bmN0aW9uIHdpdGhkcmF3KCkgZXh0ZXJuYWwgb25seU93bmVyIHsKICB9Cn0')
2426
.refresh() // we do one reload for making sure we already have the default workspace
2527
.pause(5000)
28+
.verify.elementPresent('[data-id="compilerContainerAutoCompile"]:checked')
29+
.click('[for="autoCompile"]') // we set it too false again
30+
.click('[for="autoCompile"]') // back to True in the local storage
31+
.assert.containsText('*[data-id="compilerContainerCompileBtn"]', 'contract-76747f6e19.sol')
2632
.currentWorkspaceIs('code-sample')
2733
.getEditorValue((content) => {
2834
browser.assert.ok(content.indexOf(

apps/remix-ide/src/app/tabs/compile-tab.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ class CompileTab extends CompilerApiMixin(ViewPlugin) { // implements ICompilerA
113113
return super.compileFile(event)
114114
}
115115

116-
onActivation () {
116+
async onActivation () {
117117
super.onActivation()
118118
this.call('filePanel', 'registerContextMenuItem', {
119119
id: 'solidity',
@@ -124,6 +124,7 @@ class CompileTab extends CompilerApiMixin(ViewPlugin) { // implements ICompilerA
124124
path: [],
125125
pattern: []
126126
})
127+
this.currentFile = await this.call('fileManager', 'file')
127128
}
128129

129130
getCompilerParameters () {
@@ -138,7 +139,9 @@ class CompileTab extends CompilerApiMixin(ViewPlugin) { // implements ICompilerA
138139
}
139140

140141
getAppParameter (name) {
141-
const param = this.config.get(name)
142+
// first look in the URL params then in the local storage
143+
const params = this.queryParams.get()
144+
const param = params[name] ? params[name] : this.config.get(name)
142145
if (param === 'true') return true
143146
if (param === 'false') return false
144147
return param

apps/solidity-compiler/src/app/compiler-api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ export const CompilerApiMixin = (Base) => class extends Base {
264264
)
265265
})
266266
} else {
267-
const count = (data.errors ? data.errors.filter(error => error.severity === 'error').length : 0) + data.error ? 1 : 0
267+
const count = (data.errors ? data.errors.filter(error => error.severity === 'error').length : 0 + (data.error ? 1 : 0))
268268
this.emit('statusChanged', { key: count, title: `compilation failed with ${count} error${count > 1 ? 's' : ''}`, type: 'error' })
269269
}
270270
// Update contract Selection

0 commit comments

Comments
 (0)