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
>
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
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();