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

Side by Side Diff: third_party/WebKit/LayoutTests/imported/wpt/auxclick/auxclick_event-manual.html

Issue 2572333003: Import wpt@4970d7334aaf8977c5b617075aa48be1b6e482c7 (Closed)
Patch Set: Update TestExpectations Created 4 years 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 <meta charset="utf-8">
5 <title>Clicking with primary vs non-primary buttons</title>
6 <link rel="help" href="https://wicg.github.io/auxclick/">
7 <script src="/resources/testharness.js"></script>
8 <script src="/resources/testharnessreport.js"></script>
9 <style>
10 #target {
11 background-color: green;
12 height: 200px;
13 width: 200px;
14 }
15 </style>
16 </head>
17 <body>
18 <h1>Clicking with primary vs non-primary buttons</h1>
19 <p>Double-click on the green box with a non-primary button. When using mouse any button other than the left button is non-primary. If a "PASS" result appear s, the test passes; otherwise, it fails.</p>
20 <div id="target"></div>
21 <script>
22 var test_auxclick = async_test("auxclick event sequence received.");
23 var target = document.querySelector('#target');
24 document.addEventListener('contextmenu', event => { event.preventDefault(); });
25 ['click', 'dblclick'].forEach(eventName => {
26 target.addEventListener(eventName, () => {
27 test_auxclick.step(() => {
28 assert_unreached(eventName + ' event should not be dispatched fo r non-primary buttons.');
29 });
30 });
31 document.addEventListener(eventName, () => {
32 test_auxclick.step(() => {
33 assert_unreached('document should not receive ' + eventName + ' for non-primary buttons.');
34 });
35 }, true);
36 });
37 var click_count = 0;
38 var events = [];
39 ['mousedown', 'mouseup'].forEach(eventName => {
40 target.addEventListener(eventName, event => {
41 events.push(event.type);
42 });
43 });
44 target.addEventListener('auxclick', event => {
45 events.push(event.type);
46 click_count++;
47 if (click_count==1) {
48 test (() => {
49 assert_equals(event.detail, click_count, 'detail attribute of aux click should be the click count.');
50 }, "First auxclick should have detail=1 indicating the fire click");
51 } else {
52 test (() => {
53 assert_equals(event.detail, click_count, 'detail attribute of aux click should be the click count.');
54 }, "Second auxclick should have detail=2 indicating the fire click");
55 test_auxclick.step(() => {
56 assert_array_equals(events, ['mousedown', 'mouseup', 'auxclick', 'mousedown', 'mouseup', 'auxclick'],
57 'There should be two auxclick events for a non-primary butto n double click each preceded by one mousemove and one mouseup');
58 assert_equals(event.detail, click_count, 'detail attribute of au xclick should be the click count.');
59 });
60 test_auxclick.done();
61 }
62 });
63 </script>
64 </body>
65 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698