Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: LayoutTests/imported/web-platform-tests/html/semantics/scripting-1/the-template-element/definitions/template-contents.html

Issue 1305983002: web-platform-tests: Skip tests for <template>. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>HTML Templates: The template contents is a DocumentFragment</title>
5 <meta name="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
6 <meta name="assert" content="The template contents must be a DocumentFragment">
7 <link rel="help" href="http://www.w3.org/TR/2013/WD-html-templates-20130214/#def initions">
8 <script src="../../../../../../../resources/testharness.js"></script>
9 <script src="../../../../../../../resources/testharnessreport.js"></script>
10 <script src='/html/resources/common.js'></script>
11 <link rel="stylesheet" href="../../../../../../../resources/testharness.css">
12 </head>
13 <body>
14 <div id="log"></div>
15 <script type="text/javascript">
16
17
18 test(function() {
19 var doc = newHTMLDocument();
20 var template = doc.createElement('template');
21
22 doc.body.appendChild(template);
23
24 assert_equals(template.content.nodeType, Node.DOCUMENT_FRAGMENT_NODE,
25 'Template content should be a DocumentFragment');
26
27 assert_class_string(template.content, 'DocumentFragment',
28 'Template content class should be a DocumentFragment');
29
30 }, 'The template contents must be a DocumentFragment (empty template)');
31
32
33 test(function() {
34 var doc = newHTMLDocument();
35 var template = doc.createElement('template');
36
37 template.innerHTML = '<div>This is a div</div><span>This is a span</span>';
38
39 doc.body.appendChild(template);
40
41 assert_equals(template.content.nodeType, Node.DOCUMENT_FRAGMENT_NODE,
42 'Template content should be a DocumentFragment');
43
44 assert_class_string(template.content, 'DocumentFragment',
45 'Template content class should be a DocumentFragment');
46
47 }, 'The template contents must be a DocumentFragment (non empty template)');
48
49
50
51 test(function() {
52 var doc = newHTMLDocument();
53 var template = doc.createElement('template');
54
55 template.innerHTML = '<div>This is a div</div>';
56
57 doc.body.appendChild(template);
58
59 assert_equals(template.content.nodeType, Node.DOCUMENT_FRAGMENT_NODE,
60 'Template content should be a documentFragment');
61
62 }, 'The template contents must be a DocumentFragment (non empty template '
63 + 'containing div which is an Element instance)');
64
65
66 test(function() {
67 var doc = newHTMLDocument();
68 var template = doc.createElement('template');
69
70 template.innerHTML = 'Some text';
71
72 doc.body.appendChild(template);
73
74 assert_equals(template.content.nodeType, Node.DOCUMENT_FRAGMENT_NODE,
75 'Template content should be a documentFragment');
76
77 assert_class_string(template.content, 'DocumentFragment',
78 'Template content class should be a DocumentFragment');
79
80 }, 'The template contents must be a DocumentFragment (not empty template '
81 + 'containing text node)');
82
83
84 test(function() {
85 var doc = newHTMLDocument();
86 var template = doc.createElement('template');
87
88 template.innerHTML = '<template id="t2">Some text</template>';
89
90 doc.body.appendChild(template);
91
92 assert_equals(template.content.nodeType, Node.DOCUMENT_FRAGMENT_NODE,
93 'Template content should be a documentFragment');
94 assert_class_string(template.content, 'DocumentFragment',
95 'Template content class should be a DocumentFragment');
96
97 var nestedTemplate = template.content.querySelector("#t2");
98 assert_equals(nestedTemplate.content.nodeType, Node.DOCUMENT_FRAGMENT_NODE,
99 'Nested template content should be a documentFragment');
100
101 assert_class_string(nestedTemplate.content, 'DocumentFragment',
102 'Nested template content class should be a DocumentFragment');
103
104
105 }, 'The template contents must be a DocumentFragment (nested template '
106 + 'containing a text node)');
107
108
109 testInIFrame('../resources/template-contents-empty.html', function(context) {
110 var doc = context.iframes[0].contentDocument;
111
112 var template = doc.querySelector('template');
113
114 assert_equals(template.content.nodeType, Node.DOCUMENT_FRAGMENT_NODE,
115 'Template content should be a documentFragment');
116 assert_class_string(template.content, 'DocumentFragment',
117 'Template content class should be a DocumentFragment');
118
119
120 }, 'The template contents must be a DocumentFragment (the empty template tag '
121 + 'inside HTML file loaded in iframe)');
122
123
124 testInIFrame('../resources/template-contents.html', function(context) {
125 var doc = context.iframes[0].contentDocument;
126
127 var template = doc.querySelector('template');
128
129 assert_equals(template.content.nodeType, Node.DOCUMENT_FRAGMENT_NODE,
130 'Template content should be a documentFragment');
131 assert_class_string(template.content, 'DocumentFragment',
132 'Template content class should be a DocumentFragment');
133
134 }, 'The template contents must be a DocumentFragment (non empty template '
135 + 'tag inside HTML file loaded in iframe)');
136
137
138 testInIFrame('../resources/template-contents-text.html', function(context) {
139 var doc = context.iframes[0].contentDocument;
140
141 var template = doc.querySelector('template');
142
143 assert_equals(template.content.nodeType, Node.DOCUMENT_FRAGMENT_NODE,
144 'Template content should be a documentFragment');
145 assert_class_string(template.content, 'DocumentFragment',
146 'Template content class should be a DocumentFragment');
147
148 }, 'The template contents must be a DocumentFragment (the template tag '
149 + 'with some text inside HTML file loaded in iframe)');
150
151
152 testInIFrame('../resources/template-contents-nested.html', function(context) {
153 var doc = context.iframes[0].contentDocument;
154
155 var template = doc.querySelector('template');
156
157 assert_equals(template.content.nodeType, Node.DOCUMENT_FRAGMENT_NODE,
158 'Template content should be a documentFragment');
159 assert_class_string(template.content, 'DocumentFragment',
160 'Template content class should be a DocumentFragment');
161
162 var nestedTemplate = template.content.querySelector("template");
163
164 assert_equals(nestedTemplate.content.nodeType, Node.DOCUMENT_FRAGMENT_NODE,
165 'Nested template content should be a documentFragment');
166 assert_class_string(nestedTemplate.content, 'DocumentFragment',
167 'Nested template content class should be a DocumentFragment');
168
169 }, 'The template contents must be a DocumentFragment (the template tag '
170 + 'with nested template tag inside HTML file loaded in iframe)');
171 </script>
172 </body>
173 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698