test(web): add and enhance frontend automated tests across multiple modules (#32268)

Co-authored-by: CodingOnStar <hanxujiang@dify.com>
This commit is contained in:
Coding On Star
2026-02-13 10:27:48 +08:00
committed by GitHub
parent 16df9851a2
commit b6d506828b
75 changed files with 5652 additions and 4081 deletions

View File

@ -47,8 +47,20 @@ describe('PlanSwitcherTab', () => {
expect(handleClick).toHaveBeenCalledWith('self')
})
it('should apply active text class when isActive is true', () => {
render(
it('should apply distinct styling when isActive is true', () => {
const { rerender } = render(
<Tab
Icon={Icon}
value="cloud"
label="Cloud"
isActive={false}
onClick={vi.fn()}
/>,
)
const inactiveClassName = screen.getByText('Cloud').className
rerender(
<Tab
Icon={Icon}
value="cloud"
@ -58,7 +70,8 @@ describe('PlanSwitcherTab', () => {
/>,
)
expect(screen.getByText('Cloud')).toHaveClass('text-saas-dify-blue-accessible')
const activeClassName = screen.getByText('Cloud').className
expect(activeClassName).not.toBe(inactiveClassName)
expect(screen.getByTestId('tab-icon')).toHaveAttribute('data-active', 'true')
})
})