Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / input / option-page-up-down.html
blob8d567835f9699e109d742839cab7577a0ed12c48
1 <head>
2 <script src="../../resources/ahem.js"></script>
3 <style type="text/css">
4 .ahem { font: 20px Ahem; }
5 </style>
6 <script>
7 if (window.testRunner)
8 testRunner.dumpAsText();
10 function runTest() {
11 runFrameCursorMoveTest();
12 runDivCursorMoveTest();
15 function generateContent() {
16 var content = "";
17 for (var i = 0; i < 10; ++i)
18 content += "<p>line " + i + "</p>\n";
19 return content;
22 function runFrameCursorMoveTest() {
23 var frame = frames[0];
24 var doc = frame.document;
25 var body = doc.body;
26 body.innerHTML = generateContent();
27 frame.focus();
28 frame.getSelection().collapse(body.firstChild, 0);
29 runCursorMoveTest("iframe", frame, frame);
32 function runDivCursorMoveTest() {
33 var editable = document.getElementById('editable');
34 editable.innerHTML = generateContent();
35 editable.focus();
36 window.getSelection().collapse(editable, 0);
37 runCursorMoveTest("div", editable, window);
40 function runCursorMoveTest(testName, frame, selectionSource)
42 var onMacPlatform = navigator.userAgent.search(/\bMac OS X\b/) != -1;
43 var modifiers = onMacPlatform ? ["altKey"] : [];
45 if (!window.eventSender)
46 return;
48 eventSender.keyDown("pageDown", modifiers);
49 var line = selectionSource.getSelection().baseNode.nodeValue;
50 if (line != "line 3")
51 throw "cursor should be at line 3, not " + line;
53 eventSender.keyDown("pageDown", modifiers);
54 var line = selectionSource.getSelection().baseNode.nodeValue;
55 if (line != "line 6")
56 throw "cursor should be at line 6, not " + line;
58 eventSender.keyDown("pageUp", modifiers);
59 var line = selectionSource.getSelection().baseNode.nodeValue;
60 if (line != "line 3")
61 throw "cursor should be at line 3, not " + line;
63 // Test that on Mac pageDown/pageUp does not move the cursor at all.
64 if (onMacPlatform) {
65 eventSender.keyDown("pageDown", []);
66 var line = selectionSource.getSelection().baseNode.nodeValue;
67 if (line != "line 3") {
68 document.getElementById("results").innerText = "cursor should be at line 3, not " + line;
69 throw "cursor should be at line 3, not " + line;
72 eventSender.keyDown("pageUp", []);
73 var line = selectionSource.getSelection().baseNode.nodeValue;
74 if (line != "line 3") {
75 document.getElementById("results").innerText = "cursor should be at line 3, not " + line;
76 throw "cursor should be at line 3, not " + line;
80 document.getElementById("results").innerHTML += testName + " PASS<br/>";
82 </script>
83 </head>
84 <body onload="runTest()">
85 <div>Page up/down (option+page up/down on Mac) should move the move cursor and scroll the content
86 in contenteditable elements. This sample covers cursor position move test of a) iframe element containing
87 contenteditable body, and b) content editable div element.</div>
88 <iframe src="../resources/contenteditable-iframe-fixed-size-src.html"></iframe>
89 <div id="editable" contenteditable="true" class="ahem" style="height:150px; overflow:auto;"></div>
90 <div id="results"></div>
91 </body>