test_bug1150308.html 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <!DOCTYPE HTML>
  2. <html>
  3. <!--
  4. https://bugzilla.mozilla.org/show_bug.cgi?id=1150308
  5. -->
  6. <head>
  7. <title>Test for Bug 1150308</title>
  8. <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  9. <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
  10. <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
  11. </head>
  12. <body>
  13. <div id="host"><span id="distributeme">Foo</span></div>
  14. <script type="application/javascript">
  15. /** Test for Bug 1150308 **/
  16. SimpleTest.waitForExplicitFinish();
  17. SimpleTest.waitForFocus(function() {
  18. var host = document.getElementById("host");
  19. var shadow = host.createShadowRoot();
  20. shadow.innerHTML = '<style>.bar:active { color: rgb(0, 255, 0); }</style><div class="bar" id="inner"><content></content></div>';
  21. var inner = shadow.getElementById("inner");
  22. var distributed = document.getElementById("distributeme");
  23. is(window.getComputedStyle(inner).color, "rgb(0, 0, 0)", "The div inside the shadow root should not be active.");
  24. synthesizeMouseAtCenter(distributed, { type: "mousedown" });
  25. is(window.getComputedStyle(inner).color, "rgb(0, 255, 0)", "Div inside shadow root should be active.");
  26. synthesizeMouseAtCenter(distributed, { type: "mouseup" });
  27. is(window.getComputedStyle(inner).color, "rgb(0, 0, 0)", "Div inside shadow root should no longer be active.");
  28. SimpleTest.finish();
  29. });
  30. </script>
  31. </body>
  32. </html>