fix: unit test for button and input-field component

This commit is contained in:
Hafid Nur
2025-04-05 06:21:56 +07:00
parent 745a2d2873
commit 2746af0b3f
2 changed files with 5 additions and 5 deletions
+3 -3
View File
@@ -24,9 +24,9 @@ describe('Test Button Component', () => {
const button = screen.getByText('Delete');
expect(button).toHaveClass('bg-danger-500');
expect(button).toHaveClass('hover:bg-danger-600');
expect(button).toHaveClass('text-white');
expect(button).toHaveClass('bg-danger-100');
expect(button).toHaveClass('hover:bg-danger-200');
expect(button).toHaveClass('text-danger-500');
});
it("disables the button when 'disabled' prop is set", async () => {
@@ -3,7 +3,7 @@ import { InputField } from './input-field';
describe('InputField Component', () => {
it('renders correctly with disabled prop', () => {
render(<InputField label="Test Label" disabled={true} />);
render(<InputField htmlFor="test" label="Test Label" disabled={true} />);
const input = screen.getByLabelText('Test Label');
expect(input).toBeDisabled();
@@ -11,7 +11,7 @@ describe('InputField Component', () => {
});
it('renders correctly without disabled prop', () => {
render(<InputField label="Test Label" disabled={false} />);
render(<InputField htmlFor="test" label="Test Label" disabled={false} />);
const input = screen.getByLabelText('Test Label');
expect(input).not.toBeDisabled();