<!DOCTYPE html>
<html>
<script src="../../../resources/js-test.js"></script>
<script src="../../../resources/ui-helper.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)
{
    UIHelper.doubleClickAt(element.offsetLeft, element.offsetTop);
}
</script>
</html>
