Commit 4eb2a09d authored by lianahus's avatar lianahus Committed by ioedeveloper

added autocompile

parent 4339b4e5
...@@ -71,13 +71,14 @@ module.exports = { ...@@ -71,13 +71,14 @@ module.exports = {
'Should load using URL compiler params': function (browser: NightwatchBrowser) { 'Should load using URL compiler params': function (browser: NightwatchBrowser) {
browser browser
.pause(5000) .pause(5000)
.url('http://127.0.0.1:8080/#optimize=true&runs=300&evmVersion=istanbul&version=soljson-v0.7.4+commit.3f05b770.js') .url('http://127.0.0.1:8080/#optimize=true&runs=300&autoCompile&evmVersion=istanbul&version=soljson-v0.7.4+commit.3f05b770.js')
.refresh() .refresh()
.pause(5000) .pause(5000)
.clickLaunchIcon('solidity') .clickLaunchIcon('solidity')
.assert.containsText('#versionSelector option[data-id="selected"]', '0.7.4+commit.3f05b770') .assert.containsText('#versionSelector option[data-id="selected"]', '0.7.4+commit.3f05b770')
.assert.containsText('#evmVersionSelector option[data-id="selected"]', 'istanbul') .assert.containsText('#evmVersionSelector option[data-id="selected"]', 'istanbul')
.verify.elementPresent('#optimize:checked') .verify.elementPresent('#optimize:checked')
.verify.elementPresent('#autoCompile:checked')
.verify.attributeEquals('#runs', 'value', '300') .verify.attributeEquals('#runs', 'value', '300')
}, },
......
...@@ -517,4 +517,6 @@ Please make a backup of your contracts and start using http://remix.ethereum.org ...@@ -517,4 +517,6 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
if (params.embed) framingService.embed() if (params.embed) framingService.embed()
framingService.start(params) framingService.start(params)
if (params.code) frameingService.code()
} }
export class FramingService { export class FramingService {
constructor (sidePanel, verticalIcon, mainView, resizeFeature) { constructor (sidePanel, verticalIcons, mainView, resizeFeature) {
this.sidePanel = sidePanel this.sidePanel = sidePanel
this.verticalIcon = verticalIcon this.verticalIcons = verticalIcons
this.mainPanel = mainView.getAppPanel() this.mainPanel = mainView.getAppPanel()
this.mainView = mainView this.mainView = mainView
this.resizeFeature = resizeFeature this.resizeFeature = resizeFeature
...@@ -18,16 +18,16 @@ export class FramingService { ...@@ -18,16 +18,16 @@ export class FramingService {
this.resizeFeature.showPanel() this.resizeFeature.showPanel()
}) })
this.verticalIcon.select('filePanel') this.verticalIcons.select('filePanel')
document.addEventListener('keypress', (e) => { document.addEventListener('keypress', (e) => {
if (e.shiftKey && e.ctrlKey) { if (e.shiftKey && e.ctrlKey) {
if (e.code === 'KeyF') { // Ctrl+Shift+F if (e.code === 'KeyF') { // Ctrl+Shift+F
this.verticalIcon.select('filePanel') this.verticalIcons.select('filePanel')
} else if (e.code === 'KeyA') { // Ctrl+Shift+A } else if (e.code === 'KeyA') { // Ctrl+Shift+A
this.verticalIcon.select('pluginManager') this.verticalIcons.select('pluginManager')
} else if (e.code === 'KeyS') { // Ctrl+Shift+S } else if (e.code === 'KeyS') { // Ctrl+Shift+S
this.verticalIcon.select('settings') this.verticalIcons.select('settings')
} }
e.preventDefault() e.preventDefault()
} }
...@@ -41,4 +41,8 @@ export class FramingService { ...@@ -41,4 +41,8 @@ export class FramingService {
this.mainView.minimizeTerminal() this.mainView.minimizeTerminal()
this.resizeFeature.hidePanel() this.resizeFeature.hidePanel()
} }
code () {
this.verticalIcons.select('solidity')
}
} }
...@@ -69,11 +69,12 @@ export const CompilerContainer = (props: CompilerContainerProps) => { ...@@ -69,11 +69,12 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
const optimize = params.optimize === 'false' ? false : params.optimize === 'true' ? true : null const optimize = params.optimize === 'false' ? false : params.optimize === 'true' ? true : null
const runs = params.runs const runs = params.runs
const evmVersion = params.evmVersion const evmVersion = params.evmVersion
const autoCompile = params.autoCompile === 'false' ? false : params.autoCompile === 'true' ? true : null
return { return {
...prevState, ...prevState,
hideWarnings: api.getConfiguration('hideWarnings') || false, hideWarnings: api.getConfiguration('hideWarnings') || false,
autoCompile: api.getConfiguration('autoCompile') || false, autoCompile: (autoCompile !== null) && (autoCompile !== undefined) ? autoCompile : api.getConfiguration('autoCompile') || false,
includeNightlies: api.getConfiguration('includeNightlies') || false, includeNightlies: api.getConfiguration('includeNightlies') || false,
optimise: (optimize !== null) && (optimize !== undefined) ? optimize : api.getConfiguration('optimise') || false, optimise: (optimize !== null) && (optimize !== undefined) ? optimize : api.getConfiguration('optimise') || false,
runs: (runs !== null) && (runs !== 'null') && (runs !== undefined) && (runs !== 'undefined') ? runs : 200, runs: (runs !== null) && (runs !== 'null') && (runs !== undefined) && (runs !== 'undefined') ? runs : 200,
...@@ -407,6 +408,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => { ...@@ -407,6 +408,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
const checked = e.target.checked const checked = e.target.checked
api.setConfiguration('autoCompile', checked) api.setConfiguration('autoCompile', checked)
state.autoCompile && compile()
setState(prevState => { setState(prevState => {
return { ...prevState, autoCompile: checked } return { ...prevState, autoCompile: checked }
}) })
......
...@@ -16,7 +16,7 @@ export class CompileTab extends Plugin { ...@@ -16,7 +16,7 @@ export class CompileTab extends Plugin {
public runs public runs
public evmVersion: string public evmVersion: string
public compilerImport public compilerImport
public event public eventz
constructor (public api, public contentImport) { constructor (public api, public contentImport) {
super(profile) super(profile)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment