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
3d72f842
Commit
3d72f842
authored
Jun 07, 2021
by
lianahus
Committed by
Liana Husikyan
Jun 09, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixes for corner cases
parent
102be890
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
8 deletions
+12
-8
test-tab.js
apps/remix-ide/src/app/tabs/test-tab.js
+9
-5
testTab.js
apps/remix-ide/src/app/tabs/testTab/testTab.js
+1
-1
helper.js
apps/remix-ide/src/lib/helper.js
+2
-2
No files found.
apps/remix-ide/src/app/tabs/test-tab.js
View file @
3d72f842
import
{
ViewPlugin
}
from
'@remixproject/engine-web'
import
{
ViewPlugin
}
from
'@remixproject/engine-web'
import
{
canUseWorker
,
urlFromVersion
}
from
'../compiler/compiler-utils'
import
{
canUseWorker
,
urlFromVersion
}
from
'../compiler/compiler-utils'
import
*
as
helper
from
'../../lib/helper'
import
{
removeMultipleSlashes
,
removeTrailingSlashes
}
from
'../../lib/helper'
var
yo
=
require
(
'yo-yo'
)
var
yo
=
require
(
'yo-yo'
)
var
async
=
require
(
'async'
)
var
async
=
require
(
'async'
)
...
@@ -440,7 +440,10 @@ module.exports = class TestTab extends ViewPlugin {
...
@@ -440,7 +440,10 @@ module.exports = class TestTab extends ViewPlugin {
handleCreateFolder
()
{
handleCreateFolder
()
{
this
.
inputPath
.
value
=
this
.
trimTestDirInput
(
this
.
inputPath
.
value
)
this
.
inputPath
.
value
=
this
.
trimTestDirInput
(
this
.
inputPath
.
value
)
let
path
=
removeMultipleSlashes
(
this
.
inputPath
.
value
)
if
(
path
!==
'/'
)
path
=
removeTrailingSlashes
(
path
)
if
(
this
.
inputPath
.
value
===
''
)
this
.
inputPath
.
value
=
this
.
defaultPath
if
(
this
.
inputPath
.
value
===
''
)
this
.
inputPath
.
value
=
this
.
defaultPath
this
.
inputPath
.
value
=
path
this
.
testTabLogic
.
generateTestFolder
(
this
.
inputPath
.
value
)
this
.
testTabLogic
.
generateTestFolder
(
this
.
inputPath
.
value
)
this
.
createTestFolder
.
disabled
=
true
this
.
createTestFolder
.
disabled
=
true
this
.
updateGenerateFileAction
().
disabled
=
false
this
.
updateGenerateFileAction
().
disabled
=
false
...
@@ -603,7 +606,8 @@ module.exports = class TestTab extends ViewPlugin {
...
@@ -603,7 +606,8 @@ module.exports = class TestTab extends ViewPlugin {
async
handleTestDirInput
(
e
)
{
async
handleTestDirInput
(
e
)
{
let
testDirInput
=
this
.
trimTestDirInput
(
this
.
inputPath
.
value
)
let
testDirInput
=
this
.
trimTestDirInput
(
this
.
inputPath
.
value
)
testDirInput
=
helper
.
removeMultipleSlashes
(
testDirInput
)
testDirInput
=
removeMultipleSlashes
(
testDirInput
)
if
(
testDirInput
!==
'/'
)
testDirInput
=
removeTrailingSlashes
(
testDirInput
)
if
(
e
.
key
===
'Enter'
)
{
if
(
e
.
key
===
'Enter'
)
{
this
.
inputPath
.
value
=
testDirInput
this
.
inputPath
.
value
=
testDirInput
if
(
await
this
.
testTabLogic
.
pathExists
(
testDirInput
))
{
if
(
await
this
.
testTabLogic
.
pathExists
(
testDirInput
))
{
...
@@ -614,8 +618,8 @@ module.exports = class TestTab extends ViewPlugin {
...
@@ -614,8 +618,8 @@ module.exports = class TestTab extends ViewPlugin {
}
}
if
(
testDirInput
)
{
if
(
testDirInput
)
{
if
(
testDirInput
.
endsWith
(
'/'
))
{
if
(
testDirInput
.
endsWith
(
'/'
)
&&
testDirInput
!==
'/'
)
{
testDirInput
=
helper
.
removeTrailingSlashes
(
testDirInput
)
testDirInput
=
removeTrailingSlashes
(
testDirInput
)
if
(
this
.
testTabLogic
.
currentPath
===
testDirInput
.
substr
(
0
,
testDirInput
.
length
-
1
))
{
if
(
this
.
testTabLogic
.
currentPath
===
testDirInput
.
substr
(
0
,
testDirInput
.
length
-
1
))
{
this
.
createTestFolder
.
disabled
=
true
this
.
createTestFolder
.
disabled
=
true
this
.
updateGenerateFileAction
().
disabled
=
true
this
.
updateGenerateFileAction
().
disabled
=
true
...
@@ -639,7 +643,7 @@ module.exports = class TestTab extends ViewPlugin {
...
@@ -639,7 +643,7 @@ module.exports = class TestTab extends ViewPlugin {
}
}
async
handleEnter
(
e
)
{
async
handleEnter
(
e
)
{
this
.
inputPath
.
value
=
helper
.
removeMultipleSlashes
(
this
.
trimTestDirInput
(
this
.
inputPath
.
value
))
this
.
inputPath
.
value
=
removeMultipleSlashes
(
this
.
trimTestDirInput
(
this
.
inputPath
.
value
))
if
(
this
.
createTestFolder
.
disabled
)
{
if
(
this
.
createTestFolder
.
disabled
)
{
if
(
await
this
.
testTabLogic
.
pathExists
(
this
.
inputPath
.
value
))
{
if
(
await
this
.
testTabLogic
.
pathExists
(
this
.
inputPath
.
value
))
{
this
.
testTabLogic
.
setCurrentPath
(
this
.
inputPath
.
value
)
this
.
testTabLogic
.
setCurrentPath
(
this
.
inputPath
.
value
)
...
...
apps/remix-ide/src/app/tabs/testTab/testTab.js
View file @
3d72f842
...
@@ -10,7 +10,7 @@ class TestTabLogic {
...
@@ -10,7 +10,7 @@ class TestTabLogic {
setCurrentPath
(
path
)
{
setCurrentPath
(
path
)
{
if
(
path
.
indexOf
(
'/'
)
===
0
)
return
if
(
path
.
indexOf
(
'/'
)
===
0
)
return
this
.
currentPath
=
path
this
.
currentPath
=
helper
.
removeMultipleSlashes
(
helper
.
removeTrailingSlashes
(
path
))
}
}
generateTestFolder
(
path
)
{
generateTestFolder
(
path
)
{
...
...
apps/remix-ide/src/lib/helper.js
View file @
3d72f842
...
@@ -105,8 +105,8 @@ module.exports = {
...
@@ -105,8 +105,8 @@ module.exports = {
return
this
.
is0XPrefixed
(
hash
)
&&
/^
[
0-9a-fA-F
]{64}
$/
.
test
(
hexValue
)
return
this
.
is0XPrefixed
(
hash
)
&&
/^
[
0-9a-fA-F
]{64}
$/
.
test
(
hexValue
)
},
},
removeTrailingSlashes
(
text
)
{
removeTrailingSlashes
(
text
)
{
//
Single or consecutive leading slashes:
//
Remove single or consecutive trailing slashes
return
text
.
replace
(
/
^
\/
+
/g
,
''
)
return
text
.
replace
(
/
\/
+$
/g
,
''
)
},
},
removeMultipleSlashes
(
text
)
{
removeMultipleSlashes
(
text
)
{
// Replace consecutive slashes with '/'
// Replace consecutive slashes with '/'
...
...
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