import { StatusCheck } from '@repay/cactus-icons'
import { fireEvent } from '@testing-library/react'
import * as React from 'react'
import renderWithTheme from '../../tests/helpers/renderWithTheme'
import TextButton from './TextButton'
describe('component: TextButton', () => {
test('should support space props', () => {
const { getByText } = renderWithTheme(I have margins!)
const textButton = getByText('I have margins!')
const styles = window.getComputedStyle(textButton)
expect(styles.marginRight).toBe('24px')
})
test('should trigger onClick', () => {
const onClick = jest.fn()
const { getByTestId } = renderWithTheme(
Click me!
)
fireEvent.click(getByTestId('clicked'))
expect(onClick).toHaveBeenCalled()
})
test('should not trigger onClick', () => {
const onClick = jest.fn()
const { getByTestId } = renderWithTheme(
Click me!
)
fireEvent.click(getByTestId('not-clicked'))
expect(onClick).not.toHaveBeenCalled()
})
test('should render a text+icon button', () => {
const { getByText } = renderWithTheme(
Check check
)
const svgElement = getByText('Check check').children
expect(svgElement[0].tagName).toBe('svg')
})
})