2025-03-27 07:19:46 +07:00
|
|
|
import { describe, it, expect } from 'vitest';
|
|
|
|
|
import { render, screen } from '@testing-library/react';
|
|
|
|
|
import { Input } from './input';
|
2025-03-16 00:56:02 +07:00
|
|
|
|
2025-03-27 07:19:46 +07:00
|
|
|
describe('Test Input Component', () => {
|
|
|
|
|
it('renders the input with placeholder text', () => {
|
2025-03-16 00:56:02 +07:00
|
|
|
render(<Input placeholder="Placeholder" />);
|
2025-03-27 07:19:46 +07:00
|
|
|
expect(screen.getByPlaceholderText('Placeholder')).toBeInTheDocument();
|
2025-03-16 00:56:02 +07:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it("disables the input field when 'disabled' prop is set", () => {
|
|
|
|
|
render(<Input disabled />);
|
2025-03-27 07:19:46 +07:00
|
|
|
expect(screen.getByRole('textbox')).toBeDisabled();
|
2025-03-16 00:56:02 +07:00
|
|
|
});
|
|
|
|
|
});
|