fix(web): expose workflow parallel toggle state (#40282)

This commit is contained in:
yyh 2026-08-10 10:56:14 +08:00 committed by GitHub
parent 7295d9306f
commit cc4bf22d07
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 21 additions and 3 deletions

View File

@ -135,11 +135,23 @@ describe('TracingPanel', () => {
fireEvent.mouseLeave(hoverTarget)
fireEvent.click(screen.getAllByRole('button')[0]!)
const parallelToggle = screen.getByRole('button', {
name: 'Parallel Group',
expanded: true,
})
expect(parallelToggle).toHaveAttribute('aria-controls', 'parallel-1-children')
fireEvent.click(parallelToggle)
expect(
screen.getByRole('button', { name: 'Parallel Group', expanded: false }),
).toBeInTheDocument()
expect(
container.querySelector('[data-parallel-id="parallel-1"] > div:last-child'),
)!.toHaveClass('hidden')
fireEvent.click(screen.getAllByRole('button')[0]!)
fireEvent.click(parallelToggle)
expect(
screen.getByRole('button', { name: 'Parallel Group', expanded: true }),
).toBeInTheDocument()
expect(
container.querySelector('[data-parallel-id="parallel-1"] > div:last-child'),
).not.toHaveClass('hidden')

View File

@ -90,6 +90,9 @@ const TracingPanel: FC<TracingPanelProps> = ({
<div className="mb-1 flex items-center">
<button
type="button"
aria-controls={`${node.id}-children`}
aria-expanded={!isCollapsed}
aria-label={parallelDetail.parallelTitle}
onClick={() => toggleCollapse(node.id)}
className={cn(
'mr-2 transition-colors',
@ -115,7 +118,10 @@ const TracingPanel: FC<TracingPanelProps> = ({
}}
></div>
</div>
<div className={`relative pl-2 ${isCollapsed ? 'hidden' : ''}`}>
<div
id={`${node.id}-children`}
className={`relative pl-2 ${isCollapsed ? 'hidden' : ''}`}
>
<div
className={cn(
'absolute top-0 bottom-0 left-1.25 w-0.5',