Skip to content

Commit 0b51931

Browse files
Bill LeoutsakosBill Leoutsakos
authored andcommitted
test(terminal): verify complete native row markup
1 parent 67dea87 commit 0b51931

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

‎apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/terminal/components/terminal-row-button.test.tsx‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* @vitest-environment jsdom
33
*/
44
import { act } from 'react'
5+
import { BlockTileView } from '@sim/workflow-renderer'
56
import { createRoot, type Root } from 'react-dom/client'
67
import { renderToStaticMarkup } from 'react-dom/server'
78
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
@@ -71,4 +72,28 @@ describe('TerminalRowButton', () => {
7172
expect(html).toContain('>Running</span>')
7273
expect(html).not.toContain('<div')
7374
})
75+
76+
it('keeps the complete tile, label, chevron, and status as valid button contents', () => {
77+
const Icon = ({ className }: { className?: string }) => <svg className={className} />
78+
const html = renderToStaticMarkup(
79+
<TerminalRowButton aria-expanded={false}>
80+
<span className={ROW_STYLES.content}>
81+
<BlockTileView as='span' blockType='agent' icon={Icon} bgColor='#33C482' useAccent />
82+
<span className={ROW_STYLES.label}>Agent</span>
83+
<svg aria-hidden='true' />
84+
</span>
85+
<span className={ROW_STYLES.status}>
86+
<StatusDisplay isRunning isCanceled={false} formattedDuration='-' />
87+
</span>
88+
</TerminalRowButton>
89+
)
90+
const document = new DOMParser().parseFromString(html, 'text/html')
91+
const button = document.querySelector('button')
92+
expect(button?.getAttribute('aria-expanded')).toBe('false')
93+
expect(button?.textContent).toContain('Agent')
94+
expect(button?.textContent).toContain('Running')
95+
expect(button?.querySelector('[data-workflow-type-icon="agent"]')).not.toBeNull()
96+
expect(button?.querySelectorAll('button, a, div')).toHaveLength(0)
97+
expect(document.body.children).toHaveLength(1)
98+
})
7499
})

0 commit comments

Comments
 (0)