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

Unified Diff: third_party/WebKit/LayoutTests/imported/wpt/html/webappapis/scripting/events/event-handler-onauxclick.html

Issue 2547023002: Import wpt@3c8896ae408c8fd594979da7c99970029e7856a7 (Closed)
Patch Set: Modify TestExpectations or download new baselines for tests. 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/imported/wpt/html/webappapis/scripting/events/event-handler-onauxclick.html
diff --git a/third_party/WebKit/LayoutTests/imported/wpt/html/webappapis/scripting/events/event-handler-onauxclick.html b/third_party/WebKit/LayoutTests/imported/wpt/html/webappapis/scripting/events/event-handler-onauxclick.html
new file mode 100644
index 0000000000000000000000000000000000000000..d741507da015a4cd7150ed867d87ee901d4b996c
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/imported/wpt/html/webappapis/scripting/events/event-handler-onauxclick.html
@@ -0,0 +1,58 @@
+<!DOCTYPE html>
+<title>onauxclick</title>
+<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
+<link rel="help" href="https://html.spec.whatwg.org/multipage/#handler-onauxclick">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<div id="auxclickme1" onauxclick="window.auxClick1Happened = true;"></div>
+<div id="auxclickme2" onauxclick="window.auxClick2Happened = true;"></div>
+
+<script>
+"use strict";
+window.auxClick1Happened = false;
+window.auxClick2Happened = false;
+
+test(() => {
+ for (const location of [window, HTMLElement.prototype, SVGElement.prototype, Document.prototype]) {
+ assert_true(location.hasOwnProperty("onauxclick"),
+ `${location.constructor.name} has an own property named "onauxclick"`);
+ }
+}, "onauxclick is on the appropriate locations for GlobalEventHandlers");
+
+test(() => {
+ const htmlElement = document.createElement("span");
+ const svgElement = document.createElementNS("http://www.w3.org/2000/svg", "g");
+
+ for (const location of [window, htmlElement, svgElement, document]) {
+ assert_equals(location.onauxclick, null,
+ `The default value of the property is null for a ${location.constructor.name} instance`);
+ }
+}, "The default value of onauxclick is always null");
+
+test(() => {
+ const element = document.querySelector("#auxclickme1");
+ const compiledHandler = element.onauxclick;
+
+ assert_equals(typeof compiledHandler, "function", "The onauxclick property must be a function");
+ compiledHandler();
+ assert_true(window.auxClick1Happened, "Calling the handler must run the code");
+}, "The onauxclick content attribute must be compiled into the onauxclick property");
+
+test(() => {
+ const element = document.querySelector("#auxclickme2");
+ element.dispatchEvent(new Event("auxclick"));
+
+ assert_true(window.auxClick2Happened, "Dispatching the event must run the code");
+}, "The onauxclick content attribute must execute when an event is dispatched");
+
+test(() => {
+ const element = document.createElement("meta");
+ element.onauxclick = e => {
+ assert_equals(e.currentTarget, element, "The event must be fired at the <meta> element");
+ };
+
+ element.dispatchEvent(new Event("auxclick"));
+}, "dispatching an auxclick event must trigger element.onauxclick");
+
+</script>

Powered by Google App Engine
This is Rietveld 408576698