chore: add vitest/globals types, remove redundant vitest imports, fix pre-existing lint issues
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import { Input, Textarea } from './Input';
|
||||
|
||||
@@ -35,7 +34,7 @@ describe('Input', () => {
|
||||
const input = screen.getByRole('textbox');
|
||||
const errorId = input.getAttribute('aria-describedby');
|
||||
expect(errorId).toBeTruthy();
|
||||
expect(document.getElementById(errorId!)).toHaveTextContent('Required');
|
||||
expect(document.getElementById(errorId as string)).toHaveTextContent('Required');
|
||||
});
|
||||
it('no aria-describedby when no error', () => {
|
||||
render(<Input />);
|
||||
@@ -100,7 +99,7 @@ describe('Textarea', () => {
|
||||
const textarea = screen.getByRole('textbox');
|
||||
const errorId = textarea.getAttribute('aria-describedby');
|
||||
expect(errorId).toBeTruthy();
|
||||
expect(document.getElementById(errorId!)).toHaveTextContent('Too short');
|
||||
expect(document.getElementById(errorId as string)).toHaveTextContent('Too short');
|
||||
});
|
||||
it('no aria-describedby when no error', () => {
|
||||
render(<Textarea />);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useId, type InputHTMLAttributes, type TextareaHTMLAttributes } from 'react';
|
||||
import { type InputHTMLAttributes, type TextareaHTMLAttributes, useId } from 'react';
|
||||
import { cn } from '$shared/lib';
|
||||
|
||||
interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
|
||||
|
||||
Reference in New Issue
Block a user