,
)
const button = screen.getByText('Action 1')
fireEvent.click(button)
// The action's onClick should fire
expect(onClick).toHaveBeenCalledTimes(1)
// But parent onClick should not fire due to stopPropagation
expect(parentOnClick).not.toHaveBeenCalled()
})
test('renders actions with different types of elements', () => {
const actions = [
,
,
Span,
]
render()
expect(screen.getByText('Button')).toBeTruthy()
expect(screen.getByText('Link')).toBeTruthy()
expect(screen.getByText('Span')).toBeTruthy()
})
test('wraps each action in a Box with correct key', () => {
const actions = [
,
,
]
const { container } = render()
// Check that actions are rendered
expect(screen.getByText('Action 1')).toBeTruthy()
expect(screen.getByText('Action 2')).toBeTruthy()
// The container should have the actions box
expect(container.firstChild).toBeTruthy()
})
test('handles complex action components', () => {
const ComplexAction = () => (