summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/forms/label/label-selection.html
blob: 8c4862a65d6316d1be85372c2223c54054e0d1fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<!DOCTYPE html>
<html>
<script src="../../../resources/js-test.js"></script>

<body>
<label id="labelWithInput" for="inputText">Some, Text associated with input</label>
<input id="inputText" type="text">
</body>

<script>
description('Test the selection of label associated with input.');

var labelElement = document.getElementById('labelWithInput');
testWithDoubleClick(labelElement);

shouldBeEqualToString('window.getSelection().toString()', 'Some');

labelElement.style.display = 'none';

function testWithDoubleClick(element)
{
    eventSender.mouseMoveTo(element.offsetLeft, element.offsetTop);
    eventSender.mouseDown();
    eventSender.mouseUp();
    eventSender.mouseDown();
    eventSender.mouseUp();
}
</script>
</html>