Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / editor / text-editor-home-button.html
blob69e0c4c04a6cc4cc7d6ad5b87cc249c9fb9a0cfe
1 <html>
2 <head>
3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="editor-test.js"></script>
5 <script>
7 function test()
9 function foo()
11 return 42;
13 var textEditor = InspectorTest.createTestEditor();
14 textEditor.setMimeType("text/javascript");
15 textEditor.setReadOnly(false);
16 textEditor.element.focus();
18 textEditor.setText(foo.toString());
20 InspectorTest.addResult(textEditor.text());
22 function homeButton(shift, callback)
24 var key = WebInspector.isMac() ? "leftArrow" : "home";
25 var modifiers = WebInspector.isMac() ? ["metaKey"] : [];
26 if (shift)
27 modifiers.push("shiftKey");
28 InspectorTest.fakeKeyEvent(textEditor, key, modifiers, callback);
31 function hitHomeButton(shift, times, callback)
33 function hitButtonCallback()
35 --times;
36 InspectorTest.dumpTextWithSelection(textEditor);
37 if (times > 0) {
38 homeButton(shift, hitButtonCallback);
39 return;
41 callback();
43 homeButton(shift, hitButtonCallback);
46 InspectorTest.runTestSuite([
47 function testFirstNonBlankCharacter(next)
49 var selection = WebInspector.TextRange.createFromLocation(2, 8);
50 textEditor.setSelection(selection);
51 InspectorTest.dumpTextWithSelection(textEditor);
52 hitHomeButton(false, 1, next);
55 function testFirstNonBlankCharacterFromWhitespace(next)
57 var selection = WebInspector.TextRange.createFromLocation(2, 2);
58 textEditor.setSelection(selection);
59 InspectorTest.dumpTextWithSelection(textEditor);
60 hitHomeButton(false, 1, next);
63 function testHomeButtonToggling(next)
65 var selection = WebInspector.TextRange.createFromLocation(2, 2);
66 textEditor.setSelection(selection);
67 InspectorTest.dumpTextWithSelection(textEditor);
68 hitHomeButton(false, 3, next);
71 function testHomeButtonDoesNotChangeCursor(next)
73 var selection = WebInspector.TextRange.createFromLocation(0, 2);
74 textEditor.setSelection(selection);
75 InspectorTest.dumpTextWithSelection(textEditor);
76 hitHomeButton(false, 2, next);
79 function testHomeButtonWithShift(next)
81 var selection = new WebInspector.TextRange(0, 0, 2, 8);
82 textEditor.setSelection(selection);
83 InspectorTest.dumpTextWithSelection(textEditor);
84 hitHomeButton(true, 3, next);
87 function testHomeButtonWithShiftInversed(next)
89 var selection = new WebInspector.TextRange(3, 1, 2, 8);
90 textEditor.setSelection(selection);
91 InspectorTest.dumpTextWithSelection(textEditor);
92 hitHomeButton(true, 3, next);
94 ]);
97 </script>
98 </head>
100 <body onload="runTest();">
102 This test verifies that home button triggers selection between first symbol of the line
103 and first non-blank symbol of the line.
104 </p>
106 </body>
107 </html>