Commit 9b453f7d authored by ioedeveloper's avatar ioedeveloper

Fixed failing usingWebworker test

parent a7118fa0
...@@ -32,11 +32,8 @@ module.exports = { ...@@ -32,11 +32,8 @@ module.exports = {
.clickLaunchIcon('filePanel') .clickLaunchIcon('filePanel')
.addFile('basic.sol', sources[0]['basic.sol']) .addFile('basic.sol', sources[0]['basic.sol'])
.clickLaunchIcon('solidity') .clickLaunchIcon('solidity')
.execute(function () { .waitForElementVisible('[data-id="compilerNightliesBuild"]')
const elem = document.getElementById('nightlies') as HTMLInputElement .click('[data-id="compilerNightliesBuild"]')
elem.checked = true
})
.noWorkerErrorFor('soljson-v0.3.4+commit.7dab8902.js') .noWorkerErrorFor('soljson-v0.3.4+commit.7dab8902.js')
.noWorkerErrorFor('soljson-v0.6.5+commit.f956cc89.js') .noWorkerErrorFor('soljson-v0.6.5+commit.f956cc89.js')
.noWorkerErrorFor('soljson-v0.6.8-nightly.2020.5.14+commit.a6d0067b.js') .noWorkerErrorFor('soljson-v0.6.8-nightly.2020.5.14+commit.a6d0067b.js')
......
...@@ -69,6 +69,7 @@ class CompileTab extends ViewPlugin { ...@@ -69,6 +69,7 @@ class CompileTab extends ViewPlugin {
this.contractMap = {} this.contractMap = {}
this.isHardHatProject = false this.isHardHatProject = false
this.compileErrors = {} this.compileErrors = {}
this.compiledFileName = ''
this.el = document.createElement('div') this.el = document.createElement('div')
this.el.setAttribute('id', 'compileTabView') this.el.setAttribute('id', 'compileTabView')
......
...@@ -184,7 +184,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => { ...@@ -184,7 +184,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
const pragma = pragmaStr.substring(0, pragmaStr.length - 1) const pragma = pragmaStr.substring(0, pragmaStr.length - 1)
const releasedVersions = state.allversions.filter(obj => !obj.prerelease).map(obj => obj.version) const releasedVersions = state.allversions.filter(obj => !obj.prerelease).map(obj => obj.version)
const allVersions = state.allversions.map(obj => _retrieveVersion(obj.version)) const allVersions = state.allversions.map(obj => _retrieveVersion(obj.version))
const currentCompilerName = _retrieveVersion(/** this._view.versionSelector.selectedOptions[0].label **/) const currentCompilerName = _retrieveVersion(state.selectedVersion)
// contains only numbers part, for example '0.4.22' // contains only numbers part, for example '0.4.22'
const pureVersion = _retrieveVersion() const pureVersion = _retrieveVersion()
// is nightly build newer than the last release // is nightly build newer than the last release
...@@ -269,7 +269,9 @@ export const CompilerContainer = (props: CompilerContainerProps) => { ...@@ -269,7 +269,9 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
const scheduleCompilation = () => { const scheduleCompilation = () => {
if (!state.autoCompile) return if (!state.autoCompile) return
if (state.compileTimeout) window.clearTimeout(state.compileTimeout) if (state.compileTimeout) window.clearTimeout(state.compileTimeout)
const compileTimeout = window.setTimeout(() => state.autoCompile && compile(), state.timeout) const compileTimeout = window.setTimeout(() => {
state.autoCompile && compile()
}, state.timeout)
setState(prevState => { setState(prevState => {
return { ...prevState, compileTimeout } return { ...prevState, compileTimeout }
...@@ -286,7 +288,8 @@ export const CompilerContainer = (props: CompilerContainerProps) => { ...@@ -286,7 +288,8 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
} }
const _retrieveVersion = (version?) => { const _retrieveVersion = (version?) => {
// if (!version) version = this._view.versionSelector.value if (!version) version = state.selectedVersion
if (version === 'builtin') version = state.defaultVersion
return semver.coerce(version) ? semver.coerce(version).version : '' return semver.coerce(version) ? semver.coerce(version).version : ''
} }
...@@ -374,6 +377,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => { ...@@ -374,6 +377,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
setState(prevState => { setState(prevState => {
return { ...prevState, selectedVersion: value } return { ...prevState, selectedVersion: value }
}) })
updateCurrentVersion(value)
_updateVersionSelector() _updateVersionSelector()
_updateLanguageSelector() _updateLanguageSelector()
} }
...@@ -493,7 +497,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => { ...@@ -493,7 +497,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
</div> </div>
<div className="mb-2 remixui_nightlyBuilds custom-control custom-checkbox"> <div className="mb-2 remixui_nightlyBuilds custom-control custom-checkbox">
<input className="mr-2 custom-control-input" id="nightlies" type="checkbox" onChange={handleNightliesChange} checked={state.includeNightlies} /> <input className="mr-2 custom-control-input" id="nightlies" type="checkbox" onChange={handleNightliesChange} checked={state.includeNightlies} />
<label htmlFor="nightlies" className="form-check-label custom-control-label">Include nightly builds</label> <label htmlFor="nightlies" data-id="compilerNightliesBuild" className="form-check-label custom-control-label">Include nightly builds</label>
</div> </div>
<div className="mb-2"> <div className="mb-2">
<label className="remixui_compilerLabel form-check-label" htmlFor="compilierLanguageSelector">Language</label> <label className="remixui_compilerLabel form-check-label" htmlFor="compilierLanguageSelector">Language</label>
......
...@@ -9,7 +9,7 @@ import { Renderer } from '@remix-ui/renderer' ...@@ -9,7 +9,7 @@ import { Renderer } from '@remix-ui/renderer'
import './css/style.css' import './css/style.css'
export const SolidityCompiler = (props: SolidityCompilerProps) => { export const SolidityCompiler = (props: SolidityCompilerProps) => {
const { plugin, plugin : { editor, config, queryParams, compileTabLogic, compiledFileName, fileProvider, fileManager, contractsDetails, contractMap, compileErrors, isHardHatProject, setHardHatCompilation } } = props const { plugin, plugin : { editor, config, queryParams, compileTabLogic, currentFile, fileProvider, fileManager, contractsDetails, contractMap, compileErrors, isHardHatProject, setHardHatCompilation } } = props
const [state, setState] = useState({ const [state, setState] = useState({
contractsDetails: {}, contractsDetails: {},
eventHandlers: {}, eventHandlers: {},
...@@ -81,7 +81,7 @@ export const SolidityCompiler = (props: SolidityCompilerProps) => { ...@@ -81,7 +81,7 @@ export const SolidityCompiler = (props: SolidityCompilerProps) => {
return ( return (
<> <>
<div id="compileTabView"> <div id="compileTabView">
<CompilerContainer editor={editor} config={config} queryParams={queryParams} compileTabLogic={compileTabLogic} tooltip={toast} modal={modal} compiledFileName={compiledFileName} setHardHatCompilation={setHardHatCompilation.bind(plugin)} updateCurrentVersion={updateCurrentVersion} isHardHatProject={isHardHatProject} /> <CompilerContainer editor={editor} config={config} queryParams={queryParams} compileTabLogic={compileTabLogic} tooltip={toast} modal={modal} compiledFileName={currentFile} setHardHatCompilation={setHardHatCompilation.bind(plugin)} updateCurrentVersion={updateCurrentVersion} isHardHatProject={isHardHatProject} />
<ContractSelection contractMap={contractMap} fileProvider={fileProvider} fileManager={fileManager} contractsDetails={contractsDetails} modal={modal} /> <ContractSelection contractMap={contractMap} fileProvider={fileProvider} fileManager={fileManager} contractsDetails={contractsDetails} modal={modal} />
<div className="remixui_errorBlobs p-4" data-id="compiledErrors"> <div className="remixui_errorBlobs p-4" data-id="compiledErrors">
<span data-id={`compilationFinishedWith_${currentVersion}`}></span> <span data-id={`compilationFinishedWith_${currentVersion}`}></span>
......
...@@ -8,7 +8,7 @@ export interface SolidityCompilerProps { ...@@ -8,7 +8,7 @@ export interface SolidityCompilerProps {
isHardHatProject: boolean, isHardHatProject: boolean,
queryParams: any, queryParams: any,
compileTabLogic: any, compileTabLogic: any,
compiledFileName: string, currentFile: string,
contractsDetails: Record<string, any>, contractsDetails: Record<string, any>,
editor: any, editor: any,
config: any, config: any,
......
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