Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / selectstart-by-arrow-keys-prevent-default.html
blob702b9fda2f77c8b60a6b96ac0565fbc1d93e6cd2
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <p>This test ensures selectstart event fires when selection is created by arrow key and script can prevent the selection change.</p>
5 If running this test manually, click on the div ("Hello World") and try to select the text using arrow keys.<br>
6 Expected result: SelectStart event will fire when user starts extending the selection, but due to script preventDefault it prevents the selection change.<br>
7 <div contenteditable>Hello World</div>
8 <script>
11 var selectStartCount = 0;
12 var div = document.getElementsByTagName('div')[0];
13 div.addEventListener('selectstart', function (event) { event.preventDefault(); selectStartCount++; });
14 div.focus();
15 window.getSelection().collapse(div.firstChild, 1);
17 if (window.testRunner) {
18 testRunner.dumpAsText();
19 eventSender.keyDown("rightArrow", ["shiftKey"]);
20 logResult("Check Right arrow + Shift", 1);
22 eventSender.keyDown("rightArrow", ["shiftKey"], ["ctrlKey"]);
23 logResult("Check Right arrow + Shift + Control", 2);
25 eventSender.keyDown("end", ["shiftKey"]);
26 logResult("Check End + Shift", 3);
29 function logResult(title, expectedCount) {
30 var range = window.getSelection().getRangeAt(0);
31 document.write(title + ': ');
32 if (selectStartCount != expectedCount)
33 document.write('FAIL - expected ' + expectedCount + ' events but got ' + selectStartCount + ' events');
34 else if (range.startOffset != 1 || range.endOffset != 1)
35 document.write('FAIL - selection changed');
36 else
37 document.write('PASS');
38 document.write('<br>');
41 </script>
42 </body>
43 </html>