Skip to content

Commit 1a552fd

Browse files
Fix: update icon no longer enabled when chat history name remains unchanged (#491)
1 parent c749e03 commit 1a552fd

File tree

2 files changed

+26
-26
lines changed

2 files changed

+26
-26
lines changed

src/App/frontend/src/components/ChatHistory/ChatHistoryListItemCell.test.tsx

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -286,44 +286,44 @@ describe('ChatHistoryListItemCell', () => {
286286
await waitFor(() => expect(inputItem).not.toBeInTheDocument())
287287
})
288288

289-
test('handles rename save when the updated text is equal to initial text', async () => {
290-
userEvent.setup()
289+
// test('handles rename save when the updated text is equal to initial text', async () => {
290+
// userEvent.setup()
291291

292-
renderWithContext(<ChatHistoryListItemCell item={conversation} onSelect={mockOnSelect} />, mockAppState)
292+
// renderWithContext(<ChatHistoryListItemCell item={conversation} onSelect={mockOnSelect} />, mockAppState)
293293

294294
// Simulate hover to reveal Edit button
295-
const item = screen.getByLabelText('chat history item')
296-
fireEvent.mouseEnter(item)
295+
// const item = screen.getByLabelText('chat history item')
296+
// fireEvent.mouseEnter(item)
297297

298298
// Wait for the Edit button to appear and click it
299-
await waitFor(() => {
300-
const editButton = screen.getByTitle(/Edit/i)
301-
expect(editButton).toBeInTheDocument()
302-
fireEvent.click(editButton)
303-
})
299+
// await waitFor(() => {
300+
// const editButton = screen.getByTitle(/Edit/i)
301+
// expect(editButton).toBeInTheDocument()
302+
// fireEvent.click(editButton)
303+
// })
304304

305305
// Find the input field
306-
const inputItem = screen.getByPlaceholderText('Test Chat')
307-
expect(inputItem).toBeInTheDocument() // Ensure input is there
306+
// const inputItem = screen.getByPlaceholderText('Test Chat')
307+
// expect(inputItem).toBeInTheDocument() // Ensure input is there
308308

309-
await act(() => {
310-
userEvent.type(inputItem, 'Test Chat')
309+
// await act(() => {
310+
// userEvent.type(inputItem, 'Test Chat')
311311
//fireEvent.change(inputItem, { target: { value: 'Test Chat' } });
312-
})
312+
// })
313313

314-
userEvent.click(screen.getByRole('button', { name: 'confirm new title' }))
314+
// userEvent.click(screen.getByRole('button', { name: 'confirm new title' }))
315315

316-
await waitFor(() => {
317-
expect(screen.getByText(/Error: Enter a new title to proceed./i)).toBeInTheDocument()
318-
})
316+
// await waitFor(() => {
317+
// expect(screen.getByText(/Error: Enter a new title to proceed./i)).toBeInTheDocument()
318+
// })
319319

320320
// Wait for the error to be hidden after 5 seconds
321-
await waitFor(() => expect(screen.queryByText('Error: Enter a new title to proceed.')).not.toBeInTheDocument(), {
322-
timeout: 6000
323-
})
324-
const input = screen.getByLabelText('rename-input')
325-
expect(input).toHaveFocus()
326-
}, 10000)
321+
// await waitFor(() => expect(screen.queryByText('Error: Enter a new title to proceed.')).not.toBeInTheDocument(), {
322+
// timeout: 6000
323+
// })
324+
// const input = screen.getByLabelText('rename-input')
325+
// expect(input).toHaveFocus()
326+
// }, 10000)
327327

328328
test('Should hide the rename from when cancel it.', async () => {
329329
userEvent.setup()

src/App/frontend/src/components/ChatHistory/ChatHistoryListItemCell.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ export const ChatHistoryListItemCell: React.FC<ChatHistoryListItemCellProps> = (
206206
<Stack aria-label="action button group" horizontal verticalAlign={'center'}>
207207
<IconButton
208208
role="button"
209-
disabled={errorRename !== undefined}
209+
disabled={errorRename !== undefined || editTitle == item.title}
210210
onKeyDown={e => (e.key === ' ' || e.key === 'Enter' ? handleSaveEdit(e) : null)}
211211
onClick={e => handleSaveEdit(e)}
212212
aria-label="confirm new title"

0 commit comments

Comments
 (0)