Fixed failing usingWebworker test

pull/1339/head
ioedeveloper 3 years ago
parent a7118fa0b0
commit 9b453f7d5b
  1. 7
      apps/remix-ide-e2e/src/tests/usingWebWorker.test.ts
  2. 1
      apps/remix-ide/src/app/tabs/compile-tab.js
  3. 12
      libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx
  4. 4
      libs/remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx
  5. 2
      libs/remix-ui/solidity-compiler/src/lib/types/index.ts

@ -32,11 +32,8 @@ module.exports = {
.clickLaunchIcon('filePanel')
.addFile('basic.sol', sources[0]['basic.sol'])
.clickLaunchIcon('solidity')
.execute(function () {
const elem = document.getElementById('nightlies') as HTMLInputElement
elem.checked = true
})
.waitForElementVisible('[data-id="compilerNightliesBuild"]')
.click('[data-id="compilerNightliesBuild"]')
.noWorkerErrorFor('soljson-v0.3.4+commit.7dab8902.js')
.noWorkerErrorFor('soljson-v0.6.5+commit.f956cc89.js')
.noWorkerErrorFor('soljson-v0.6.8-nightly.2020.5.14+commit.a6d0067b.js')

@ -69,6 +69,7 @@ class CompileTab extends ViewPlugin {
this.contractMap = {}
this.isHardHatProject = false
this.compileErrors = {}
this.compiledFileName = ''
this.el = document.createElement('div')
this.el.setAttribute('id', 'compileTabView')

@ -184,7 +184,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
const pragma = pragmaStr.substring(0, pragmaStr.length - 1)
const releasedVersions = state.allversions.filter(obj => !obj.prerelease).map(obj => 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'
const pureVersion = _retrieveVersion()
// is nightly build newer than the last release
@ -269,7 +269,9 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
const scheduleCompilation = () => {
if (!state.autoCompile) return
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 => {
return { ...prevState, compileTimeout }
@ -286,7 +288,8 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
}
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 : ''
}
@ -374,6 +377,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
setState(prevState => {
return { ...prevState, selectedVersion: value }
})
updateCurrentVersion(value)
_updateVersionSelector()
_updateLanguageSelector()
}
@ -493,7 +497,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
</div>
<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} />
<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 className="mb-2">
<label className="remixui_compilerLabel form-check-label" htmlFor="compilierLanguageSelector">Language</label>

@ -9,7 +9,7 @@ import { Renderer } from '@remix-ui/renderer'
import './css/style.css'
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({
contractsDetails: {},
eventHandlers: {},
@ -81,7 +81,7 @@ export const SolidityCompiler = (props: SolidityCompilerProps) => {
return (
<>
<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} />
<div className="remixui_errorBlobs p-4" data-id="compiledErrors">
<span data-id={`compilationFinishedWith_${currentVersion}`}></span>

@ -8,7 +8,7 @@ export interface SolidityCompilerProps {
isHardHatProject: boolean,
queryParams: any,
compileTabLogic: any,
compiledFileName: string,
currentFile: string,
contractsDetails: Record<string, any>,
editor: any,
config: any,

Loading…
Cancel
Save