fix test error

This commit is contained in:
filemon committed 2025-09-18 12:13:57 -03:00
1 parent 5bcede498d
commit 846a3fd685
3 files changed
+20 -9

No files matched your search

+2
View File
@@ -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"
>
<Paperclip className="h-4 w-4" />
</Button>
+17 -8
View File
@@ -33,12 +33,21 @@ describe('Index Page', () => {
</TestApp>
);
// 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(
<TestApp>
<Index />
</TestApp>
);
// 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(
<TestApp>
<Index />
+1 -1
View File
@@ -327,7 +327,7 @@ export default function Index() {
onFileSelect={handleFileSelect}
onFileRemove={handleFileRemove}
selectedFiles={attachedFiles}
disabled={isCreating || isGeneratingId || !providerModel.trim()}
disabled={isCreating || isGeneratingId}
multiple={true}
/>