mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-11-20 04:59:34 +01:00
fix(mobile): the clear-line key discards a Send on Enter draft
clear({ discard: true }) skips the owner stash, drops any older stash of
the owner and keeps the owner; clearTerminalInput() (the keyboard bar's
clear-line key) uses it, so a cleared draft does not come back on a
same-tab reload or a switch back. @fileoverview gains a Send on Enter
section.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
673a656538
commit
387cb830f4
3 files changed
+64
-10
No files matched your search
@@ -428,6 +428,36 @@ describe('CJK input: Send on Enter', () => {
|
||||
expect(sent).toEqual([]);
|
||||
});
|
||||
|
||||
it('clear({ discard }) throws the draft away: a same-tab restore and a switch back stay empty', () => {
|
||||
// The keyboard bar's clear-line key (terminal-ui.js clearTerminalInput).
|
||||
const { CjkInput, textarea } = load();
|
||||
CjkInput.restoreDraft('session-a');
|
||||
type(textarea, 'thrown away');
|
||||
CjkInput.clear({ discard: true });
|
||||
expect(textarea.value).toBe(PHANTOM);
|
||||
expect(CjkInput.draftOwner).toBe('session-a');
|
||||
// Tapping the session's own tab: the field is kept, then restoreDraft runs.
|
||||
CjkInput.restoreDraft('session-a');
|
||||
expect(textarea.value).toBe(PHANTOM);
|
||||
// Switching away and back.
|
||||
CjkInput.clear();
|
||||
CjkInput.restoreDraft('session-b');
|
||||
CjkInput.clear();
|
||||
CjkInput.restoreDraft('session-a');
|
||||
expect(textarea.value).toBe(PHANTOM);
|
||||
});
|
||||
|
||||
it('clear({ discard }) also drops an older stash of the same session', () => {
|
||||
const { CjkInput, textarea } = load();
|
||||
CjkInput.restoreDraft('session-a');
|
||||
type(textarea, 'old');
|
||||
CjkInput.stashDraft('session-a');
|
||||
CjkInput.clear({ discard: true });
|
||||
CjkInput.clear();
|
||||
CjkInput.restoreDraft('session-a');
|
||||
expect(textarea.value).toBe(PHANTOM);
|
||||
});
|
||||
|
||||
it('a removed session loses its field text: discardDraft drops the owner', () => {
|
||||
const { CjkInput, textarea } = load();
|
||||
CjkInput.restoreDraft('session-a');
|
||||
|
||||
Reference in new issue
Block a user