Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / forms / label / label-selection-by-dragging.html
blobe6bb42c0ee4a3d6b9809d488fec2db4db68a82e1
1 <!DOCTYPE html>
2 <html>
3 <script src="../../../resources/js-test.js"></script>
5 <label id="labelWithInput" for="inputText">Some, Text associated with input</label>
6 <input type="checkbox" id="checkbox" checked>
8 <script>
9 description('Test the value of checkbox after selecting the associated label\'s text');
11 var labelElement = document.getElementById('labelWithInput');
12 var checkbox = document.getElementById('checkbox');
14 testByDraggingOnLabel(labelElement);
16 // As checkbox is already checked, dragging over the label text,
17 // should only select the text and not change the value of
18 // checkbox.
19 shouldBeTrue('checkbox.checked');
21 // To check if selection happened or not.
22 shouldBeEqualToString('window.getSelection().toString()', 'Some, Text associated with input');
24 labelElement.style.display = 'none';
26 function testByDraggingOnLabel(element)
28 eventSender.mouseMoveTo(element.offsetLeft, element.offsetTop + element.offsetHeight / 2);
29 eventSender.mouseDown();
30 eventSender.mouseMoveTo(element.offsetLeft + element.offsetWidth, element.offsetTop + element.offsetHeight / 2);
31 eventSender.mouseUp();
33 </script>
34 </html>