Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
76bd92c9
Commit
76bd92c9
authored
Jun 23, 2020
by
ioedeveloper
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed rename api in file manager
parent
049643a2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
6 deletions
+28
-6
fileManager.js
src/app/files/fileManager.js
+16
-2
fileManager_api.test.js
test-browser/tests/fileManager_api.test.js
+12
-4
No files found.
src/app/files/fileManager.js
View file @
76bd92c9
...
...
@@ -194,10 +194,24 @@ class FileManager extends Plugin {
* @returns {void}
*/
async
rename
(
oldPath
,
newPath
)
{
await
this
.
_
_
handleExists
(
oldPath
,
`Cannot rename
${
oldPath
}
`
)
await
this
.
_handleExists
(
oldPath
,
`Cannot rename
${
oldPath
}
`
)
const
isFile
=
await
this
.
isFile
(
oldPath
)
const
newPathExists
=
await
this
.
exists
(
newPath
)
const
provider
=
this
.
fileProviderOf
(
oldPath
)
this
.
fileRenamedEvent
(
oldPath
,
newPath
,
!
isFile
)
if
(
isFile
)
{
if
(
newPathExists
)
{
modalDialogCustom
.
alert
(
'File already exists.'
)
return
}
return
provider
.
rename
(
oldPath
,
newPath
,
false
)
}
else
{
if
(
newPathExists
)
{
modalDialogCustom
.
alert
(
'Folder already exists.'
)
return
}
return
provider
.
rename
(
oldPath
,
newPath
,
true
)
}
}
/**
...
...
test-browser/tests/fileManager_api.test.js
View file @
76bd92c9
...
...
@@ -62,11 +62,19 @@ module.exports = {
.
addFile
(
'renameFile.js'
,
{
content
:
executeRename
})
.
executeScript
(
`remix.exeCurrent()`
)
.
pause
(
2000
)
.
pause
(
100000
)
// .journalLastChildIncludes('pragma solidity >=0.2.0 <0.7.0;')
// .end()
.
waitForElementPresent
(
'[data-id="treeViewLibrowser/old_contract.sol"]'
)
.
end
()
},
// 'Should execute `rename` api from file manager external api': function (browser) {
// browser
// .addFile('renameFile.js', { content: executeRename })
// .executeScript(`remix.exeCurrent()`)
// .pause(2000)
// .waitForElementPresent('[data-id="treeViewLibrowser/new_contract.sol"]')
// .end()
// },
tearDown
:
sauce
}
...
...
@@ -136,7 +144,7 @@ const executeRename = `
const run = async () => {
const result = await remix.call('fileManager', 'rename', 'browser/new_contract.sol', 'browser/old_contract.sol')
console.log(result)
console.log(
'result: ',
result)
}
run()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment