mirror of
https://github.com/langgenius/dify.git
synced 2026-05-06 10:28:10 +08:00
test(web): add and enhance frontend automated tests across multiple modules (#32268)
Co-authored-by: CodingOnStar <hanxujiang@dify.com>
This commit is contained in:
@ -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')
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user