pull/1720/head
yann300 3 years ago
parent 7accbc72db
commit e145a2daa1
  1. 2
      apps/remix-ide-e2e/src/tests/solidityUnittests.spec.ts
  2. 5
      libs/remix-ui/tabs/src/lib/remix-ui-tabs.tsx

@ -94,7 +94,7 @@ module.exports = {
'Should fail on compilation, open file on error click, not disappear error': function (browser: NightwatchBrowser) { 'Should fail on compilation, open file on error click, not disappear error': function (browser: NightwatchBrowser) {
browser.waitForElementPresent('*[data-id="verticalIconsKindfilePanel"]') browser.waitForElementPresent('*[data-id="verticalIconsKindfilePanel"]')
.addFile('tests/compilationError_test.sol', sources[0]['compilationError_test.sol']) .addFile('tests/compilationError_test.sol', sources[0]['compilationError_test.sol'])
.click('div[title="default_workspace/tests/compilationError_test.sol"] span[class="close"]') .click('div[title="default_workspace/tests/compilationError_test.sol"] span[class="close-tabs"]')
.clickLaunchIcon('solidityUnitTesting') .clickLaunchIcon('solidityUnitTesting')
.pause(2000) .pause(2000)
.click('*[data-id="testTabCheckAllTests"]') .click('*[data-id="testTabCheckAllTests"]')

@ -31,7 +31,7 @@ export const TabsUI = (props: TabsUIProps) => {
const renderTab = (tab, index) => { const renderTab = (tab, index) => {
const classNameImg = 'my-1 mr-1 text-dark ' + tab.iconClass const classNameImg = 'my-1 mr-1 text-dark ' + tab.iconClass
const classNameTab = 'nav-item nav-link tab' + (index === selectedIndex ? ' active' : '') const classNameTab = 'nav-item nav-link tab' + (index === currentIndexRef.current ? ' active' : '')
return ( return (
<div ref={el => { tabsRef.current[index] = el }} className={classNameTab} title={tab.tooltip}> <div ref={el => { tabsRef.current[index] = el }} className={classNameTab} title={tab.tooltip}>
{tab.icon ? (<img className="my-1 mr-1 iconImage" src={tab.icon} />) : (<i className={classNameImg}></i>)} {tab.icon ? (<img className="my-1 mr-1 iconImage" src={tab.icon} />) : (<i className={classNameImg}></i>)}
@ -44,12 +44,13 @@ export const TabsUI = (props: TabsUIProps) => {
} }
const active = () => { const active = () => {
if (currentIndexRef.current < 0) return ''
return props.tabs[currentIndexRef.current].name return props.tabs[currentIndexRef.current].name
} }
const activateTab = (name: string) => { const activateTab = (name: string) => {
const index = props.tabs.findIndex((tab) => tab.name === name) const index = props.tabs.findIndex((tab) => tab.name === name)
setSelectedIndex(index)
currentIndexRef.current = index currentIndexRef.current = index
setSelectedIndex(index)
} }
useEffect(() => { useEffect(() => {
props.onReady({ props.onReady({

Loading…
Cancel
Save