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

Side by Side Diff: LayoutTests/editing/selection/readonly-disabled-text-selection.html

Issue 309553007: Adding support for Text Selection on Disabled and Readonly input elements in Android (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « no previous file | LayoutTests/platform/android/editing/selection/readonly-disabled-text-selection-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
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
esprehn 2014/10/17 21:55:54 Leave out html, head and body.
AKVT 2014/10/20 19:50:01 Done. Thanks you
4 <script src="../../resources/js-test.js"></script>
5 <script>
6 function test() {
esprehn 2014/10/17 21:55:55 onload = function() {
AKVT 2014/10/20 19:50:00 Done. Thanks
7 jsTestAsync = true;
esprehn 2014/10/17 21:55:54 remove.
AKVT 2014/10/20 19:50:01 Done.
8 if (window.testRunner)
9 testRunner.dumpAsText();
esprehn 2014/10/17 21:55:55 remove, js-test does this for you.
AKVT 2014/10/20 19:50:00 Done. Thanks
10
11 if (!window.eventSender)
esprehn 2014/10/17 21:55:54 combine with the check below.
AKVT 2014/10/20 19:50:01 Done.
12 return;
13
14 if (!window.eventSender.gestureLongPress) {
esprehn 2014/10/17 21:55:54 Why doesn't this work on Chrome OS with touch or a
AKVT 2014/10/20 19:50:01 Done. Thank you
15 debug("gestureLongPress not implemented by this platform.");
16 debug("Manullay long press on every element in the page and check whethe r Text selection is happening or not");
17 debug("If Text selection is not happening for readonly or disabled input /textarea, then it's a failure.");
18 return;
19 }
20
21 // Normal Text
esprehn 2014/10/17 21:55:54 these comments aren't adding value, they're the sa
AKVT 2014/10/20 19:50:01 Done.
22 doLongPressOnElement("normalText");
23
24 // ReadOnly Text
25 doLongPressOnElement("readOnlyText");
26
27 // Disabled Text
28 doLongPressOnElement("disabledText");
29
30 // ReadOnly and Disabled Text
31 doLongPressOnElement("readOnlyDisabledText");
32
33 // Normal TextArea
34 doLongPressOnElement("normalTextArea");
35
36 // ReadOnly TextArea
37 doLongPressOnElement("readOnlyTextArea");
38
39 // Disabled TextArea
40 doLongPressOnElement("disabledTextArea");
41
42 // ReadOnly and Disabled TextArea
43 doLongPressOnElement("readOnlyDisabledTextArea");
44
45 finishJSTest();
esprehn 2014/10/17 21:55:55 This test doesn't need to be async, you're just wa
AKVT 2014/10/20 19:50:00 Done.
46 }
47
48 function doLongPressOnElement(elementId) {
49 var element = document.getElementById(elementId);
50 var bounds = element.getBoundingClientRect();
51 var middleX = (bounds.left + bounds.right) / 2;
52 var middleY = (bounds.top + bounds.bottom) / 2;
53 // Touch directly in the center of the element.
54 window.eventSender.gestureLongPress(middleX, middleY);
55 var currentSelection = window.getSelection();
56 var selectedText = currentSelection.toString();
57 var elementValue = element.value;
58 if (selectedText == elementValue) {
esprehn 2014/10/17 21:55:54 Use shouldBeEqualToString(), don't reinvent it you
AKVT 2014/10/20 19:50:01 Done. Thank you
59 testPassed("Selected Text is " + selectedText);
60 }
61 else {
62 testFailed("Selected Text Should be " + elementValue + " instead of " + selectedText);
63 }
64 }
65 </script>
66 </head>
67 <body onload="test();">
esprehn 2014/10/17 21:55:54 remove.
AKVT 2014/10/20 19:50:00 Done.
68 <input id="normalText" type="text" value="NormalInput">
69 <input id="readOnlyText" type="text" value="ReadonlyInput" readonly>
70 <input id="disabledText" type="text" value="DisabledInput" disabled>
71 <input id="readOnlyDisabledText" size="20" type="text" value="ReadonlyDisabledIn put"readonly disabled>
72 <textarea id="normalTextArea" cols="31">NormalTextarea</textarea>
73 <textarea id="readOnlyTextArea" cols="31" readonly>ReadonlyTextarea</textarea>
74 <textarea id="disabledTextArea" cols="31" disabled>DisabledTextarea</textarea>
75 <textarea id="readOnlyDisabledTextArea" cols="31" readonly disabled>ReadonlyDisa bledTextarea</textarea>
76 </body>
77 </html>
78
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/platform/android/editing/selection/readonly-disabled-text-selection-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698