|
|
|
@ -70,6 +70,41 @@ module.exports = { |
|
|
|
|
.checkElementStyle('.ace_comment.ace_doc', 'color', aceThemes.dark.comment) |
|
|
|
|
.checkElementStyle('.ace_function', 'color', aceThemes.dark.function) |
|
|
|
|
.checkElementStyle('.ace_variable', 'color', aceThemes.dark.variable) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
'Should highlight source code': function (browser) { |
|
|
|
|
browser.addFile('sourcehighlight.js', sourcehighlightScript) |
|
|
|
|
.switchFile('browser/sourcehighlight.js') |
|
|
|
|
.executeScript('remix.exeCurrent()') |
|
|
|
|
.editorScroll('down', 60) |
|
|
|
|
.waitForElementPresent('.highlightLine32') |
|
|
|
|
.checkElementStyle('.highlightLine32', 'background-color', 'rgb(8, 108, 181)') |
|
|
|
|
.waitForElementPresent('.highlightLine40') |
|
|
|
|
.checkElementStyle('.highlightLine40', 'background-color', 'rgb(8, 108, 181)') |
|
|
|
|
.waitForElementPresent('.highlightLine50') |
|
|
|
|
.checkElementStyle('.highlightLine50', 'background-color', 'rgb(8, 108, 181)') |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
'Should remove 1 highlight from source code': function (browser) { |
|
|
|
|
browser.addFile('removeSourcehighlightScript.js', removeSourcehighlightScript) |
|
|
|
|
.switchFile('browser/removeSourcehighlightScript.js') |
|
|
|
|
.executeScript('remix.exeCurrent()') |
|
|
|
|
.switchFile('browser/3_Ballot.sol') |
|
|
|
|
.editorScroll('down', 60) |
|
|
|
|
.waitForElementNotPresent('.highlightLine32') |
|
|
|
|
.checkElementStyle('.highlightLine40', 'background-color', 'rgb(8, 108, 181)') |
|
|
|
|
.checkElementStyle('.highlightLine50', 'background-color', 'rgb(8, 108, 181)') |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
'Should remove all highlights from source code': function (browser) { |
|
|
|
|
browser.addFile('removeAllSourcehighlightScript.js', removeAllSourcehighlightScript) |
|
|
|
|
.switchFile('browser/removeAllSourcehighlightScript.js') |
|
|
|
|
.executeScript('remix.exeCurrent()') |
|
|
|
|
.switchFile('browser/3_Ballot.sol') |
|
|
|
|
.editorScroll('down', 60) |
|
|
|
|
.waitForElementNotPresent('.highlightLine32') |
|
|
|
|
.waitForElementNotPresent('.highlightLine40') |
|
|
|
|
.waitForElementNotPresent('.highlightLine50') |
|
|
|
|
.end() |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
@ -90,3 +125,73 @@ var aceThemes = { |
|
|
|
|
variable: 'rgb(153, 119, 68)' |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const sourcehighlightScript = { |
|
|
|
|
content: ` |
|
|
|
|
(async () => { |
|
|
|
|
try { |
|
|
|
|
const pos = { |
|
|
|
|
start: { |
|
|
|
|
line: 32, |
|
|
|
|
column: 3 |
|
|
|
|
}, |
|
|
|
|
end: { |
|
|
|
|
line: 32, |
|
|
|
|
column: 20 |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
await remix.call('editor', 'highlight', pos, 'browser/3_Ballot.sol') |
|
|
|
|
|
|
|
|
|
const pos2 = { |
|
|
|
|
start: { |
|
|
|
|
line: 40, |
|
|
|
|
column: 3 |
|
|
|
|
}, |
|
|
|
|
end: { |
|
|
|
|
line: 40, |
|
|
|
|
column: 20 |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
await remix.call('editor', 'highlight', pos2, 'browser/3_Ballot.sol') |
|
|
|
|
|
|
|
|
|
const pos3 = { |
|
|
|
|
start: { |
|
|
|
|
line: 50, |
|
|
|
|
column: 3 |
|
|
|
|
}, |
|
|
|
|
end: { |
|
|
|
|
line: 50, |
|
|
|
|
column: 20 |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
await remix.call('editor', 'highlight', pos3, 'browser/3_Ballot.sol') |
|
|
|
|
} catch (e) { |
|
|
|
|
console.log(e.message) |
|
|
|
|
} |
|
|
|
|
})() |
|
|
|
|
` |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const removeSourcehighlightScript = { |
|
|
|
|
content: ` |
|
|
|
|
(async () => { |
|
|
|
|
try { |
|
|
|
|
await remix.call('editor', 'discardHighlightAt', 32, 'browser/3_Ballot.sol')
|
|
|
|
|
} catch (e) { |
|
|
|
|
console.log(e.message) |
|
|
|
|
} |
|
|
|
|
})() |
|
|
|
|
` |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const removeAllSourcehighlightScript = { |
|
|
|
|
content: ` |
|
|
|
|
(async () => { |
|
|
|
|
try { |
|
|
|
|
await remix.call('editor', 'discardHighlight')
|
|
|
|
|
} catch (e) { |
|
|
|
|
console.log(e.message) |
|
|
|
|
} |
|
|
|
|
})() |
|
|
|
|
` |
|
|
|
|
} |
|
|
|
|