diff --git a/src/components/ui/file-attachment.tsx b/src/components/ui/file-attachment.tsx
index 780c3b4a..f470e570 100644
--- a/src/components/ui/file-attachment.tsx
+++ b/src/components/ui/file-attachment.tsx
@@ -66,6 +66,8 @@ export function FileAttachment({
onClick={handleButtonClick}
disabled={disabled}
className="h-8 w-8 p-0 rounded-full hover:bg-muted/50"
+ aria-label="Attach files"
+ data-testid="paperclip-button"
>
diff --git a/src/pages/Index.test.tsx b/src/pages/Index.test.tsx
index 2653863b..1d9cb84b 100644
--- a/src/pages/Index.test.tsx
+++ b/src/pages/Index.test.tsx
@@ -33,12 +33,21 @@ describe('Index Page', () => {
);
- // Look for the paperclip icon button which is part of FileAttachment
- const buttons = screen.getAllByRole('button');
- const paperclipButton = buttons.find(button =>
- button.querySelector('svg')?.getAttribute('data-lucide') === 'paperclip'
+ // Query the paperclip button by test id or aria label
+ const paperclipButton = screen.getByTestId('paperclip-button');
+ expect(paperclipButton).toBeInTheDocument();
+ expect(paperclipButton).toHaveAttribute('aria-label', 'Attach files');
+ });
+
+ it('shows FileAttachment component by role and name', () => {
+ render(
+
+
+
);
-
+
+ // Query the paperclip button by role and aria-label
+ const paperclipButton = screen.getByRole('button', { name: /attach files/i });
expect(paperclipButton).toBeInTheDocument();
});
@@ -51,16 +60,16 @@ describe('Index Page', () => {
const textarea = screen.getByPlaceholderText('Please select a model below, then describe what you\'d like to build...');
const container = textarea.closest('div');
-
+
expect(container).toBeInTheDocument();
-
+
// Verify the container can handle drag events by checking if it's interactive
expect(container).toHaveClass('relative', 'rounded-2xl', 'border', 'border-input');
});
it('enables create button when text prompt is provided and model is selected', async () => {
const user = await import('@testing-library/user-event').then(mod => mod.userEvent);
-
+
render(
diff --git a/src/pages/Index.tsx b/src/pages/Index.tsx
index e8c17ce8..a11abff9 100644
--- a/src/pages/Index.tsx
+++ b/src/pages/Index.tsx
@@ -327,7 +327,7 @@ export default function Index() {
onFileSelect={handleFileSelect}
onFileRemove={handleFileRemove}
selectedFiles={attachedFiles}
- disabled={isCreating || isGeneratingId || !providerModel.trim()}
+ disabled={isCreating || isGeneratingId}
multiple={true}
/>