<!DOCTYPE html>
<html>
<script src="../../../resources/js-test.js"></script>
<style>
span {
user-select: none;
-webkit-user-select: none;
}
</style>
<div>
Select, some text from this line!!!
</div>
<label class="label">
<input type="checkbox"/>
<span id='span'>Click Me</span>
</label>
<div id='console'></div>
<script>
description('Tests that the click event is passed when selection is disabaled' +
' on label');
var span = document.getElementById('span');
testWithDoubleClick(span);
shouldBeEqualToString('window.getSelection().toString()', '');
var div = document.querySelector('div');
testWithDoubleClick(div);
shouldBeEqualToString('window.getSelection().toString()', 'Select');
shouldBeFalse("document.querySelector('input').checked");
span.click();
shouldBeTrue("document.querySelector('input').checked");
span.click();
shouldBeFalse("document.querySelector('input').checked");
div.style.display = 'none';
span.style.display = 'none';
function testWithDoubleClick(element)
{
eventSender.mouseMoveTo(element.offsetLeft, element.offsetTop);
eventSender.mouseDown();
eventSender.mouseUp();
eventSender.mouseDown();
eventSender.mouseUp();
}
</script>