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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/pointerevents/pointerevent_click_during_capture-manual.html

Issue 2711183003: Import wpt@a7e9c2abcf65b78fcf1c246fec6681c74e1bc352 (Closed)
Patch Set: Update test expectations and baselines. Created 3 years, 9 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 <html>
3 <head>
4 <title>click event target during capture</title>
5 <meta name="viewport" content="width=device-width">
6 <link rel="stylesheet" type="text/css" href="pointerevent_styles.css">
7 <script src="/resources/testharness.js"></script>
8 <script src="/resources/testharnessreport.js"></script>
9 <script src="pointerevent_support.js"></script>
10 <style>
11 .box {
12 margin: 10px;
13 }
14 #grey {
15 background: grey;
16 }
17 #blue {
18 background: blue;
19 }
20 #green {
21 background: green;
22 }
23 </style>
24 <script type="text/javascript">
25 PhaseEnum = {
26 Phase1: "phase1",
27 Phase2: "phase2",
28 Phase1WithCapturing: "phase1withcapturing",
29 Phase2WithCapturing: "phase2withcapturing",
30 }
31 var phase;
32 var receivedEvents;
33
34 function resetTestState() {
35 phase = PhaseEnum.Phase1;
36 receivedEvents = [];
37 }
38
39 function run() {
40 var test_pointerEvent = setup_pointerevent_test("click target du ring capture", ['mouse']);
41 var grey = document.getElementById('grey');
42 var blue = document.getElementById('blue');
43 var green = document.getElementById('green');
44
45 ['gotpointercapture', 'lostpointercapture', 'pointerdown', 'poin terup', 'click'].forEach(function(eventName) {
46 [grey, blue, green].forEach(function(target) {
47 target.addEventListener(eventName, function(event) {
48 if (event.eventPhase == event.AT_TARGET) {
49 receivedEvents.push(event.type + '@' + target.id);
50 if (phase == PhaseEnum.Phase1 && target == green && even t.type == 'click') {
51 test(function() {
52 assert_equals(receivedEvents.join(','), 'pointerdo wn@green,pointerup@green,click@green', 'An element should only receive click whe n it is the first common ancestor of pointerdown and pointerup targets');
53 }, "Click target when pointerup/down targeted at the same element with no capture");
54 phase = PhaseEnum.Phase2;
55 receivedEvents = [];
56 }
57 if (phase == PhaseEnum.Phase2 && target == grey && event .type == 'click') {
58 test(function() {
59 assert_equals(receivedEvents.join(','), 'pointerdo wn@blue,pointerup@green,click@grey', 'An element should only receive click when it is the first common ancestor of pointerdown and pointerup targets');
60 }, "Click target when pointerup/down targeted at dif ferent elements with no capture");
61 phase = PhaseEnum.Phase1WithCapturing;
62 receivedEvents = [];
63 }
64 if (target == blue && event.type == 'lostpointercapture' ) {
65 if (phase == PhaseEnum.Phase1WithCapturing) {
66 test_pointerEvent.step(function() {
67 assert_equals(receivedEvents.join(','), 'pointerdo wn@green,gotpointercapture@blue,pointerup@blue,click@grey,lostpointercapture@blu e', 'An element should only receive click when it is the first common ancestor o f pointerdown and pointerup targets');
68 });
69 phase = PhaseEnum.Phase2WithCapturing;
70 receivedEvents = [];
71 } else if (phase == PhaseEnum.Phase2WithCapturing) {
72 test_pointerEvent.step(function() {
73 assert_equals(receivedEvents.join(','), 'pointerdo wn@blue,gotpointercapture@blue,pointerup@blue,click@blue,lostpointercapture@blue ', 'An element should only receive click when it is the first common ancestor of pointerdown and pointerup targets');
74 });
75 test_pointerEvent.done();
76 }
77 }
78 if (event.type == 'pointerdown' && (target == blue || ta rget == green)) {
79 if (phase == PhaseEnum.Phase1WithCapturing || phase == PhaseEnum.Phase2WithCapturing)
80 blue.setPointerCapture(event.pointerId);
81 }
82 }
83 });
84 });
85 });
86 }
87 </script>
88 </head>
89 <body onload="run()">
90 <h1>Pointer Event: click event during capture</h1>
91 <h2 id="pointerTypeDescription"></h2>
92 <h4>Test Description:
93 Click event should be sent to the first common ancestor of the point erdown and pointerup targets.
94 <ol>
95 <li>Click on the green box with the left button of mouse.</li>
96 <li>Press down the left button on the blue box and drag to the green box and release the button.</li>
97 <li>Repeat the two steps above once again.</li>
98 </ol>
99 </h4>
100 <br>
101 <div>
102 <div id="grey" class="box">
103 <div id="green" class="box"></div>
104 <div id="blue" class="box"></div>
105 </div>
106 </div>
107 </body>
108 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698