OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <script src="../../../resources/js-test.js"></script> |
| 4 |
| 5 <label id="labelWithInput" for="inputText">Some, Text associated with input</lab
el> |
| 6 <input type="checkbox" id="checkbox" checked> |
| 7 |
| 8 <script> |
| 9 description('Test the value of checkbox after selecting the associated label\'s
text'); |
| 10 |
| 11 var labelElement = document.getElementById('labelWithInput'); |
| 12 var checkbox = document.getElementById('checkbox'); |
| 13 |
| 14 testByDraggingOnLabel(labelElement); |
| 15 |
| 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'); |
| 20 |
| 21 // To check if selection happened or not. |
| 22 shouldBeEqualToString('window.getSelection().toString()', 'Some, Text associated
with input'); |
| 23 |
| 24 labelElement.style.display = 'none'; |
| 25 |
| 26 function testByDraggingOnLabel(element) |
| 27 { |
| 28 eventSender.mouseMoveTo(element.offsetLeft, element.offsetTop + element.offs
etHeight / 2); |
| 29 eventSender.mouseDown(); |
| 30 eventSender.mouseMoveTo(element.offsetLeft + element.offsetWidth, element.of
fsetTop + element.offsetHeight / 2); |
| 31 eventSender.mouseUp(); |
| 32 } |
| 33 </script> |
| 34 </html> |
OLD | NEW |