Skip to content

Commit

Permalink
fix(#273): hyphenate data-testid and custom classes
Browse files Browse the repository at this point in the history
  • Loading branch information
CorinaMurg committed Jul 18, 2024
1 parent 29fa949 commit 2a84095
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions components/Label/Label.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ describe('Label', () => {
variants.forEach((variant) => {
it(`renders correctly with variant ${variant}`, () => {
render(
<Label data-testid="testLabel" variant={variant}>
<Label data-testid="test-label" variant={variant}>
Test Label
</Label>
);

const label = screen.getByTestId('testLabel');
const label = screen.getByTestId('test-label');
expect(label).toBeInTheDocument();
if (variant) {
expect(label).toHaveClass(variantClasses[variant]);
Expand All @@ -34,17 +34,17 @@ describe('Label', () => {
it(`applies additional custom classes correctly`, () => {
render(
<Label
data-testid="customClassLabel"
className="customClassLabel extra-custom-class"
data-testid="custom-class-label"
className="custom-class-label extra-custom-class"
>
Custom Test Label
</Label>
);

const labelCustom = screen.getByTestId('customClassLabel');
const labelCustom = screen.getByTestId('custom-class-label');
expect(labelCustom).toBeInTheDocument();
if (labelCustom.hasAttribute('className')) {
expect(labelCustom).toHaveClass('customClassLabel extra-custom-class');
expect(labelCustom).toHaveClass('custom-class-label extra-custom-class');
}
});
});
4 changes: 2 additions & 2 deletions components/LinkCustom/LinkCustom.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import LinkCustom from './LinkCustom';
describe('LinkCustom Component', () => {
it('renders with default props', () => {
render(
<LinkCustom children="Test link" data-testid="testLink" href="https://example.com"></LinkCustom>,
<LinkCustom children="Test link" data-testid="test-link" href="https://example.com"></LinkCustom>,
);
const link = screen.getByTestId('testLink');
const link = screen.getByTestId('test-link');
expect(link).toBeInTheDocument();
expect(link).toHaveTextContent('Test link');
expect(link).toHaveAttribute('href', 'https://example.com');
Expand Down

0 comments on commit 2a84095

Please sign in to comment.