test(electron): add test cases for electron tabs (#7635)

fix AF-1000
This commit is contained in:
pengx17
2024-07-29 11:05:24 +00:00
parent 1efc1d0f5b
commit 157cc97a65
8 changed files with 215 additions and 49 deletions

View File

@@ -84,6 +84,7 @@ const WorkbenchTab = ({
return (
<div
key={workbench.id}
data-testid="workbench-tab"
data-active={tabActive}
data-pinned={workbench.pinned}
className={styles.tab}
@@ -93,6 +94,7 @@ const WorkbenchTab = ({
<Fragment key={view.id}>
<button
key={view.id}
data-testid="split-view-label"
className={styles.splitViewLabel}
data-active={activeViewIndex === viewIdx && tabActive}
onContextMenu={() => {
@@ -125,7 +127,11 @@ const WorkbenchTab = ({
})}
{!workbench.pinned && tabsLength > 1 ? (
<div className={styles.tabCloseButtonWrapper}>
<button className={styles.tabCloseButton} onClick={onCloseTab}>
<button
data-testid="close-tab-button"
className={styles.tabCloseButton}
onClick={onCloseTab}
>
<CloseIcon />
</button>
</div>
@@ -214,7 +220,7 @@ export const AppTabsHeader = ({
/>
);
})}
<IconButton onClick={onAddTab}>
<IconButton onClick={onAddTab} data-testid="add-tab-view-button">
<PlusIcon />
</IconButton>
</div>

View File

@@ -47,6 +47,7 @@ export const SplitViewMenuIndicator = memo(
<div
ref={ref}
data-active={active}
data-testid="split-view-indicator"
className={clsx(className, styles.indicator)}
onClick={onClick}
onMouseDown={onMouseDown}