summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/shadow-dom/untriaged/events/event-dispatch
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /testing/web-platform/tests/shadow-dom/untriaged/events/event-dispatch
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/web-platform/tests/shadow-dom/untriaged/events/event-dispatch')
-rw-r--r--testing/web-platform/tests/shadow-dom/untriaged/events/event-dispatch/test-002.html61
-rw-r--r--testing/web-platform/tests/shadow-dom/untriaged/events/event-dispatch/test-003.html81
2 files changed, 142 insertions, 0 deletions
diff --git a/testing/web-platform/tests/shadow-dom/untriaged/events/event-dispatch/test-002.html b/testing/web-platform/tests/shadow-dom/untriaged/events/event-dispatch/test-002.html
new file mode 100644
index 000000000..8ea42cad7
--- /dev/null
+++ b/testing/web-platform/tests/shadow-dom/untriaged/events/event-dispatch/test-002.html
@@ -0,0 +1,61 @@
+<!DOCTYPE html>
+<!--
+Distributed under both the W3C Test Suite License [1] and the W3C
+3-clause BSD License [2]. To contribute to a W3C Test Suite, see the
+policies and contribution forms [3].
+
+[1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license
+[2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license
+[3] http://www.w3.org/2004/10/27-testcases
+-->
+<html>
+<head>
+<title>Shadow DOM Test: A_05_05_02</title>
+<link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
+<link rel="help" href="http://www.w3.org/TR/2013/WD-shadow-dom-20130514/#event-dispatch">
+<meta name="assert" content="Event Dispatch: The MouseEvent relatedTarget attribute must return the adjusted related target">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../../../../html/resources/common.js"></script>
+<script src="../../../resources/shadow-dom-utils.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+var A_05_05_02_T01 = async_test('A_05_05_02_T01');
+
+A_05_05_02_T01.step(unit(function (ctx) {
+
+ var d = newRenderedHTMLDocument(ctx);
+
+ var invoked = false;
+
+ roots = createTestMediaPlayer(d);
+
+ //expected result of what relative target should be see
+ //see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example
+
+ //For #volume-shadow-root adjusted related target #volume-shadow-root
+ roots.volumeShadowRoot.addEventListener('mouseover',
+ A_05_05_02_T01.step_func(function(event) {
+ invoked = true;
+ assert_true(event.relatedTarget === roots.volumeShadowRoot,
+ 'Wrong relatedTarget');
+ }), false);
+
+
+
+
+ var evt = document.createEvent("MouseEvents");
+ evt.initMouseEvent("mouseover", true, false, window,
+ 0, 10, 10, 10, 10, false, false, false, false, 0, roots.volumeShadowRoot);
+
+ roots.volumeShadowRoot.querySelector('#volume-slider-thumb').dispatchEvent(evt);
+ assert_true(invoked, 'Event listener was not invoked');
+ A_05_05_02_T01.done();
+}));
+
+//TODO (sgrekhov) Add tests for other nodes from http://www.w3.org/TR/shadow-dom/#event-retargeting-example
+</script>
+</body>
+</html>
diff --git a/testing/web-platform/tests/shadow-dom/untriaged/events/event-dispatch/test-003.html b/testing/web-platform/tests/shadow-dom/untriaged/events/event-dispatch/test-003.html
new file mode 100644
index 000000000..78b76de7d
--- /dev/null
+++ b/testing/web-platform/tests/shadow-dom/untriaged/events/event-dispatch/test-003.html
@@ -0,0 +1,81 @@
+<!DOCTYPE html>
+<!--
+Distributed under both the W3C Test Suite License [1] and the W3C
+3-clause BSD License [2]. To contribute to a W3C Test Suite, see the
+policies and contribution forms [3].
+
+[1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license
+[2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license
+[3] http://www.w3.org/2004/10/27-testcases
+-->
+<html>
+<head>
+<title>Shadow DOM Test: A_05_05_03</title>
+<link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
+<link rel="help" href="https://w3c.github.io/webcomponents/spec/shadow/#event-path-trimming">
+<meta name="assert" content="Event Path Trimming: In cases where both relatedTarget and target of a trusted event are part of the same shadow tree, the conforming UAs must stop events at the shadow root to avoid the appearance of spurious mouseover and mouseout events firing from the same node.">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../../../../html/resources/common.js"></script>
+<script src="../../../resources/shadow-dom-utils.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+var A_05_05_03_T01 = async_test('A_05_05_03_T01');
+
+A_05_05_03_T01.step(unit(function (ctx) {
+
+ var d = newRenderedHTMLDocument(ctx);
+
+ var host = d.createElement('div');
+ host.setAttribute('id', 'host');
+ d.body.appendChild(host);
+
+ //Shadow root to play with
+ var s = host.attachShadow({mode: 'open'});
+ s.id = 'shadow';
+
+ var input1 = d.createElement('input');
+ input1.setAttribute('id', 'input1');
+ s.appendChild(input1);
+
+ var input2 = d.createElement('input');
+ input2.setAttribute('id', 'input2');
+ s.appendChild(input2);
+
+ input1.addEventListener('focusin', A_05_05_03_T01.step_func(function(event) {
+ assert_equals(event.composedPath().length, 7);
+ assert_equals(event.composedPath()[0].id, 'input1');
+ assert_equals(event.composedPath()[1].id, 'shadow');
+ assert_equals(event.composedPath()[2].id, 'host');
+ assert_equals(event.composedPath()[3].tagName, 'BODY');
+ assert_equals(event.composedPath()[4].tagName, 'HTML');
+ assert_equals(event.composedPath()[5], d);
+ assert_equals(event.composedPath()[6], ctx.iframes[0].contentWindow);
+ }), false);
+
+ input2.addEventListener('focusin', A_05_05_03_T01.step_func(function(event) {
+ assert_equals(event.composedPath().length, 2);
+ assert_equals(event.composedPath()[0].id, 'input2');
+ assert_equals(event.composedPath()[1].id, 'shadow');
+ A_05_05_03_T01.done();
+ }), false);
+
+ // Expected event path for #input1:
+ // <input>, #shadow-root, <div>, <body>, <html>, #document, window
+ input1.focus();
+
+ // Causes a "focusin" event, from #input1 to #input2
+ // In this case, original relatedTarget is #input1, and original target
+ // is #input2.
+ // It should be viewed outside the shadow as "target == relatedTarget"
+ // after event retargeting, therefore, event.composedPath() above the shadow
+ // host will be trimmed.
+ // Expected event path for #input2:
+ // <input>, #shadow-root
+ input2.focus();
+}));
+</script>
+</body>
+</html>