Skip to content

Commit 0d113d1

Browse files
committed
update data id and add e2e
1 parent 7fb19d4 commit 0d113d1

File tree

2 files changed

+19
-25
lines changed

2 files changed

+19
-25
lines changed

apps/remix-ide-e2e/src/tests/toggle_panels.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,23 @@ module.exports = {
123123
.waitForElementVisible('.terminal-wrap')
124124
.waitForElementVisible('.codicon-layout-panel')
125125
},
126+
'Hide bottom terminal panel using hideBottomPanel icon (close icon) #group1': function (browser: NightwatchBrowser) {
127+
browser
128+
.waitForElementVisible('.terminal-wrap')
129+
.waitForElementVisible('*[data-id="hideBottomPanel"]')
130+
.click('*[data-id="hideBottomPanel"]')
131+
.waitForElementNotVisible('.terminal-wrap')
132+
// Show the terminal again using top bar toggle icon
133+
.click('*[data-id="toggleBottomPanelIcon"]')
134+
.waitForElementVisible('.terminal-wrap')
135+
.waitForElementVisible('*[data-id="hideBottomPanel"]')
136+
// Hide again using hideBottomPanel
137+
.click('*[data-id="hideBottomPanel"]')
138+
.waitForElementNotVisible('.terminal-wrap')
139+
// Show again using hideBottomPanel (requires clicking top bar toggle first to show terminal bar)
140+
.click('*[data-id="toggleBottomPanelIcon"]')
141+
.waitForElementVisible('.terminal-wrap')
142+
},
126143
'Hide all three panels using toggle icons on top bar, reload and ensure all are hidden #group1': function (browser: NightwatchBrowser) {
127144
browser
128145
.waitForElementVisible('*[data-id="toggleLeftSidePanelIcon"]')

libs/remix-ui/terminal/src/lib/components/remix-ui-terminal-menu-toggle.tsx

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,9 @@
11
import { CustomTooltip } from '@remix-ui/helper'
2-
import React, { useEffect, useState } from 'react' // eslint-disable-line
2+
import React from 'react' // eslint-disable-line
33
import { FormattedMessage } from 'react-intl'
44
import { RemixUiTerminalProps } from '../types/terminalTypes'
55
export const RemixUITerminalMenuToggle = (props: RemixUiTerminalProps) => {
66

7-
const [isPanelHidden, setIsPanelHidden] = useState(false)
8-
9-
useEffect(() => {
10-
// Initialize panel hidden state
11-
const initPanelState = async () => {
12-
const hidden = await props.plugin.call('terminal', 'isPanelHidden')
13-
setIsPanelHidden(hidden)
14-
}
15-
initPanelState()
16-
17-
// Listen for panel visibility changes
18-
const handlePanelShown = () => setIsPanelHidden(false)
19-
const handlePanelHidden = () => setIsPanelHidden(true)
20-
21-
props.plugin.on('terminal', 'terminalPanelShown', handlePanelShown)
22-
props.plugin.on('terminal', 'terminalPanelHidden', handlePanelHidden)
23-
24-
return () => {
25-
props.plugin.off('terminal', 'terminalPanelShown')
26-
props.plugin.off('terminal', 'terminalPanelHidden')
27-
}
28-
}, [])
29-
307
async function handleToggleTerminal(): Promise<void> {
318
// Toggle the bottom terminal panel using terminal-wrap component
329
await props.plugin.call('terminal', 'togglePanel')
@@ -42,7 +19,7 @@ export const RemixUITerminalMenuToggle = (props: RemixUiTerminalProps) => {
4219
>
4320
<i
4421
className={`mx-2 codicon codicon-close fw-bold fs-5`}
45-
data-id="terminalToggleIcon"
22+
data-id="hideBottomPanel"
4623
onClick={handleToggleTerminal}
4724
></i>
4825
</CustomTooltip>

0 commit comments

Comments
 (0)