Index: LayoutTests/fast/forms/label/label-selection-by-dragging.html |
diff --git a/LayoutTests/fast/forms/label/label-selection-by-dragging.html b/LayoutTests/fast/forms/label/label-selection-by-dragging.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e6bb42c0ee4a3d6b9809d488fec2db4db68a82e1 |
--- /dev/null |
+++ b/LayoutTests/fast/forms/label/label-selection-by-dragging.html |
@@ -0,0 +1,34 @@ |
+<!DOCTYPE html> |
+<html> |
+<script src="../../../resources/js-test.js"></script> |
+ |
+<label id="labelWithInput" for="inputText">Some, Text associated with input</label> |
+<input type="checkbox" id="checkbox" checked> |
+ |
+<script> |
+description('Test the value of checkbox after selecting the associated label\'s text'); |
+ |
+var labelElement = document.getElementById('labelWithInput'); |
+var checkbox = document.getElementById('checkbox'); |
+ |
+testByDraggingOnLabel(labelElement); |
+ |
+// As checkbox is already checked, dragging over the label text, |
+// should only select the text and not change the value of |
+// checkbox. |
+shouldBeTrue('checkbox.checked'); |
+ |
+// To check if selection happened or not. |
+shouldBeEqualToString('window.getSelection().toString()', 'Some, Text associated with input'); |
+ |
+labelElement.style.display = 'none'; |
+ |
+function testByDraggingOnLabel(element) |
+{ |
+ eventSender.mouseMoveTo(element.offsetLeft, element.offsetTop + element.offsetHeight / 2); |
+ eventSender.mouseDown(); |
+ eventSender.mouseMoveTo(element.offsetLeft + element.offsetWidth, element.offsetTop + element.offsetHeight / 2); |
+ eventSender.mouseUp(); |
+} |
+</script> |
+</html> |