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

Side by Side Diff: third_party/WebKit/LayoutTests/inspector/editor/text-editor-home-button.html

Issue 2493373002: DevTools: rename WebInspector into modules. (Closed)
Patch Set: for bots Created 4 years, 1 month 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
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 6
7 function test() 7 function test()
8 { 8 {
9 function foo() 9 function foo()
10 { 10 {
11 return 42; 11 return 42;
12 } 12 }
13 var textEditor = InspectorTest.createTestEditor(); 13 var textEditor = InspectorTest.createTestEditor();
14 textEditor.setMimeType("text/javascript"); 14 textEditor.setMimeType("text/javascript");
15 textEditor.setReadOnly(false); 15 textEditor.setReadOnly(false);
16 textEditor.element.focus(); 16 textEditor.element.focus();
17 17
18 textEditor.setText(foo.toString()); 18 textEditor.setText(foo.toString());
19 19
20 InspectorTest.addResult(textEditor.text()); 20 InspectorTest.addResult(textEditor.text());
21 21
22 function homeButton(shift, callback) 22 function homeButton(shift, callback)
23 { 23 {
24 var key = WebInspector.isMac() ? "ArrowLeft" : "Home"; 24 var key = Host.isMac() ? "ArrowLeft" : "Home";
25 var modifiers = WebInspector.isMac() ? ["metaKey"] : []; 25 var modifiers = Host.isMac() ? ["metaKey"] : [];
26 if (shift) 26 if (shift)
27 modifiers.push("shiftKey"); 27 modifiers.push("shiftKey");
28 InspectorTest.fakeKeyEvent(textEditor, key, modifiers, callback); 28 InspectorTest.fakeKeyEvent(textEditor, key, modifiers, callback);
29 } 29 }
30 30
31 function hitHomeButton(shift, times, callback) 31 function hitHomeButton(shift, times, callback)
32 { 32 {
33 function hitButtonCallback() 33 function hitButtonCallback()
34 { 34 {
35 --times; 35 --times;
36 InspectorTest.dumpTextWithSelection(textEditor); 36 InspectorTest.dumpTextWithSelection(textEditor);
37 if (times > 0) { 37 if (times > 0) {
38 homeButton(shift, hitButtonCallback); 38 homeButton(shift, hitButtonCallback);
39 return; 39 return;
40 } 40 }
41 callback(); 41 callback();
42 } 42 }
43 homeButton(shift, hitButtonCallback); 43 homeButton(shift, hitButtonCallback);
44 } 44 }
45 45
46 InspectorTest.runTestSuite([ 46 InspectorTest.runTestSuite([
47 function testFirstNonBlankCharacter(next) 47 function testFirstNonBlankCharacter(next)
48 { 48 {
49 var selection = WebInspector.TextRange.createFromLocation(2, 8); 49 var selection = Common.TextRange.createFromLocation(2, 8);
50 textEditor.setSelection(selection); 50 textEditor.setSelection(selection);
51 InspectorTest.dumpTextWithSelection(textEditor); 51 InspectorTest.dumpTextWithSelection(textEditor);
52 hitHomeButton(false, 1, next); 52 hitHomeButton(false, 1, next);
53 }, 53 },
54 54
55 function testFirstNonBlankCharacterFromWhitespace(next) 55 function testFirstNonBlankCharacterFromWhitespace(next)
56 { 56 {
57 var selection = WebInspector.TextRange.createFromLocation(2, 2); 57 var selection = Common.TextRange.createFromLocation(2, 2);
58 textEditor.setSelection(selection); 58 textEditor.setSelection(selection);
59 InspectorTest.dumpTextWithSelection(textEditor); 59 InspectorTest.dumpTextWithSelection(textEditor);
60 hitHomeButton(false, 1, next); 60 hitHomeButton(false, 1, next);
61 }, 61 },
62 62
63 function testHomeButtonToggling(next) 63 function testHomeButtonToggling(next)
64 { 64 {
65 var selection = WebInspector.TextRange.createFromLocation(2, 2); 65 var selection = Common.TextRange.createFromLocation(2, 2);
66 textEditor.setSelection(selection); 66 textEditor.setSelection(selection);
67 InspectorTest.dumpTextWithSelection(textEditor); 67 InspectorTest.dumpTextWithSelection(textEditor);
68 hitHomeButton(false, 3, next); 68 hitHomeButton(false, 3, next);
69 }, 69 },
70 70
71 function testHomeButtonDoesNotChangeCursor(next) 71 function testHomeButtonDoesNotChangeCursor(next)
72 { 72 {
73 var selection = WebInspector.TextRange.createFromLocation(0, 2); 73 var selection = Common.TextRange.createFromLocation(0, 2);
74 textEditor.setSelection(selection); 74 textEditor.setSelection(selection);
75 InspectorTest.dumpTextWithSelection(textEditor); 75 InspectorTest.dumpTextWithSelection(textEditor);
76 hitHomeButton(false, 2, next); 76 hitHomeButton(false, 2, next);
77 }, 77 },
78 78
79 function testHomeButtonWithShift(next) 79 function testHomeButtonWithShift(next)
80 { 80 {
81 var selection = new WebInspector.TextRange(0, 0, 2, 8); 81 var selection = new Common.TextRange(0, 0, 2, 8);
82 textEditor.setSelection(selection); 82 textEditor.setSelection(selection);
83 InspectorTest.dumpTextWithSelection(textEditor); 83 InspectorTest.dumpTextWithSelection(textEditor);
84 hitHomeButton(true, 3, next); 84 hitHomeButton(true, 3, next);
85 }, 85 },
86 86
87 function testHomeButtonWithShiftInversed(next) 87 function testHomeButtonWithShiftInversed(next)
88 { 88 {
89 var selection = new WebInspector.TextRange(3, 1, 2, 8); 89 var selection = new Common.TextRange(3, 1, 2, 8);
90 textEditor.setSelection(selection); 90 textEditor.setSelection(selection);
91 InspectorTest.dumpTextWithSelection(textEditor); 91 InspectorTest.dumpTextWithSelection(textEditor);
92 hitHomeButton(true, 3, next); 92 hitHomeButton(true, 3, next);
93 } 93 }
94 ]); 94 ]);
95 } 95 }
96 96
97 </script> 97 </script>
98 </head> 98 </head>
99 99
100 <body onload="runTest();"> 100 <body onload="runTest();">
101 <p> 101 <p>
102 This test verifies that home button triggers selection between first symbol of t he line 102 This test verifies that home button triggers selection between first symbol of t he line
103 and first non-blank symbol of the line. 103 and first non-blank symbol of the line.
104 </p> 104 </p>
105 105
106 </body> 106 </body>
107 </html> 107 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698