Merge pull request #2943 from ethereum/fix/#2942

fix path to create and open file from home tab
pull/2948/head^2
bunsenstraat 2 years ago committed by GitHub
commit 0df5d77f80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 20
      apps/remix-ide-e2e/src/tests/homeTab.test.ts
  2. 10
      apps/remix-ide/src/app/panels/file-panel.js
  3. 2
      libs/remix-ui/home-tab/src/lib/remix-ui-home-tab.tsx

@ -0,0 +1,20 @@
'use strict'
import { NightwatchBrowser } from 'nightwatch'
import init from '../helpers/init'
module.exports = {
before: function (browser: NightwatchBrowser, done: VoidFunction) {
init(browser, done)
},
'Should create new file': function (browser: NightwatchBrowser) {
browser
.waitForElementVisible('*[data-id="homeTabNewFile"]')
.click('*[data-id="homeTabNewFile"]')
.waitForElementContainsText('*[data-id$="/blank"]', '', 60000)
.sendKeys('*[data-id$="/blank"] .remixui_items', 'newTestFile')
.sendKeys('*[data-id$="/blank"] .remixui_items', browser.Keys.ENTER)
.waitForElementVisible('li[data-id="treeViewLitreeViewItemnewTestFile.sol"]')
}
}

@ -102,10 +102,7 @@ module.exports = class Filepanel extends ViewPlugin {
createNewFile () {
return new Promise((resolve, reject) => {
const provider = this.fileManager.currentFileProvider()
const dir = provider.workspace || '/'
this.emit('createNewFileInputReducerEvent', dir, (err, data) => {
this.emit('createNewFileInputReducerEvent', '/', (err, data) => {
if (err) reject(err)
else resolve(data)
})
@ -114,10 +111,7 @@ module.exports = class Filepanel extends ViewPlugin {
uploadFile (target) {
return new Promise((resolve, reject) => {
const provider = this.fileManager.currentFileProvider()
const dir = provider.workspace || '/'
return this.emit('uploadFileReducerEvent', dir, target, (err, data) => {
return this.emit('uploadFileReducerEvent', '/', target, (err, data) => {
if (err) reject(err)
else resolve(data)
})

@ -273,7 +273,7 @@ export const RemixUiHomeTab = (props: RemixUiHomeTabProps) => {
<h4>File</h4>
<p className="mb-1">
<i className="mr-2 far fa-file"></i>
<label className="ml-1 mb-1 remixui_home_text" onClick={() => createNewFile()}>New File</label>
<label className="ml-1 mb-1 remixui_home_text" data-id="homeTabNewFile" onClick={() => createNewFile()}>New File</label>
</p>
<p className="mb-1">
<i className="mr-2 far fa-file-alt"></i>

Loading…
Cancel
Save