OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
2 <script src='../../../resources/testharness.js'></script> | |
3 <script src='../../../resources/testharnessreport.js'></script> | |
4 <p id="textId">Selected Text</p> | |
Srirama
2017/04/28 12:56:45
you can remove id here and below and directly use
tanvir
2017/05/02 10:02:51
Done.
| |
5 <label id="labelId"> | |
6 <img id="imageId" src="../resources/green.jpg" width=100 height=100> | |
7 <br><input type=radio name=a id="radioId"> Then click the image | |
8 </label> | |
9 <script type="text/javascript"> | |
Srirama
2017/04/28 12:56:45
remove type
tanvir
2017/05/02 10:02:51
Done.
| |
10 | |
11 var radioID = document.getElementById("radioId"); | |
Srirama
2017/04/28 12:56:45
may be just use radio instead of radioID
| |
12 var textID = document.getElementById("textId"); | |
Srirama
2017/04/28 12:56:45
s/textID/text
| |
13 var targetTextRect = textID.getBoundingClientRect(); | |
14 var textLeft = targetTextRect.left; | |
15 var textTop = targetTextRect.top; | |
16 var textWidth = targetTextRect.width; | |
17 var imageID = document.getElementById("imageId"); | |
18 var targetImageRect = imageID.getBoundingClientRect(); | |
19 var imageLeft = targetImageRect.left; | |
20 var imageTop = targetImageRect.top; | |
21 | |
22 function callbackValidMoveCount() { | |
23 testTouchMove.step(function () { | |
Srirama
2017/04/28 12:56:45
nit:remove space before ()
tanvir
2017/05/02 10:02:50
Done.
| |
24 assert_equals(window.getSelection().toString(), "Selected Text"); | |
25 assert_equals(radioID.checked, true); | |
Srirama
2017/04/28 12:56:45
use assert_true
tanvir
2017/05/02 10:02:51
Done.
| |
26 }); | |
27 testTouchMove.done(); | |
28 } | |
29 | |
30 function testLabelClickOnSelectedText() { | |
31 if (window.chrome && chrome.gpuBenchmarking) { | |
32 var pointerActions = | |
33 [{source: "mouse", | |
Srirama
2017/04/28 12:56:45
nit:space before "source"
tanvir
2017/05/02 10:02:50
Done.
| |
34 actions: [ | |
35 { name: "pointerDown", x: textLeft, y: textTop }, | |
36 { name: "pointerMove", x: textLeft+textWidth, y: textTop }, | |
37 { name: "pointerUp" }, | |
38 { name:"pause"}, | |
39 { name: "pointerDown", x: imageLeft, y: imageTop}, | |
40 { name: "pointerUp" }]}]; | |
41 chrome.gpuBenchmarking.pointerActionSequence(pointerActions, callbackVal idMoveCount); | |
42 } | |
43 } | |
44 | |
45 var testTouchMove = async_test('Tests that Radio Input get checked if label clic ked along with a text selection.'); | |
Srirama
2017/04/28 12:56:45
s/get/gets
tanvir
2017/05/02 10:02:50
Done.
| |
46 // This test run as follows. | |
Srirama
2017/04/28 12:56:45
s/run/runs
tanvir
2017/05/02 10:02:51
Done.
| |
47 // 1. Select the text. | |
48 // 2. Then click on label element image. | |
49 // 3. Radio button should be checked. | |
50 testLabelClickOnSelectedText(); | |
51 </script> | |
OLD | NEW |