mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-11-21 23:43:35 +00:00
⏎ fix: Restore Enter to Send as the Default (#17374)
Some checks are pending
Backend Unit Tests / Build packages (push) Waiting to run
Backend Unit Tests / Codegraph select (push) Waiting to run
Backend Unit Tests / TypeScript type checks (push) Blocked by required conditions
Backend Unit Tests / Circular dependency checks (push) Waiting to run
Backend Unit Tests / Tests: api (shard 1/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 2/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 3/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: data-provider (push) Blocked by required conditions
Backend Unit Tests / Tests: data-schemas (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 1/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 2/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 3/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 4/4) (push) Blocked by required conditions
Codegraph E2E Votes / vote (shard 1/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 10/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 2/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 3/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 4/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 5/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 6/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 7/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 8/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 9/10) (push) Waiting to run
Docker Dev Branch Images Build / publish (push) Waiting to run
Frontend Unit Tests / Client build recovery regression (push) Waiting to run
Frontend Unit Tests / Codegraph select (push) Waiting to run
Frontend Unit Tests / Build packages (push) Waiting to run
Frontend Unit Tests / TypeScript type checks (client) (push) Blocked by required conditions
Frontend Unit Tests / Tests: @librechat/chat (push) Blocked by required conditions
Frontend Unit Tests / Tests: @librechat/client (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 1/2) (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 2/2) (push) Blocked by required conditions
Frontend Unit Tests / Vite build verification (push) Blocked by required conditions
Some checks are pending
Backend Unit Tests / Build packages (push) Waiting to run
Backend Unit Tests / Codegraph select (push) Waiting to run
Backend Unit Tests / TypeScript type checks (push) Blocked by required conditions
Backend Unit Tests / Circular dependency checks (push) Waiting to run
Backend Unit Tests / Tests: api (shard 1/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 2/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 3/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: data-provider (push) Blocked by required conditions
Backend Unit Tests / Tests: data-schemas (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 1/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 2/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 3/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 4/4) (push) Blocked by required conditions
Codegraph E2E Votes / vote (shard 1/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 10/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 2/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 3/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 4/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 5/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 6/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 7/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 8/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 9/10) (push) Waiting to run
Docker Dev Branch Images Build / publish (push) Waiting to run
Frontend Unit Tests / Client build recovery regression (push) Waiting to run
Frontend Unit Tests / Codegraph select (push) Waiting to run
Frontend Unit Tests / Build packages (push) Waiting to run
Frontend Unit Tests / TypeScript type checks (client) (push) Blocked by required conditions
Frontend Unit Tests / Tests: @librechat/chat (push) Blocked by required conditions
Frontend Unit Tests / Tests: @librechat/client (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 1/2) (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 2/2) (push) Blocked by required conditions
Frontend Unit Tests / Vite build verification (push) Blocked by required conditions
* fix: Restore Enter to Send as the Default Composer Behavior * test: Cover the Enter to Send Default in E2E Scenarios
This commit is contained in:
parent
76e3c6b134
commit
cd6edcea74
11 changed files with 100 additions and 38 deletions
|
|
@ -1065,9 +1065,9 @@ function ChatFormWrapper({
|
|||
project,
|
||||
routePending = false,
|
||||
isLandingPage,
|
||||
/** Enter sends unless told otherwise, so call sites that predate this prop,
|
||||
* mainly tests, keep their prior behavior without passing it explicitly.
|
||||
* ChatView always passes the user's preference, whose default is false. */
|
||||
/** Defaults to the atom's own default (`atomWithLocalStorage('enterToSend',
|
||||
* true)`) so call sites that predate this prop, mainly tests, keep their
|
||||
* prior behavior without passing it explicitly. */
|
||||
enterToSend = true,
|
||||
/** Same reason, from `atomWithLocalStorage('autoSendText', -1)`. */
|
||||
autoSendText = -1,
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ const conversation = {
|
|||
} as TConversation;
|
||||
|
||||
/**
|
||||
* The atom keeps its default (`atomWithLocalStorage('enterToSend', false)`)
|
||||
* The atom keeps its default (`atomWithLocalStorage('enterToSend', true)`)
|
||||
* here: these tests prove the composer follows the `enterToSend` prop ChatView
|
||||
* passes it, not the atom it used to read directly, so each value is covered.
|
||||
*/
|
||||
|
|
@ -116,7 +116,7 @@ describe('ChatForm enterToSend prop', () => {
|
|||
localStorage.clear();
|
||||
});
|
||||
|
||||
test('follows the prop when it agrees with the persisted default', async () => {
|
||||
test('follows the prop when it disagrees with the persisted default', async () => {
|
||||
renderComposer({ enterToSend: false });
|
||||
|
||||
const textarea = await screen.findByTestId('text-input');
|
||||
|
|
@ -128,7 +128,7 @@ describe('ChatForm enterToSend prop', () => {
|
|||
expect(hint).not.toHaveTextContent('Enter to send');
|
||||
}, 20000);
|
||||
|
||||
test('follows the prop when it disagrees with the persisted default', async () => {
|
||||
test('follows the prop when it agrees with the persisted default', async () => {
|
||||
renderComposer({ enterToSend: true });
|
||||
|
||||
const textarea = await screen.findByTestId('text-input');
|
||||
|
|
|
|||
|
|
@ -143,11 +143,11 @@ describe('ChatView composer preferences', () => {
|
|||
* reaching into app-global state the composer only consumes. ChatView now owns the
|
||||
* read and passes it down, the same boundary `showComposerTips` already follows. */
|
||||
test('reads the persisted enterToSend preference and passes it into ChatForm', () => {
|
||||
localStorage.setItem('enterToSend', JSON.stringify(true));
|
||||
localStorage.setItem('enterToSend', JSON.stringify(false));
|
||||
|
||||
render(<ChatView />);
|
||||
|
||||
expect(mockChatFormProps).toHaveBeenCalledWith(expect.objectContaining({ enterToSend: true }));
|
||||
expect(mockChatFormProps).toHaveBeenCalledWith(expect.objectContaining({ enterToSend: false }));
|
||||
});
|
||||
|
||||
/** The same boundary for the dictation preferences: ChatForm consumes them
|
||||
|
|
@ -170,7 +170,7 @@ describe('ChatView composer preferences', () => {
|
|||
test('falls back to the atom default when nothing is persisted', () => {
|
||||
render(<ChatView />);
|
||||
|
||||
expect(mockChatFormProps).toHaveBeenCalledWith(expect.objectContaining({ enterToSend: false }));
|
||||
expect(mockChatFormProps).toHaveBeenCalledWith(expect.objectContaining({ enterToSend: true }));
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@ describe('preference defaults with nothing persisted', () => {
|
|||
localStorage.clear();
|
||||
});
|
||||
|
||||
it('adds a newline on Enter instead of sending', () => {
|
||||
expect(readRecoil(settings.enterToSend)).toBe(false);
|
||||
it('sends on Enter', () => {
|
||||
expect(readRecoil(settings.enterToSend)).toBe(true);
|
||||
});
|
||||
|
||||
it('collapses long user messages', () => {
|
||||
|
|
@ -47,10 +47,10 @@ describe('persisted preferences', () => {
|
|||
localStorage.clear();
|
||||
});
|
||||
|
||||
it('keeps a saved Enter to send', () => {
|
||||
localStorage.setItem('enterToSend', JSON.stringify(true));
|
||||
it('keeps a saved opt-out of Enter to send', () => {
|
||||
localStorage.setItem('enterToSend', JSON.stringify(false));
|
||||
|
||||
expect(readRecoil(settings.enterToSend)).toBe(true);
|
||||
expect(readRecoil(settings.enterToSend)).toBe(false);
|
||||
});
|
||||
|
||||
it('keeps a saved opt-out of collapsing', () => {
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ const localStorageAtoms = {
|
|||
chatTitleInTab: atomWithLocalStorage(CHAT_TITLE_IN_TAB_KEY, true),
|
||||
|
||||
// Chat settings
|
||||
enterToSend: atomWithLocalStorage('enterToSend', false),
|
||||
enterToSend: atomWithLocalStorage('enterToSend', true),
|
||||
maximizeChatSpace: atomWithLocalStorage('maximizeChatSpace', false),
|
||||
autoExpandTools: atomWithLocalStorage(LocalStorageKeys.AUTO_EXPAND_TOOLS, false),
|
||||
saveDrafts: atomWithLocalStorage('saveDrafts', true),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue