mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 03:51:25 +00:00
fix: tui local shell consent UX (#1463)
- add local shell runner + denial notice + tests - docs: describe ! local shell usage - lint: drop unused Slack upload contentType - cleanup: remove stray Swabble pins Thanks @vignesh07. Co-authored-by: Vignesh Natarajan <vigneshnatarajan92@gmail.com>
This commit is contained in:
@@ -50,6 +50,29 @@ describe("createEditorSubmitHandler", () => {
|
||||
expect(sendMessage).toHaveBeenCalledWith("!");
|
||||
});
|
||||
|
||||
it("does not treat leading whitespace before ! as a bang command", () => {
|
||||
const editor = {
|
||||
setText: vi.fn(),
|
||||
addToHistory: vi.fn(),
|
||||
};
|
||||
const handleCommand = vi.fn();
|
||||
const sendMessage = vi.fn();
|
||||
const handleBangLine = vi.fn();
|
||||
|
||||
const onSubmit = createEditorSubmitHandler({
|
||||
editor,
|
||||
handleCommand,
|
||||
sendMessage,
|
||||
handleBangLine,
|
||||
});
|
||||
|
||||
onSubmit(" !ls");
|
||||
|
||||
expect(handleBangLine).not.toHaveBeenCalled();
|
||||
expect(sendMessage).toHaveBeenCalledWith("!ls");
|
||||
expect(editor.addToHistory).toHaveBeenCalledWith("!ls");
|
||||
});
|
||||
|
||||
it("trims normal messages before sending and adding to history", () => {
|
||||
const editor = {
|
||||
setText: vi.fn(),
|
||||
|
||||
Reference in New Issue
Block a user