diff options
-rw-r--r-- | tests/wpt/mozilla/meta/MANIFEST.json | 10 | ||||
-rw-r--r-- | tests/wpt/mozilla/meta/mozilla/partial_shadow_dom.html.ini | 2 | ||||
-rw-r--r-- | tests/wpt/mozilla/tests/mozilla/partial_shadow_dom.html | 38 |
3 files changed, 50 insertions, 0 deletions
diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json index a29a6bb5c5a..f556de3c784 100644 --- a/tests/wpt/mozilla/meta/MANIFEST.json +++ b/tests/wpt/mozilla/meta/MANIFEST.json @@ -13515,6 +13515,12 @@ {} ] ], + "mozilla/partial_shadow_dom.html": [ + [ + "mozilla/partial_shadow_dom.html", + {} + ] + ], "mozilla/postmessage_closed.html": [ [ "mozilla/postmessage_closed.html", @@ -20430,6 +20436,10 @@ "5aff666995fe6cd1d4e84e63a9f6019d04387f8e", "testharness" ], + "mozilla/partial_shadow_dom.html": [ + "d97f1422d20161e989f200d44be6e379f79410bd", + "testharness" + ], "mozilla/poster.png": [ "33834c3ef095fa9c0080017e1b65b2eb8413eac4", "support" diff --git a/tests/wpt/mozilla/meta/mozilla/partial_shadow_dom.html.ini b/tests/wpt/mozilla/meta/mozilla/partial_shadow_dom.html.ini new file mode 100644 index 00000000000..6b14e5081c1 --- /dev/null +++ b/tests/wpt/mozilla/meta/mozilla/partial_shadow_dom.html.ini @@ -0,0 +1,2 @@ +[partial_shadow_dom.html] + prefs: [dom.shadowdom.enabled:true] diff --git a/tests/wpt/mozilla/tests/mozilla/partial_shadow_dom.html b/tests/wpt/mozilla/tests/mozilla/partial_shadow_dom.html new file mode 100644 index 00000000000..d97f1422d20 --- /dev/null +++ b/tests/wpt/mozilla/tests/mozilla/partial_shadow_dom.html @@ -0,0 +1,38 @@ +<!doctype html> +<head> + <meta charset="utf-8"> + <title></title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> +</head> +<body> + <h1 class="header">Not in the shadows</h1> + <div id="host"> + </div> + <script> + test(function() { + // Attach shadow. + var host = document.getElementById('host'); + var shadowRoot = host.attachShadow(); + assert_not_equals(shadowRoot, null); + assert_equals(shadowRoot.host, host); + assert_equals(shadowRoot.mode, 'closed'); + + assert_equals(document.body.getElementsByTagName('h1').length, 1); + assert_equals(document.body.getElementsByClassName('header').length, 1); + assert_equals(document.querySelectorAll('h1').length, 1); + assert_equals(document.body.childNodes.length, 6); + + // Append child to shadow tree and check that its content is encapsulated. + var shadowChild = document.createElement('h1'); + shadowChild.classList.add('header'); + shadowChild.textContent = 'In the shadows'; + shadowRoot.appendChild(shadowChild); + assert_equals(document.body.getElementsByTagName('h1').length, 1); + assert_equals(document.body.getElementsByClassName('header').length, 1); + assert_equals(document.querySelectorAll('h1').length, 1); + assert_equals(document.body.childNodes.length, 6); + assert_equals(shadowRoot.querySelectorAll('h1').length, 1); + }); + </script> +</body> |