refactor: Refactor UI structure
This commit is contained in:
33 files changed
+435
-247
No files matched your search
@@ -0,0 +1,18 @@
|
||||
import React from 'react';
|
||||
|
||||
import { Link } from './Link';
|
||||
import { render, screen } from '../../../test-utils';
|
||||
|
||||
describe('components/generic/Link', () => {
|
||||
it('renders correctly as a link when href is provided', () => {
|
||||
render(<Link href="https://example.com">Click me</Link>);
|
||||
const link = screen.getByRole('link', { name: 'Click me' });
|
||||
expect(link).toHaveAttribute('href', 'https://example.com');
|
||||
expect(link).toHaveClass('text-[var(--rb-ring)]');
|
||||
});
|
||||
|
||||
it('renders as a button/span when no href is provided but has onPress', () => {
|
||||
render(<Link onPress={() => {}}>Click me</Link>);
|
||||
expect(screen.getByText('Click me')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user