Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(160)

Unified Diff: LayoutTests/fast/selectors/label-selection.html

Issue 258933006: Fix selection of label having control element. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/fast/selectors/label-selection.html
diff --git a/LayoutTests/fast/selectors/label-selection.html b/LayoutTests/fast/selectors/label-selection.html
new file mode 100644
index 0000000000000000000000000000000000000000..6d2385f03f0cd59c27ad4ec0c6f1000ad0bcc73e
--- /dev/null
+++ b/LayoutTests/fast/selectors/label-selection.html
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+function log(msg)
tkent 2014/04/29 23:36:09 Please remove this function, include ../../resourc
deepak.sa 2014/05/02 06:18:46 Done.
+{
+ document.getElementById('console').appendChild(document.createTextNode(msg + '\n'));
+}
+
+function testWithDoubleClick(element)
+{
+ eventSender.mouseMoveTo(element.offsetLeft, element.offsetTop);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+}
+
+function checkSelection()
+{
+ if ((window.getSelection().toString() == "Some"))
+ log("PASS selected text is :\"" + window.getSelection().toString() + "\"");
tkent 2014/04/29 23:36:09 Please use shouldBeEqualToString() defined in js-t
deepak.sa 2014/05/02 06:18:46 Done.
+ else
+ log("FAIL selected text is :\"" + window.getSelection().toString() + "\"");
+}
+
+function test()
+{
+ if (window.testRunner) {
+ var labelElement = document.getElementById("labelWithInput");
+ testRunner.dumpAsText();
+ testWithDoubleClick(labelElement);
+ checkSelection();
+
+ document.getElementById('labelWithInput').style.display = "none";
+ } else
+ log("This test needs window.testRunner and window.eventSender to work.");
+}
+
+</script>
+</head>
+<body onload="test()">
+<label id="labelWithInput" for="inputText">Some Text associated with input</label>
+<input id="inputText" type='text'></input>
keishi 2014/04/30 01:13:14 nit: input should not have an end tag.
deepak.sa 2014/05/02 06:18:46 Done.
+<pre id="console"></pre>
+</body>
+</html>
« no previous file with comments | « no previous file | LayoutTests/fast/selectors/label-selection-expected.txt » ('j') | Source/core/html/HTMLLabelElement.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698