[Init] Initial commit - NetMesh terminal manager
Some checks failed
build-packages / resolve bundled mosh-client (push) Has been cancelled
build-packages / resolve bundled et-client (push) Has been cancelled
build-packages / build-macos (push) Has been cancelled
build-packages / build-windows (push) Has been cancelled
build-packages / build-linux-x64 (push) Has been cancelled
build-packages / build-linux-arm64 (push) Has been cancelled
build-packages / release (push) Has been cancelled
build-packages / update Nix release metadata (push) Has been cancelled
build-packages / bump homebrew tap (push) Has been cancelled
test / lint-and-test (push) Has been cancelled
AI automation / Route event (push) Has been cancelled
AI automation / Hand reopened issue to maintainers (push) Has been cancelled
AI automation / Clean source issue state (push) Has been cancelled
AI automation / Reconcile handoffs (push) Has been cancelled
AI automation / Classify issue (push) Has been cancelled
AI automation / Claude Code smoke (push) Has been cancelled
AI automation / Review issue follow-up (push) Has been cancelled
AI automation / Publish issue follow-up (push) Has been cancelled
AI automation / Implement with Claude Code (push) Has been cancelled
AI automation / Publish implement PR (push) Has been cancelled
AI automation / Continue queued issue comments (push) Has been cancelled
AI automation / Codex review loop (push) Has been cancelled
AI automation / Publish Codex fix (push) Has been cancelled
AI automation / Clear Codex dispatch marker (push) Has been cancelled
AI automation / Own PR re-request Codex (push) Has been cancelled
AI automation / External PR re-request Codex (push) Has been cancelled
AI automation / Poll Codex reaction / retry (push) Has been cancelled
build-et-binaries / build-linux-x64 (push) Has been cancelled
build-et-binaries / build-linux-arm64 (push) Has been cancelled
build-et-binaries / build-macos-universal (push) Has been cancelled
build-et-binaries / build-windows-x64 (push) Has been cancelled
build-et-binaries / release (push) Has been cancelled
Some checks failed
build-packages / resolve bundled mosh-client (push) Has been cancelled
build-packages / resolve bundled et-client (push) Has been cancelled
build-packages / build-macos (push) Has been cancelled
build-packages / build-windows (push) Has been cancelled
build-packages / build-linux-x64 (push) Has been cancelled
build-packages / build-linux-arm64 (push) Has been cancelled
build-packages / release (push) Has been cancelled
build-packages / update Nix release metadata (push) Has been cancelled
build-packages / bump homebrew tap (push) Has been cancelled
test / lint-and-test (push) Has been cancelled
AI automation / Route event (push) Has been cancelled
AI automation / Hand reopened issue to maintainers (push) Has been cancelled
AI automation / Clean source issue state (push) Has been cancelled
AI automation / Reconcile handoffs (push) Has been cancelled
AI automation / Classify issue (push) Has been cancelled
AI automation / Claude Code smoke (push) Has been cancelled
AI automation / Review issue follow-up (push) Has been cancelled
AI automation / Publish issue follow-up (push) Has been cancelled
AI automation / Implement with Claude Code (push) Has been cancelled
AI automation / Publish implement PR (push) Has been cancelled
AI automation / Continue queued issue comments (push) Has been cancelled
AI automation / Codex review loop (push) Has been cancelled
AI automation / Publish Codex fix (push) Has been cancelled
AI automation / Clear Codex dispatch marker (push) Has been cancelled
AI automation / Own PR re-request Codex (push) Has been cancelled
AI automation / External PR re-request Codex (push) Has been cancelled
AI automation / Poll Codex reaction / retry (push) Has been cancelled
build-et-binaries / build-linux-x64 (push) Has been cancelled
build-et-binaries / build-linux-arm64 (push) Has been cancelled
build-et-binaries / build-macos-universal (push) Has been cancelled
build-et-binaries / build-windows-x64 (push) Has been cancelled
build-et-binaries / release (push) Has been cancelled
This commit is contained in:
62
components/SnippetScriptEditor.test.ts
Normal file
62
components/SnippetScriptEditor.test.ts
Normal file
@@ -0,0 +1,62 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import { readFileSync } from 'node:fs';
|
||||
import test from 'node:test';
|
||||
|
||||
const snippetEditorSource = readFileSync(
|
||||
new URL('./snippets/SnippetScriptEditor.tsx', import.meta.url),
|
||||
'utf8',
|
||||
);
|
||||
const codeEditorSource = readFileSync(
|
||||
new URL('./scripts/ScriptCodeEditor.tsx', import.meta.url),
|
||||
'utf8',
|
||||
);
|
||||
|
||||
test('snippet editing uses the Monaco editor in both inline and expanded layouts', () => {
|
||||
assert.doesNotMatch(snippetEditorSource, /CodeTextarea/);
|
||||
assert.equal(snippetEditorSource.match(/<ScriptCodeEditor\s/g)?.length, 2);
|
||||
assert.equal(snippetEditorSource.match(/language="shell"/g)?.length, 2);
|
||||
assert.equal(snippetEditorSource.match(/placeholder=\{placeholder\}/g)?.length, 2);
|
||||
});
|
||||
|
||||
test('inline snippet editing preserves form focus behavior', () => {
|
||||
assert.match(snippetEditorSource, /inlineEditorRef\.current\?\.focus\(\)/);
|
||||
assert.match(snippetEditorSource, /\sref=\{inlineEditorRef\}/);
|
||||
assert.match(snippetEditorSource, /\stabFocusMode(?:\s|\n)/);
|
||||
assert.match(codeEditorSource, /tabFocusMode,/);
|
||||
});
|
||||
|
||||
test('snippet editor forwards the surrounding form submit shortcut', () => {
|
||||
assert.equal(snippetEditorSource.match(/onSubmitShortcut=\{onSubmitShortcut\}/g)?.length, 2);
|
||||
assert.match(codeEditorSource, /if \(onSubmitShortcut\)/);
|
||||
assert.match(codeEditorSource, /KeyMod\.CtrlCmd \| monacoInstance\.KeyCode\.Enter/);
|
||||
assert.match(codeEditorSource, /onSubmitShortcutRef\.current\?\.\(\)/);
|
||||
});
|
||||
|
||||
test('dialog submit handlers ignore shortcuts already handled by Monaco', () => {
|
||||
const quickAddSource = readFileSync(new URL('./QuickAddSnippetDialog.tsx', import.meta.url), 'utf8');
|
||||
const tmuxSource = readFileSync(
|
||||
new URL('./systemManager/TmuxNewSessionModal.tsx', import.meta.url),
|
||||
'utf8',
|
||||
);
|
||||
assert.match(quickAddSource, /if \(e\.defaultPrevented\) return/);
|
||||
assert.match(tmuxSource, /if \(e\.defaultPrevented\) return/);
|
||||
});
|
||||
|
||||
test('visual placeholder is hidden from assistive technology', () => {
|
||||
assert.match(codeEditorSource, /<span\s+aria-hidden/);
|
||||
});
|
||||
|
||||
test('script code editor restores Electron clipboard paste for Cmd/Ctrl+V and native right-click', () => {
|
||||
assert.match(codeEditorSource, /useClipboardBackend/);
|
||||
assert.match(codeEditorSource, /readClipboardTextWithFallbacks/);
|
||||
assert.match(codeEditorSource, /buildMonacoPasteEdits/);
|
||||
assert.match(codeEditorSource, /KeyMod\.CtrlCmd \| monacoInstance\.KeyCode\.KeyV/);
|
||||
assert.match(codeEditorSource, /contextmenu:\s*false/);
|
||||
assert.match(codeEditorSource, /editor\.action\.clipboardPasteAction/);
|
||||
});
|
||||
|
||||
test('script code editor pastes into Monaco find widget instead of script body', () => {
|
||||
assert.match(codeEditorSource, /pasteForMonacoEditorCommand/);
|
||||
assert.match(codeEditorSource, /activeElement:\s*document\.activeElement/);
|
||||
assert.match(codeEditorSource, /pasteIntoEditor:\s*\(\)\s*=>\s*handlePasteRef\.current\(\)/);
|
||||
});
|
||||
Reference in New Issue
Block a user