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].
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
13 <title>Shadow DOM Test: A_09_00_01</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/#html-elements-and-their-shadow-trees">
16 <meta name="assert" content="HTML Elements and Their Shadow Trees: If the element can have fallback content, UA should allow the shadow tree to contain at least one insertion point.">
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">
26 test(unit(function (ctx) {
28 var d = newRenderedHTMLDocument(ctx);
31 var el = d.createElement('iframe');
32 d.body.appendChild(el);
35 '<span id="shadow">This is a node that should be distributed</span>' +
36 '<span id="flbk">This is a fallback content</span>';
38 var s = el.createShadowRoot();
39 s.innerHTML = '<content select="#shadow"></content>';
41 assert_true(d.querySelector('#shadow').offsetTop > 0, 'Iframe should allow at least one insertion point');
42 assert_equals(d.querySelector('#flbk').offsetTop, 0, 'Fallback content shouldn\'t be rendered');
44 }), 'A_09_00_01_T01');
48 test(unit(function (ctx) {
50 var d = newRenderedHTMLDocument(ctx);
53 var el = d.createElement('object');
54 d.body.appendChild(el);
57 '<span id="shadow">This is a node that should be distributed</span>' +
58 '<span id="flbk">This is a fallback content</span>';
60 var s = el.createShadowRoot();
61 s.innerHTML = '<content select="#shadow"></content>';
63 assert_true(d.querySelector('#shadow').offsetTop > 0, 'object should allow at least one insertion point');
64 assert_equals(d.querySelector('#flbk').offsetTop, 0, 'Fallback content shouldn\'t be rendered');
66 }), 'A_09_00_01_T02');
70 test(unit(function (ctx) {
72 var d = newRenderedHTMLDocument(ctx);
75 var el = d.createElement('video');
76 d.body.appendChild(el);
79 '<span id="shadow">This is a node that should be distributed</span>' +
80 '<span id="flbk">This is a fallback content</span>';
82 var s = el.createShadowRoot();
83 s.innerHTML = '<content select="#shadow"></content>';
85 assert_true(d.querySelector('#shadow').offsetTop > 0, 'video should allow at least one insertion point');
86 assert_equals(d.querySelector('#flbk').offsetTop, 0, 'Fallback content shouldn\'t be rendered');
88 }), 'A_09_00_01_T03');
92 test(unit(function (ctx) {
94 var d = newRenderedHTMLDocument(ctx);
97 var el = d.createElement('audio');
98 d.body.appendChild(el);
101 '<span id="shadow">This is a node that should be distributed</span>' +
102 '<span id="flbk">This is a fallback content</span>';
104 var s = el.createShadowRoot();
105 s.innerHTML = '<content select="#shadow"></content>';
107 assert_true(d.querySelector('#shadow').offsetTop > 0, 'audio should allow at least one insertion point');
108 assert_equals(d.querySelector('#flbk').offsetTop, 0, 'Fallback content shouldn\'t be rendered');
110 }), 'A_09_00_01_T04');
114 test(unit(function (ctx) {
116 var d = newRenderedHTMLDocument(ctx);
119 var el = d.createElement('canvas');
120 d.body.appendChild(el);
123 '<span id="shadow">This is a node that should be distributed</span>' +
124 '<span id="flbk">This is a fallback content</span>';
126 var s = el.createShadowRoot();
127 s.innerHTML = '<content select="#shadow"></content>';
129 assert_true(d.querySelector('#shadow').offsetTop > 0, 'canvas should allow at least one insertion point');
130 assert_equals(d.querySelector('#flbk').offsetTop, 0, 'Fallback content shouldn\'t be rendered');
132 }), 'A_09_00_01_T05');
136 test(unit(function (ctx) {
138 var d = newRenderedHTMLDocument(ctx);
140 var img = d.createElement('img');
141 img.setAttribute('usemap', '#theMap');
142 img.setAttribute('width', '20px');
143 img.setAttribute('height', '20px');
144 d.body.appendChild(img);
148 var el = d.createElement('map');
149 el.setAttribute('name', 'theMap');
150 d.body.appendChild(el);
153 '<span id="shadow">This is a node that should be distributed</span>' +
154 '<span id="flbk">This is a fallback content</span>';
157 var s = el.createShadowRoot();
158 s.innerHTML = '<content select="#shadow"></content>';
160 assert_true(d.querySelector('#shadow').offsetTop > 0, 'map should allow at least one insertion point');
161 assert_equals(d.querySelector('#flbk').offsetTop, 0, 'Fallback content shouldn\'t be rendered');
163 }), 'A_09_00_01_T06');
167 test(unit(function (ctx) {
169 var d = newRenderedHTMLDocument(ctx);
172 var el = d.createElement('textarea');
173 d.body.appendChild(el);
176 '<span id="shadow">This is a node that should be distributed</span>' +
177 '<span id="flbk">This is a fallback content</span>';
179 var s = el.createShadowRoot();
180 s.innerHTML = '<content select="#shadow"></content>';
182 assert_true(d.querySelector('#shadow').offsetTop > 0, 'textarea should allow at least one insertion point');
183 assert_equals(d.querySelector('#flbk').offsetTop, 0, 'Fallback content shouldn\'t be rendered');
185 }), 'A_09_00_01_T07');
189 test(unit(function (ctx) {
191 var d = newRenderedHTMLDocument(ctx);
194 var el = d.createElement('progress');
195 d.body.appendChild(el);
198 '<span id="shadow">This is a node that should be distributed</span>' +
199 '<span id="flbk">This is a fallback content</span>';
201 var s = el.createShadowRoot();
202 s.innerHTML = '<content select="#shadow"></content>';
204 assert_true(d.querySelector('#shadow').offsetTop > 0, 'progress should allow at least one insertion point');
205 assert_equals(d.querySelector('#flbk').offsetTop, 0, 'Fallback content shouldn\'t be rendered');
207 }), 'A_09_00_01_T08');
211 test(unit(function (ctx) {
213 var d = newRenderedHTMLDocument(ctx);
216 var el = d.createElement('meter');
217 d.body.appendChild(el);
220 '<span id="shadow">This is a node that should be distributed</span>' +
221 '<span id="flbk">This is a fallback content</span>';
223 var s = el.createShadowRoot();
224 s.innerHTML = '<content select="#shadow"></content>';
226 assert_true(d.querySelector('#shadow').offsetTop > 0, 'meter should allow at least one insertion point');
227 assert_equals(d.querySelector('#flbk').offsetTop, 0, 'Fallback content shouldn\'t be rendered');
229 }), 'A_09_00_01_T09');