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

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: patch set updated 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
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
11 var text = document.querySelector("p");
12 var label = document.querySelector("label");
13 var radio = label.querySelector("input[type=radio]");
14 var image = label.querySelector("img");
15 var targetTextRect = text.getBoundingClientRect();
16 var textLeft = targetTextRect.left;
17 var textTop = targetTextRect.top;
18 var textWidth = targetTextRect.width;
19 var targetImageRect = image.getBoundingClientRect();
20 var imageLeft = targetImageRect.left;
21 var imageTop = targetImageRect.top;
22
23 function callbackValidMoveCount() {
24 testTouchMove.step(function() {
25 assert_equals(window.getSelection().toString(), "Selected Text");
26 assert_true(radio.checked);
27 });
28 testTouchMove.done();
29 }
30
31 function testLabelClickOnSelectedText() {
32 if (window.chrome && chrome.gpuBenchmarking) {
33 var pointerActions =
34 [{ source: "mouse",
35 actions: [
36 { name: "pointerDown", x: textLeft, y: textTop },
37 { name: "pointerMove", x: textLeft + textWidth, y: textTop },
38 { name: "pointerUp" },
39 { name:"pause"},
40 { name: "pointerDown", x: imageLeft, y: imageTop},
41 { name: "pointerUp" }]}];
42 chrome.gpuBenchmarking.pointerActionSequence(pointerActions, callbackVal idMoveCount);
43 }
44 }
45
46 var testTouchMove = async_test("Tests that Radio Input gets checked if label cli cked along with a text selection.");
47 // This test runs as follows.
48 // 1. Select the text.
49 // 2. Then click on label element image.
50 // 3. Radio button should be checked.
51 testLabelClickOnSelectedText();
52 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698