Index: LayoutTests/fast/forms/label/selection-disabled-label.html |
diff --git a/LayoutTests/fast/forms/label/selection-disabled-label.html b/LayoutTests/fast/forms/label/selection-disabled-label.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..179a20460d5424c83e794f2369146d270828f8d5 |
--- /dev/null |
+++ b/LayoutTests/fast/forms/label/selection-disabled-label.html |
@@ -0,0 +1,50 @@ |
+<!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> |