webui: restore command+enter keyboard shortcut for diff comments
This used to exist. I missed it. Bring it back.
Co-Authored-By: sketch <hello@sketch.dev>
Change-ID: s6cd4f7fa81a2ee71k
diff --git a/webui/src/web-components/sketch-monaco-view.test.ts b/webui/src/web-components/sketch-monaco-view.test.ts
index 7366153..538fbaf 100644
--- a/webui/src/web-components/sketch-monaco-view.test.ts
+++ b/webui/src/web-components/sketch-monaco-view.test.ts
@@ -60,3 +60,29 @@
// The actual scroll preservation happens during runtime interactions
expect(true).toBe(true); // Test passes if component mounts successfully with fixes
});
+
+// Test keyboard shortcut functionality for comment submission
+test("Command+Enter and Ctrl+Enter keyboard shortcuts submit comments", async ({ mount }) => {
+ const component = await mount(CodeDiffEditor, {
+ props: {
+ originalCode: 'console.log("original");',
+ modifiedCode: 'console.log("modified");',
+ },
+ });
+
+ await expect(component).toBeVisible();
+
+ // Test that the keyboard shortcut handler exists
+ const hasKeyboardHandler = await component.evaluate((node) => {
+ const monacoView = node as any;
+
+ // Check if the handleCommentKeydown method exists
+ return typeof monacoView.handleCommentKeydown === 'function';
+ });
+
+ expect(hasKeyboardHandler).toBe(true);
+
+ // The actual keyboard event testing would require more complex setup
+ // with Monaco editor being fully loaded and comment UI being active.
+ // This test verifies the handler method is present.
+});