-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aa70714
commit bfc234b
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
import Em from '../Em'; | ||
|
||
describe('Em', () => { | ||
test('renders Em component', () => { | ||
render(<>Welcome to <Em>RadUI</Em></>); | ||
expect(screen.getByText('RadUI')).toBeInTheDocument(); | ||
}); | ||
|
||
test('renders Em tag with valid text', () => { | ||
render(<>Welcome to <Em>RadUI</Em></>); | ||
expect(screen.getByText('RadUI').tagName.toLowerCase()).toBe('em'); | ||
}); | ||
|
||
test('renders custom classes correctly', () => { | ||
render(<>Welcome to <Em className="custom-class">RadUI</Em></>); | ||
expect(screen.getByText('RadUI')).toHaveClass('custom-class'); | ||
}); | ||
|
||
test('renders custom styles correctly', () => { | ||
render(<>Welcome to <Em style={{ color: 'red' }}>RadUI</Em></>); | ||
expect(screen.getByText('RadUI')).toHaveStyle('color: red'); | ||
}); | ||
|
||
test('renders custom id correctly', () => { | ||
render(<>Welcome to <Em id="em-id">RadUI</Em></>); | ||
expect(screen.getByText('RadUI')).toHaveAttribute('id', 'em-id'); | ||
}); | ||
|
||
test('renders custom data attribute correctly', () => { | ||
render(<>Welcome to <Em data-testid="em-data">RadUI</Em></>); | ||
expect(screen.getByText('RadUI')).toHaveAttribute('data-testid', 'em-data'); | ||
}); | ||
}); |