UNPKG

@eureca/eureca-ui

Version:

UI component library of Eureca's user and admin apps

32 lines (26 loc) 893 B
import React from 'react'; import { render } from '@testing-library/react'; import { Chips } from '..'; const chipsText = 'Educação & Seleção'; const chipsId = 'chips-testid'; function renderChip({ content, variant }) { return render(<Chips label={content} variant={variant} data-testid={chipsId} />); } describe('Chips component', () => { it('renders a chip with label', () => { const { getByTestId } = renderChip({ content: chipsText, }); const chip = getByTestId(chipsId); expect(chip.textContent).toBe(chipsText); }); it('has no background color when variant is outlined', async () => { const { getByTestId } = renderChip({ content: chipsText, variant: 'outlined', }); const chip = getByTestId(chipsId); const { backgroundColor } = window.getComputedStyle(chip); expect(backgroundColor).toBe('transparent'); }); });