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

Side by Side Diff: LayoutTests/imported/web-platform-tests/html/semantics/scripting-1/the-template-element/innerhtml-on-templates/innerhtml.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: innerHTML of template element replaces all referenced by the content attribute</title>
5 <meta name="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
6 <meta name="author" title="Aleksei Yu. Semenov" href="a.semenov@unipro.ru">
7 <meta name="assert" content="innerHTML of template element replaces all referenc ed by the content attribute">
8 <link rel="help" href="http://www.w3.org/TR/2013/WD-html-templates-20130214/#inn erhtml-on-templates">
9 <script src="../../../../../../../resources/testharness.js"></script>
10 <script src="../../../../../../../resources/testharnessreport.js"></script>
11 <script src='/html/resources/common.js'></script>
12 <link rel="stylesheet" href="../../../../../../../resources/testharness.css">
13 </head>
14 <body>
15 <div id="log"></div>
16 <script type="text/javascript">
17
18 test(function () {
19 var doc = newHTMLDocument();
20 var template = doc.createElement('template');
21
22 var div1 = doc.createElement('div');
23 div1.setAttribute('id', 'div1');
24 template.content.appendChild(div1);
25
26 assert_not_equals(template.content.querySelector('#div1'), null,
27 'Element should present in template content');
28
29 template.innerHTML = '<div id="div2"></div>';
30
31 assert_equals(template.content.querySelector('#div1'), null,
32 'Template content should be replaced by innerHTML');
33 assert_not_equals(template.content.querySelector('#div2'), null,
34 'Element should present in template content');
35
36 }, 'innerHTML of template element replaces all referenced by the content attribu te');
37
38
39
40 test(function () {
41 var doc = newHTMLDocument();
42 var template = doc.createElement('template');
43 var nestedTemplate = doc.createElement('template');
44
45 template.content.appendChild(nestedTemplate);
46
47 var div1 = doc.createElement('div');
48 div1.setAttribute('id', 'div1');
49 nestedTemplate.content.appendChild(div1);
50
51 assert_not_equals(nestedTemplate.content.querySelector('#div1'), null,
52 'Element should present in template content');
53
54 nestedTemplate.innerHTML = '<div id="div2"></div>';
55
56 assert_equals(nestedTemplate.content.querySelector('#div1'), null,
57 'Template content should be replaced by innerHTML');
58 assert_not_equals(nestedTemplate.content.querySelector('#div2'), null,
59 'Element should present in template content');
60
61 }, 'innerHTML of template element replaces all referenced by the content attribu te. '
62 + 'Test nested template');
63
64
65 testInIFrame('../resources/template-contents.html', function(context) {
66 var doc = context.iframes[0].contentDocument;
67
68 var template = doc.querySelector('template');
69 assert_not_equals(template.content.querySelector('div'), null,
70 'Div element should present in template content');
71
72 template.innerHTML = '<span>span internals</span>';
73
74 assert_equals(template.content.querySelector('div'), null,
75 'div element should be replaced by span in template content');
76
77 assert_not_equals(template.content.querySelector('span'), null,
78 'span element should present in template content');
79
80
81 }, 'innerHTML of template element replaces all referenced by the content attribu te. '
82 + 'Test loading of HTML document from a file');
83
84
85 </script>
86 </body>
87 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698