Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: LayoutTests/inspector/editor/text-editor-word-jumps.html

Issue 357483007: DevTools: [CodeMirror] add support for camel case movements. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: use nice naming for shift-movement Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | LayoutTests/inspector/editor/text-editor-word-jumps-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <html> 1 <html>
2 <head> 2 <head>
3 <script src="../../http/tests/inspector/inspector-test.js"></script> 3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="editor-test.js"></script> 4 <script src="editor-test.js"></script>
5 <script> 5 <script>
6 function test() 6 function test()
7 { 7 {
8 function testFunction(foo, bar) 8 function testFunction(foo, bar)
9 { 9 {
10 someFunctionCall(bar); 10 someFunctionCall(bar);
11 var b = 42; 11 var b = 42;
12 return a === 1 ? true : false; 12 return a === 1 ? true : false;
13 } 13 }
14 14
15 function testMyCamelMove(foo, bar)
16 {
17 /* HelloWorld.TestSTRIng */
18
19 var a = e === 2;
20 {}
21 }
22
15 var textEditor = InspectorTest.createTestEditor(); 23 var textEditor = InspectorTest.createTestEditor();
16 textEditor.setMimeType("text/javascript"); 24 textEditor.setMimeType("text/javascript");
17 textEditor.setReadOnly(false); 25 textEditor.setReadOnly(false);
18 textEditor.setText(testFunction.toString()); 26 textEditor.setText(testFunction.toString());
19 textEditor.element.focus(); 27 textEditor.element.focus();
20 28
21 InspectorTest.addResult(textEditor.text()); 29 InspectorTest.addResult(textEditor.text());
22 const wordJumpModifier = WebInspector.isMac() ? "altKey" : "ctrlKey"; 30 const wordJumpModifier = WebInspector.isMac() ? "altKey" : "ctrlKey";
31 const camelJumpModifier = WebInspector.isMac() ? "ctrlKey" : "altKey";
23 32
24 function dumpEditorSelection() 33 function dumpEditorSelection()
25 { 34 {
26 var selection = textEditor.selection(); 35 var selection = textEditor.selection();
27 if (selection.isEmpty()) { 36 if (selection.isEmpty()) {
28 var line = textEditor.line(selection.startLine); 37 var line = textEditor.line(selection.startLine);
29 InspectorTest.addResult(line.substring(0, selection.startColumn) + " |" + line.substring(selection.startColumn)); 38 InspectorTest.addResult(line.substring(0, selection.startColumn) + " |" + line.substring(selection.startColumn));
30 } else { 39 } else {
31 InspectorTest.addResult(">>" + textEditor.copyRange(selection.normal ize()) + "<<"); 40 InspectorTest.addResult(">>" + textEditor.copyRange(selection.normal ize()) + "<<");
32 } 41 }
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 function eventCallback() 108 function eventCallback()
100 { 109 {
101 InspectorTest.addResult("==============="); 110 InspectorTest.addResult("===============");
102 InspectorTest.addResult(textEditor.text() + "<<"); 111 InspectorTest.addResult(textEditor.text() + "<<");
103 if (textEditor.text() !== "") 112 if (textEditor.text() !== "")
104 InspectorTest.fakeKeyEvent(textEditor, "\b", [wordJumpModifi er], eventCallback); 113 InspectorTest.fakeKeyEvent(textEditor, "\b", [wordJumpModifi er], eventCallback);
105 else 114 else
106 next(); 115 next();
107 } 116 }
108 InspectorTest.fakeKeyEvent(textEditor, "\b", [wordJumpModifier], eve ntCallback); 117 InspectorTest.fakeKeyEvent(textEditor, "\b", [wordJumpModifier], eve ntCallback);
118 },
119
120 function testAltRight(next)
121 {
122 InspectorTest.addResult("====== CAMEL CASE MOVEMENTS ======");
123 textEditor.setText(testMyCamelMove.toString());
124 setCursorAtBeginning();
125 dumpEditorSelection();
126 fireEventWhileSelectionChanges("rightArrow", [camelJumpModifier], ne xt);
127 },
128
129 function testAltLeft(next)
130 {
131 setCursorAtEnd();
132 dumpEditorSelection();
133 fireEventWhileSelectionChanges("leftArrow", [camelJumpModifier], nex t);
134 },
135
136 function testAltShiftRight(next)
137 {
138 setCursorAtBeginning();
139 dumpEditorSelection();
140 fireEventWhileSelectionChanges("rightArrow", [camelJumpModifier, "sh iftKey"], next);
141 },
142
143 function testAltShiftLeft(next)
144 {
145 setCursorAtEnd();
146 dumpEditorSelection();
147 fireEventWhileSelectionChanges("leftArrow", [camelJumpModifier, "shi ftKey"], next);
109 } 148 }
110 ]); 149 ]);
111 150
112 } 151 }
113 152
114 </script> 153 </script>
115 </head> 154 </head>
116 155
117 <body onload="runTest();"> 156 <body onload="runTest();">
118 <p> 157 <p>
119 This test checks how text editor handles different ctrl-based movements, i.e. ct rl-left, ctrl-right, ctrl-shift-left, ctrl-backspace. 158 This test checks how text editor handles different movements: ctrl-left, ctrl-ri ght, ctrl-shift-left, ctrl-backspace, alt-left, alt-right, alt-shift-left, alt-s hift-right.
120 </p> 159 </p>
121 160
122 </body> 161 </body>
123 </html> 162 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/inspector/editor/text-editor-word-jumps-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698