Merge pull request #2687 from ethereum/fix-collapsing-panel

Fixed collapsing solidity locals panel
pull/1/head
yann300 5 years ago committed by GitHub
commit 1e4ce4a72e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      src/app/ui/TreeView.js
  2. 5
      test-browser/tests/remixd.js

@ -45,6 +45,7 @@ class TreeView {
this.extractData = opts.extractData || this.extractDataDefault
this.formatSelf = opts.formatSelf || this.formatSelfDefault
this.view = null
this.expandPath = []
}
render (json, expand) {
@ -86,14 +87,20 @@ class TreeView {
${caret}
<span>${self.formatSelf(key, data, li)}</span>
</div>`
const expanded = self.expandPath.includes(keyPath)
li.appendChild(label)
if (data.children) {
var list = yo`<ul key=${keyPath} data-id="treeViewUlList${keyPath}" class=${css.ul_tv}>${children}</ul>`
list.style.display = 'none'
list.style.display = expanded ? 'block' : 'none'
caret.className = list.style.display === 'none' ? `fas fa-caret-right caret ${css.caret_tv}` : `fas fa-caret-down caret ${css.caret_tv}`
caret.setAttribute('data-id', `treeViewToggle${keyPath}`)
label.onclick = function () {
self.expand(keyPath)
if (self.isExpanded(keyPath)) {
if (!self.expandPath.includes(keyPath)) self.expandPath.push(keyPath)
} else {
self.expandPath = self.expandPath.filter(path => path !== keyPath)
}
}
label.oncontextmenu = function (event) {
self.event.trigger('nodeRightClick', [keyPath, data, label, event])

@ -118,11 +118,8 @@ function runTests (browser, testData) {
.perform(function (done) {
testImportFromRemixd(browser, () => { done() })
})
.clickLaunchIcon('fileExplorers').click('[data-path="localhost"]') // collapse and expand
.waitForElementNotVisible('[data-path="localhost/folder1"]')
.click('[data-path="localhost"]')
.clickLaunchIcon('fileExplorers')
.waitForElementVisible('[data-path="localhost/folder1"]')
.click('[data-path="localhost/folder1"]')
.waitForElementVisible('[data-path="localhost/folder1/contract1.sol"]')
.waitForElementVisible('[data-path="localhost/folder1/renamed_contract_' + browserName + '.sol"]') // check if renamed file is preset
.waitForElementNotPresent('[data-path="localhost/folder1/contract_' + browserName + '.sol"]') // check if renamed (old) file is not present

Loading…
Cancel
Save