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
3373887f
Commit
3373887f
authored
May 06, 2020
by
ioedeveloper
Committed by
yann300
May 07, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added line class to hightlighter
parent
f465caf2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
80 additions
and
45 deletions
+80
-45
sourceHighlighter.js
src/app/editor/sourceHighlighter.js
+1
-1
scrollUp.js
test-browser/commands/scrollUp.js
+25
-0
editor.test.js
test-browser/tests/editor.test.js
+54
-44
No files found.
src/app/editor/sourceHighlighter.js
View file @
3373887f
...
@@ -60,7 +60,7 @@ class SourceHighlighter {
...
@@ -60,7 +60,7 @@ class SourceHighlighter {
}
}
`
`
this
.
statementMarker
=
this
.
_deps
.
editor
.
addMarker
(
lineColumnPos
,
this
.
source
,
css
.
highlightcode
.
className
+
' '
+
css
.
customBackgroundColor
.
className
)
this
.
statementMarker
=
this
.
_deps
.
editor
.
addMarker
(
lineColumnPos
,
this
.
source
,
css
.
highlightcode
.
className
+
' '
+
css
.
customBackgroundColor
.
className
+
' '
+
`highlightLine
${
lineColumnPos
.
start
.
line
}
`
)
this
.
_deps
.
editor
.
scrollToLine
(
lineColumnPos
.
start
.
line
,
true
,
true
,
function
()
{})
this
.
_deps
.
editor
.
scrollToLine
(
lineColumnPos
.
start
.
line
,
true
,
true
,
function
()
{})
this
.
position
=
lineColumnPos
this
.
position
=
lineColumnPos
if
(
lineColumnPos
.
start
.
line
===
lineColumnPos
.
end
.
line
)
{
if
(
lineColumnPos
.
start
.
line
===
lineColumnPos
.
end
.
line
)
{
...
...
test-browser/commands/scrollUp.js
0 → 100644
View file @
3373887f
const
EventEmitter
=
require
(
'events'
)
class
ScrollUp
extends
EventEmitter
{
command
(
target
,
height
)
{
this
.
api
.
perform
((
done
)
=>
{
_scrollUp
(
this
.
api
,
target
,
height
,
()
=>
{
done
()
this
.
emit
(
'complete'
)
})
})
return
this
}
}
function
_scrollUp
(
browser
,
target
,
height
,
cb
)
{
browser
.
execute
(
function
(
target
,
height
)
{
const
element
=
document
.
querySelector
(
target
)
element
.
scrollTop
=
element
.
scrollHeight
-
height
},
[
target
,
height
],
function
()
{
cb
()
})
}
module
.
exports
=
ScrollUp
test-browser/tests/editor.test.js
View file @
3373887f
...
@@ -73,9 +73,16 @@ module.exports = {
...
@@ -73,9 +73,16 @@ module.exports = {
},
},
'Should highlight source code'
:
function
(
browser
)
{
'Should highlight source code'
:
function
(
browser
)
{
browser
.
addFile
(
'
browser/
sourcehighlight.js'
,
sourcehighlightScript
)
browser
.
addFile
(
'sourcehighlight.js'
,
sourcehighlightScript
)
.
switchFile
(
'browser/sourcehighlight.js'
)
.
switchFile
(
'browser/sourcehighlight.js'
)
.
executeScript
(
'remix.exeCurrent()'
)
.
executeScript
(
'remix.exeCurrent()'
)
.
scrollUp
(
'*[data-id="editorInput"]'
,
100
)
.
pause
(
5000
)
.
scrollUp
(
'.ace_scroller'
,
100
)
.
waitForElementPresent
(
'.highlightLine32'
)
.
checkElementStyle
(
'.highlightLine32'
,
'background-color'
,
'rgb(8, 108, 181)'
)
.
waitForElementPresent
(
'.highlightLine40'
)
.
checkElementStyle
(
'.highlightLine40'
,
'background-color'
,
'rgb(8, 108, 181)'
)
.
end
()
.
end
()
},
},
...
@@ -97,46 +104,48 @@ var aceThemes = {
...
@@ -97,46 +104,48 @@ var aceThemes = {
}
}
}
}
const
sourcehighlightScript
=
`
const
sourcehighlightScript
=
{
(async () => {
content
:
`
try {
(async () => {
const pos = {
try {
start: {
const pos = {
line: 32,
start: {
column: 3
line: 32,
},
column: 3
end: {
},
line: 32,
end: {
column: 20
line: 32,
}
column: 20
}
}
await remix.call('editor', 'highlight', pos, 'browser/3_Ballot.sol')
}
await remix.call('editor', 'highlight', pos, 'browser/3_Ballot.sol')
const pos2 = {
start: {
const pos2 = {
line: 40,
start: {
column: 3
line: 40,
},
column: 3
end: {
},
line: 40,
end: {
column: 20
line: 40,
}
column: 20
}
}
await remix.call('editor', 'highlight', pos2, 'browser/3_Ballot.sol')
}
await remix.call('editor', 'highlight', pos2, 'browser/3_Ballot.sol')
const pos3 = {
start: {
const pos3 = {
line: 50,
start: {
column: 3
line: 50,
},
column: 3
end: {
},
line: 50,
end: {
column: 20
line: 50,
}
column: 20
}
}
await remix.call('editor', 'highlight', pos3, 'browser/3_Ballot.sol')
}
} catch (e) {
await remix.call('editor', 'highlight', pos3, 'browser/3_Ballot.sol')
console.log(e.message)
} catch (e) {
}
console.log(e.message)
})()
}
`
})()
`
}
\ No newline at end of file
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