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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/HTMLLabelElement.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src='../../../resources/testharness.js'></script>
3 <script src='../../../resources/testharnessreport.js'></script>
4 <p>Selected Text</p>
5 <label>
6 <img src="../resources/green.jpg" width=100 height=100>
7 <br><input type=radio> Then click the image
8 </label>
9 <script>
10 var radio = document.querySelector("input[type=radio]");
11 var targetTextRect = document.querySelector("p").getBoundingClientRect();
12 var textLeft = targetTextRect.left;
13 var textTop = targetTextRect.top;
14 var textWidth = targetTextRect.width;
15 var targetImageRect = document.querySelector("img").getBoundingClientRect();
16 var imageLeft = targetImageRect.left;
17 var imageTop = targetImageRect.top;
18
19 var testLabelClickWithSelectedText = async_test("Tests that Radio Input gets che cked if label clicked along with a text selection.");
20
21 // This test runs as follows:
22 // 1. Select the text.
23 // 2. Then click on label element image.
24 // 3. Radio button should be checked.
25
26 testLabelClickWithSelectedText.step(() => {
27 assert_exists(window, "chrome");
28 assert_exists(chrome, "gpuBenchmarking");
29
30 var pointerActions =
31 [{ source: "mouse",
32 actions: [
33 { name: "pointerDown", x: textLeft, y: textTop },
34 { name: "pointerMove", x: textLeft + textWidth, y: textTop },
35 { name: "pointerUp" },
36 { name: "pause" },
37 { name: "pointerDown", x: imageLeft, y: imageTop },
38 { name: "pointerUp" }]}];
39 chrome.gpuBenchmarking.pointerActionSequence(pointerActions, testLabelClickWit hSelectedText.step_func_done(() => {
40 assert_equals(window.getSelection().toString(), "Selected Text");
41 assert_true(radio.checked);
42 }));
43 });
44 </script>
OLDNEW
« 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