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

Unified Diff: third_party/WebKit/LayoutTests/fast/forms/label/label-selection-by-textSelection-and-click.html

Issue 2833313003: Pass clickEvent to controlElement inside label if targetNode can't start selection (Closed)
Patch Set: Address Review Comments Created 3 years, 7 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/HTMLLabelElement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/fast/forms/label/label-selection-by-textSelection-and-click.html
diff --git a/third_party/WebKit/LayoutTests/fast/forms/label/label-selection-by-textSelection-and-click.html b/third_party/WebKit/LayoutTests/fast/forms/label/label-selection-by-textSelection-and-click.html
new file mode 100644
index 0000000000000000000000000000000000000000..348e6f11c27a1f88ed5cc0077f48dbfe49093558
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/forms/label/label-selection-by-textSelection-and-click.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<script src='../../../resources/testharness.js'></script>
+<script src='../../../resources/testharnessreport.js'></script>
+<p>Selected Text</p>
+<label>
+<img src="../resources/green.jpg" width=100 height=100>
+<br><input type=radio> Then click the image
+</label>
+<script>
+var radio = document.querySelector("input[type=radio]");
+var targetTextRect = document.querySelector("p").getBoundingClientRect();
+var textLeft = targetTextRect.left;
+var textTop = targetTextRect.top;
+var textWidth = targetTextRect.width;
+var targetImageRect = document.querySelector("img").getBoundingClientRect();
+var imageLeft = targetImageRect.left;
+var imageTop = targetImageRect.top;
+
+var testLabelClickWithSelectedText = async_test("Tests that Radio Input gets checked if label clicked along with a text selection.");
+
+// This test runs as follows:
+// 1. Select the text.
+// 2. Then click on label element image.
+// 3. Radio button should be checked.
+
+testLabelClickWithSelectedText.step(() => {
+ assert_exists(window, "chrome");
+ assert_exists(chrome, "gpuBenchmarking");
+
+ var pointerActions =
+ [{ source: "mouse",
+ actions: [
+ { name: "pointerDown", x: textLeft, y: textTop },
+ { name: "pointerMove", x: textLeft + textWidth, y: textTop },
+ { name: "pointerUp" },
+ { name: "pause" },
+ { name: "pointerDown", x: imageLeft, y: imageTop },
+ { name: "pointerUp" }]}];
+ chrome.gpuBenchmarking.pointerActionSequence(pointerActions, testLabelClickWithSelectedText.step_func_done(() => {
+ assert_equals(window.getSelection().toString(), "Selected Text");
+ assert_true(radio.checked);
+ }));
+});
+</script>
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/HTMLLabelElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698