Chromium Code Reviews| Index: LayoutTests/editing/selection/readonly-disabled-text-selection.html |
| diff --git a/LayoutTests/editing/selection/readonly-disabled-text-selection.html b/LayoutTests/editing/selection/readonly-disabled-text-selection.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..1be4735fe4f1343ff3390a16d4247c7daaf6294d |
| --- /dev/null |
| +++ b/LayoutTests/editing/selection/readonly-disabled-text-selection.html |
| @@ -0,0 +1,78 @@ |
| +<!DOCTYPE html> |
| +<html> |
| +<head> |
|
esprehn
2014/10/17 21:55:54
Leave out html, head and body.
AKVT
2014/10/20 19:50:01
Done. Thanks you
|
| +<script src="../../resources/js-test.js"></script> |
| +<script> |
| +function test() { |
|
esprehn
2014/10/17 21:55:55
onload = function() {
AKVT
2014/10/20 19:50:00
Done. Thanks
|
| + jsTestAsync = true; |
|
esprehn
2014/10/17 21:55:54
remove.
AKVT
2014/10/20 19:50:01
Done.
|
| + if (window.testRunner) |
| + 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
|
| + |
| + if (!window.eventSender) |
|
esprehn
2014/10/17 21:55:54
combine with the check below.
AKVT
2014/10/20 19:50:01
Done.
|
| + return; |
| + |
| + 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
|
| + debug("gestureLongPress not implemented by this platform."); |
| + debug("Manullay long press on every element in the page and check whether Text selection is happening or not"); |
| + debug("If Text selection is not happening for readonly or disabled input/textarea, then it's a failure."); |
| + return; |
| + } |
| + |
| + // 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.
|
| + doLongPressOnElement("normalText"); |
| + |
| + // ReadOnly Text |
| + doLongPressOnElement("readOnlyText"); |
| + |
| + // Disabled Text |
| + doLongPressOnElement("disabledText"); |
| + |
| + // ReadOnly and Disabled Text |
| + doLongPressOnElement("readOnlyDisabledText"); |
| + |
| + // Normal TextArea |
| + doLongPressOnElement("normalTextArea"); |
| + |
| + // ReadOnly TextArea |
| + doLongPressOnElement("readOnlyTextArea"); |
| + |
| + // Disabled TextArea |
| + doLongPressOnElement("disabledTextArea"); |
| + |
| + // ReadOnly and Disabled TextArea |
| + doLongPressOnElement("readOnlyDisabledTextArea"); |
| + |
| + 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.
|
| +} |
| + |
| +function doLongPressOnElement(elementId) { |
| + var element = document.getElementById(elementId); |
| + var bounds = element.getBoundingClientRect(); |
| + var middleX = (bounds.left + bounds.right) / 2; |
| + var middleY = (bounds.top + bounds.bottom) / 2; |
| + // Touch directly in the center of the element. |
| + window.eventSender.gestureLongPress(middleX, middleY); |
| + var currentSelection = window.getSelection(); |
| + var selectedText = currentSelection.toString(); |
| + var elementValue = element.value; |
| + 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
|
| + testPassed("Selected Text is " + selectedText); |
| + } |
| + else { |
| + testFailed("Selected Text Should be " + elementValue + " instead of " + selectedText); |
| + } |
| +} |
| +</script> |
| +</head> |
| +<body onload="test();"> |
|
esprehn
2014/10/17 21:55:54
remove.
AKVT
2014/10/20 19:50:00
Done.
|
| +<input id="normalText" type="text" value="NormalInput"> |
| +<input id="readOnlyText" type="text" value="ReadonlyInput" readonly> |
| +<input id="disabledText" type="text" value="DisabledInput" disabled> |
| +<input id="readOnlyDisabledText" size="20" type="text" value="ReadonlyDisabledInput"readonly disabled> |
| +<textarea id="normalTextArea" cols="31">NormalTextarea</textarea> |
| +<textarea id="readOnlyTextArea" cols="31" readonly>ReadonlyTextarea</textarea> |
| +<textarea id="disabledTextArea" cols="31" disabled>DisabledTextarea</textarea> |
| +<textarea id="readOnlyDisabledTextArea" cols="31" readonly disabled>ReadonlyDisabledTextarea</textarea> |
| +</body> |
| +</html> |
| + |