| Index: LayoutTests/imported/web-platform-tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees/test-001.html
|
| diff --git a/LayoutTests/imported/web-platform-tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees/test-001.html b/LayoutTests/imported/web-platform-tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees/test-001.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..269a219e877055d9b9e1337e20b0f06c1cdbddae
|
| --- /dev/null
|
| +++ b/LayoutTests/imported/web-platform-tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees/test-001.html
|
| @@ -0,0 +1,128 @@
|
| +<!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_04_05_01</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/#multiple-shadow-subtrees">
|
| +<meta name="assert" content="Hosting Multiple Shadow Subtrees:The shadow insertion point designates a place in the shadow DOM subtree, where an older tree is inserted when rendering">
|
| +<script src="../../../../../resources/testharness.js"></script>
|
| +<script src="../../../../../resources/testharnessreport.js"></script>
|
| +<script src="../../testcommon.js"></script>
|
| +<link rel="stylesheet" href="../../../../../resources/testharness.css">
|
| +</head>
|
| +<body>
|
| +<div id="log"></div>
|
| +<script>
|
| +var A_04_05_01_T1 = async_test('A_04_05_01_T01');
|
| +
|
| +
|
| +// Check that only the younger tree is visible if there's no shadow insertion point
|
| +A_04_05_01_T1.step(function () {
|
| + var iframe = document.createElement('iframe');
|
| + iframe.src = '../../resources/bobs_page.html';
|
| + document.body.appendChild(iframe);
|
| +
|
| + iframe.onload = A_04_05_01_T1.step_func(function () {
|
| + try {
|
| + var d = iframe.contentDocument;
|
| + var ul = d.querySelector('ul.stories');
|
| +
|
| + //make old shadow subtree
|
| + var s1 = ul.createShadowRoot();
|
| + var subdiv1 = d.createElement('div');
|
| + subdiv1.innerHTML = '<ul><content select=".shadow"></content></ul>';
|
| + s1.appendChild(subdiv1);
|
| +
|
| + //make younger shadow subtree
|
| + var s2 = ul.createShadowRoot();
|
| + var subdiv2 = d.createElement('div');
|
| + subdiv2.innerHTML = '<ul><content select=".shadow2"></content></ul>';
|
| + s2.appendChild(subdiv2);
|
| +
|
| + //The order of DOM elements should be the following:
|
| + //li4 visible. Other elements invisible
|
| + assert_true(d.querySelector('#li4').offsetTop > 0,
|
| + 'Only the younger tree should take part in the distribution');
|
| +
|
| + assert_equals(d.querySelector('#li1').offsetTop, 0,
|
| + 'Point 1: Elements that don\'t mach insertion point criteria participate in distribution');
|
| + assert_equals(d.querySelector('#li2').offsetTop, 0,
|
| + 'Point 2: Elements that don\'t mach insertion point criteria participate in distribution');
|
| + assert_equals(d.querySelector('#li3').offsetTop, 0,
|
| + 'Point 3: Elements that don\'t mach insertion point criteria participate in distribution');
|
| + assert_equals(d.querySelector('#li5').offsetTop, 0,
|
| + 'Point 4: Elements that don\'t mach insertion point criteria participate in distribution');
|
| + assert_equals(d.querySelector('#li6').offsetTop, 0,
|
| + 'Point 5: Elements that don\'t mach insertion point criteria participate in distribution');
|
| +
|
| + } finally {
|
| + iframe.parentNode.removeChild(iframe);
|
| + }
|
| + A_04_05_01_T1.done();
|
| + });
|
| +});
|
| +
|
| +
|
| +
|
| +//Check that both the younger tree and the older one are visible
|
| +//if there's a shadow insertion point for the older tree
|
| +var A_04_05_01_T2 = async_test('A_04_05_01_T02');
|
| +
|
| +A_04_05_01_T2.step(function () {
|
| + var iframe = document.createElement('iframe');
|
| + iframe.src = '../../resources/bobs_page.html';
|
| + document.body.appendChild(iframe);
|
| +
|
| + iframe.onload = A_04_05_01_T2.step_func(function () {
|
| + try {
|
| + var d = iframe.contentDocument;
|
| + var ul = d.querySelector('ul.stories');
|
| +
|
| + //make old shadow subtree
|
| + var s1 = ul.createShadowRoot();
|
| + var subdiv1 = d.createElement('div');
|
| + subdiv1.innerHTML = '<ul><content select=".shadow"></content></ul>';
|
| + s1.appendChild(subdiv1);
|
| +
|
| + //make younger shadow subtree
|
| + var s2 = ul.createShadowRoot();
|
| + var subdiv2 = d.createElement('div');
|
| + subdiv2.innerHTML = '<ul><content select=".shadow2"></content></ul>';
|
| + s2.appendChild(subdiv2);
|
| +
|
| + //add a shadow insertion point for the older tree
|
| + s2.appendChild(d.createElement('shadow'));
|
| +
|
| + //The order of DOM elements should be the following:
|
| + //li4, li3, li6 visible. Other elements invisible
|
| + assert_true(d.querySelector('#li4').offsetTop > 0,
|
| + 'Younger tree should take part in the distribution');
|
| + assert_true(d.querySelector('#li3').offsetTop > d.querySelector('#li4').offsetTop,
|
| + 'Point 1: Older tree should take part in the distribution');
|
| + assert_true(d.querySelector('#li6').offsetTop > d.querySelector('#li3').offsetTop,
|
| + 'Point 2: Older tree should take part in the distribution');
|
| +
|
| + assert_equals(d.querySelector('#li1').offsetTop, 0,
|
| + 'Point 3: Elements that don\'t mach insertion point criteria participate in distribution');
|
| + assert_equals(d.querySelector('#li2').offsetTop, 0,
|
| + 'Point 4: Elements that don\'t mach insertion point criteria participate in distribution');
|
| + assert_equals(d.querySelector('#li5').offsetTop, 0,
|
| + 'Point 5: Elements that don\'t mach insertion point criteria participate in distribution');
|
| + } finally {
|
| + iframe.parentNode.removeChild(iframe);
|
| + }
|
| + A_04_05_01_T2.done();
|
| + });
|
| +});
|
| +</script>
|
| +</body>
|
| +</html>
|
|
|