From e007f62b6ee058a1c0488a6d5b8bcda6f7da2098 Mon Sep 17 00:00:00 2001 From: LianaHus Date: Thu, 19 Nov 2020 10:57:41 +0100 Subject: [PATCH] optimisation runs recover default --- .../src/tests/compiler_api.test.ts | 25 +++++++++++++++++++ .../app/tabs/compileTab/compilerContainer.js | 2 ++ 2 files changed, 27 insertions(+) diff --git a/apps/remix-ide-e2e/src/tests/compiler_api.test.ts b/apps/remix-ide-e2e/src/tests/compiler_api.test.ts index c003081458..9c82762a49 100644 --- a/apps/remix-ide-e2e/src/tests/compiler_api.test.ts +++ b/apps/remix-ide-e2e/src/tests/compiler_api.test.ts @@ -34,6 +34,14 @@ module.exports = { .journalChildIncludes(`\\"optimizer\\":{\\"enabled\\":true,\\"runs\\":300}`) }, + 'Should compile using "compileWithParamaters" API with optimization off check default runs': function (browser: NightwatchBrowser) { + browser + .addFile('test_jsCompileWithOptimizationDefault.js', { content: jsCompileWithOptimizationDefault }) + .executeScript('remix.exeCurrent()') + .pause(10000) + .journalChildIncludes(`\\"optimizer\\":{\\"enabled\\":false,\\"runs\\":200}`) + }, + 'Should update the compiler configuration with "setCompilerConfig" API': function (browser: NightwatchBrowser) { browser .addFile('test_updateConfiguration.js', { content: updateConfiguration }) @@ -111,11 +119,28 @@ const jsCompileWithOptimization = `(async () => { } const result = await remix.call('solidity', 'compileWithParameters', contract, params) console.log('result ', result) + } catch (e) { + console.log(e.message) + } +})()` + +const jsCompileWithOptimizationDefault = `(async () => { + try { + const contract = { + "storage.sol": {content : \`${simpleContract}\` } + } + console.log('compile') + const params = { + optimize: false, + } + const result = await remix.call('solidity', 'compileWithParameters', contract, params) + console.log('result ', result) } catch (e) { console.log(e.message) } })()` + const updateConfiguration = `(async () => { try { const params = { diff --git a/apps/remix-ide/src/app/tabs/compileTab/compilerContainer.js b/apps/remix-ide/src/app/tabs/compileTab/compilerContainer.js index 24824e3f2b..830245b762 100644 --- a/apps/remix-ide/src/app/tabs/compileTab/compilerContainer.js +++ b/apps/remix-ide/src/app/tabs/compileTab/compilerContainer.js @@ -345,7 +345,9 @@ class CompilerContainer { this.compileTabLogic.setOptimize(!!this._view.optimize.checked) if (this.compileTabLogic.optimize) { this._view.runs.removeAttribute('disabled') + this.compileTabLogic.setRuns(parseInt(this._view.runs.value)) } else { + this.compileTabLogic.setRuns(200) this._view.runs.setAttribute('disabled', '') } this.compileIfAutoCompileOn()