mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-06 08:37:22 +00:00
fix test error
This commit is contained in:
1 parent
5bcede498d
commit
846a3fd685
3 files changed
+20
-9
No files matched your search
@@ -66,6 +66,8 @@ export function FileAttachment({
|
|||||||
onClick={handleButtonClick}
|
onClick={handleButtonClick}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
className="h-8 w-8 p-0 rounded-full hover:bg-muted/50"
|
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" />
|
<Paperclip className="h-4 w-4" />
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -33,12 +33,21 @@ describe('Index Page', () => {
|
|||||||
</TestApp>
|
</TestApp>
|
||||||
);
|
);
|
||||||
|
|
||||||
// Look for the paperclip icon button which is part of FileAttachment
|
// Query the paperclip button by test id or aria label
|
||||||
const buttons = screen.getAllByRole('button');
|
const paperclipButton = screen.getByTestId('paperclip-button');
|
||||||
const paperclipButton = buttons.find(button =>
|
expect(paperclipButton).toBeInTheDocument();
|
||||||
button.querySelector('svg')?.getAttribute('data-lucide') === 'paperclip'
|
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();
|
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 textarea = screen.getByPlaceholderText('Please select a model below, then describe what you\'d like to build...');
|
||||||
const container = textarea.closest('div');
|
const container = textarea.closest('div');
|
||||||
|
|
||||||
expect(container).toBeInTheDocument();
|
expect(container).toBeInTheDocument();
|
||||||
|
|
||||||
// Verify the container can handle drag events by checking if it's interactive
|
// Verify the container can handle drag events by checking if it's interactive
|
||||||
expect(container).toHaveClass('relative', 'rounded-2xl', 'border', 'border-input');
|
expect(container).toHaveClass('relative', 'rounded-2xl', 'border', 'border-input');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('enables create button when text prompt is provided and model is selected', async () => {
|
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);
|
const user = await import('@testing-library/user-event').then(mod => mod.userEvent);
|
||||||
|
|
||||||
render(
|
render(
|
||||||
<TestApp>
|
<TestApp>
|
||||||
<Index />
|
<Index />
|
||||||
|
|||||||
+1
-1
@@ -327,7 +327,7 @@ export default function Index() {
|
|||||||
onFileSelect={handleFileSelect}
|
onFileSelect={handleFileSelect}
|
||||||
onFileRemove={handleFileRemove}
|
onFileRemove={handleFileRemove}
|
||||||
selectedFiles={attachedFiles}
|
selectedFiles={attachedFiles}
|
||||||
disabled={isCreating || isGeneratingId || !providerModel.trim()}
|
disabled={isCreating || isGeneratingId}
|
||||||
multiple={true}
|
multiple={true}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user