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

Unified Diff: LayoutTests/fast/forms/label/label-selection-by-dragging.html

Issue 556813002: Fix behavior of label associated with control element (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Addressing comments Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
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>

Powered by Google App Engine
This is Rietveld 408576698