OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <!-- |
| 3 Distributed under both the W3C Test Suite License [1] and the W3C |
| 4 3-clause BSD License [2]. To contribute to a W3C Test Suite, see the |
| 5 policies and contribution forms [3]. |
| 6 |
| 7 [1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license |
| 8 [2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license |
| 9 [3] http://www.w3.org/2004/10/27-testcases |
| 10 --> |
| 11 <html> |
| 12 <head> |
| 13 <title>Shadow DOM Test: A_05_05_02</title> |
| 14 <link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru"> |
| 15 <link rel="help" href="http://www.w3.org/TR/2013/WD-shadow-dom-20130514/#event-d
ispatch"> |
| 16 <meta name="assert" content="Event Dispatch: The MouseEvent relatedTarget attrib
ute must return the adjusted related target"> |
| 17 <script src="../../../../../resources/testharness.js"></script> |
| 18 <script src="../../../../../resources/testharnessreport.js"></script> |
| 19 <script src="../../testcommon.js"></script> |
| 20 <link rel="stylesheet" href="../../../../../resources/testharness.css"> |
| 21 </head> |
| 22 <body> |
| 23 <div id="log"></div> |
| 24 <script> |
| 25 var A_05_05_02_T01 = async_test('A_05_05_02_T01'); |
| 26 |
| 27 A_05_05_02_T01.step(unit(function (ctx) { |
| 28 |
| 29 var d = newRenderedHTMLDocument(ctx); |
| 30 |
| 31 var invoked = false; |
| 32 |
| 33 roots = createTestMediaPlayer(d); |
| 34 |
| 35 //expected result of what relative target should be see |
| 36 //see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example |
| 37 |
| 38 //For #volume-shadow-root adjusted related target #volume-shadow-root |
| 39 roots.volumeShadowRoot.addEventListener('mouseover', |
| 40 A_05_05_02_T01.step_func(function(event) { |
| 41 invoked = true; |
| 42 assert_true(event.relatedTarget === roots.volumeShadowRoot, |
| 43 'Wrong relatedTarget'); |
| 44 }), false); |
| 45 |
| 46 |
| 47 |
| 48 |
| 49 var evt = document.createEvent("MouseEvents"); |
| 50 evt.initMouseEvent("mouseover", true, false, window, |
| 51 0, 10, 10, 10, 10, false, false, false, false, 0, roots.volumeShadowRoot); |
| 52 |
| 53 roots.volumeShadowRoot.querySelector('#volume-slider-thumb').dispatchEvent(e
vt); |
| 54 assert_true(invoked, 'Event listener was not invoked'); |
| 55 A_05_05_02_T01.done(); |
| 56 })); |
| 57 |
| 58 //TODO (sgrekhov) Add tests for other nodes from http://www.w3.org/TR/shadow-dom
/#event-retargeting-example |
| 59 </script> |
| 60 </body> |
| 61 </html> |
OLD | NEW |