Title: [160037] trunk/LayoutTests/imported/w3c
Revision
160037
Author
[email protected]
Date
2013-12-03 14:19:32 -0800 (Tue, 03 Dec 2013)

Log Message

Import the XHTML parsing and serialization tests for template elements
https://bugs.webkit.org/show_bug.cgi?id=125131

Reviewed by Antti Koivisto.

Import the tests for parsing XHTML documents and fragments at f744661dbd0c29bb6a54c1530f9843838eec1300
after self-closing link elements in template-child-nodes-div.xhtml and template-child-nodes-nested.xhtml
as these two files would encounter parser errors otherwise (I'll be merging these changes back into
the web-platform-tests repository later).

This completes the importation of W3C tests for the HTML template element.

* html-templates/additions-to-parsing-xhtml-documents: Added.
* html-templates/additions-to-parsing-xhtml-documents/node-document-expected.txt: Added.
* html-templates/additions-to-parsing-xhtml-documents/node-document.html: Added.
* html-templates/additions-to-parsing-xhtml-documents/template-child-nodes-expected.txt: Added.
* html-templates/additions-to-parsing-xhtml-documents/template-child-nodes.html: Added.
* html-templates/additions-to-serializing-xhtml-documents: Added.
* html-templates/additions-to-serializing-xhtml-documents/outerhtml-expected.txt: Added.
* html-templates/additions-to-serializing-xhtml-documents/outerhtml.html: Added.
* html-templates/resources/template-child-nodes-div.xhtml:
* html-templates/resources/template-child-nodes-nested.xhtml:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (160036 => 160037)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2013-12-03 21:53:21 UTC (rev 160036)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2013-12-03 22:19:32 UTC (rev 160037)
@@ -1,3 +1,28 @@
+2013-12-03  Ryosuke Niwa  <[email protected]>
+
+        Import the XHTML parsing and serialization tests for template elements
+        https://bugs.webkit.org/show_bug.cgi?id=125131
+
+        Reviewed by Antti Koivisto.
+
+        Import the tests for parsing XHTML documents and fragments at f744661dbd0c29bb6a54c1530f9843838eec1300
+        after self-closing link elements in template-child-nodes-div.xhtml and template-child-nodes-nested.xhtml
+        as these two files would encounter parser errors otherwise (I'll be merging these changes back into
+        the web-platform-tests repository later).
+
+        This completes the importation of W3C tests for the HTML template element.
+
+        * html-templates/additions-to-parsing-xhtml-documents: Added.
+        * html-templates/additions-to-parsing-xhtml-documents/node-document-expected.txt: Added.
+        * html-templates/additions-to-parsing-xhtml-documents/node-document.html: Added.
+        * html-templates/additions-to-parsing-xhtml-documents/template-child-nodes-expected.txt: Added.
+        * html-templates/additions-to-parsing-xhtml-documents/template-child-nodes.html: Added.
+        * html-templates/additions-to-serializing-xhtml-documents: Added.
+        * html-templates/additions-to-serializing-xhtml-documents/outerhtml-expected.txt: Added.
+        * html-templates/additions-to-serializing-xhtml-documents/outerhtml.html: Added.
+        * html-templates/resources/template-child-nodes-div.xhtml:
+        * html-templates/resources/template-child-nodes-nested.xhtml:
+
 2013-11-26  Ryosuke Niwa  <[email protected]>
 
         Import W3C tests for cloning template elements and default stylesheet for template element

Added: trunk/LayoutTests/imported/w3c/html-templates/additions-to-parsing-xhtml-documents/node-document-expected.txt (0 => 160037)


--- trunk/LayoutTests/imported/w3c/html-templates/additions-to-parsing-xhtml-documents/node-document-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/html-templates/additions-to-parsing-xhtml-documents/node-document-expected.txt	2013-12-03 22:19:32 UTC (rev 160037)
@@ -0,0 +1,7 @@
+
+PASS Parsing XHTML: Node's node document must be set to that of the element to which it will be appended. Test empty template 
+PASS Parsing XHTML: Node's node document must be set to that of the element to which it will be appended. Test not empty template 
+PASS Parsing XHTML: Node's node document must be set to that of the element to which it will be appended. Test nested templates 
+PASS Parsing XHTML: Node's node document must be set to that of the element to which it will be appended. Test loading XHTML document from a file 
+PASS Parsing XHTML: Node's node document must be set to that of the element to which it will be appended. Test loading of XHTML document with nested templates from a file 
+

Added: trunk/LayoutTests/imported/w3c/html-templates/additions-to-parsing-xhtml-documents/node-document.html (0 => 160037)


--- trunk/LayoutTests/imported/w3c/html-templates/additions-to-parsing-xhtml-documents/node-document.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/html-templates/additions-to-parsing-xhtml-documents/node-document.html	2013-12-03 22:19:32 UTC (rev 160037)
@@ -0,0 +1,148 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>HTML Templates: Parsing XHTML: Node's node document</title>
+<meta name="author" title="Sergey G. Grekhov" href=""
+<meta name="author" title="Aleksei Yu. Semenov" href=""
+<meta name="assert" content="Parsing XHTML: Node's node document must be set to that of the element to which it will be appended">
+<link rel="help" href=""
+<script src=""
+<script src=""
+<script src=''></script>
+<link rel="stylesheet" href=""
+</head>
+<body>
+<div id="log"></div>
+<script type="text/_javascript_">
+
+
+
+test(function() {
+    var doc = newXHTMLDocument();
+    doc.body = doc.createElement('body');
+    doc.body.innerHTML = '<template id="tmpl"></template>';
+
+    var template = doc.querySelector('#tmpl');
+
+    assert_not_equals(template, null, 'Template element should not be null');
+    assert_not_equals(template.content, undefined,
+            'Content attribute of template element should not be undefined');
+    assert_not_equals(template.content, null,
+            'Content attribute of template element should not be null');
+
+    assert_equals(template.ownerDocument, doc.body.ownerDocument,
+            'Wrong template node owner document');
+    assert_equals(template.content.ownerDocument, doc,
+            'Wrong template content owner document');
+
+}, 'Parsing XHTML: Node\'s node document must be set to that of the element '
+    + 'to which it will be appended. Test empty template');
+
+
+
+test(function() {
+    var doc = newXHTMLDocument();
+
+    doc.body = doc.createElement('body');
+    doc.body.innerHTML = '<template id="tmpl"><div>Div content</div></template>';
+
+    var template = doc.querySelector('#tmpl');
+
+    assert_equals(template.ownerDocument, doc.body.ownerDocument,
+            'Wrong template node owner document');
+
+    assert_not_equals(template, null, 'Template element should not be null');
+    assert_not_equals(template.content, undefined,
+            'Content attribute of template element should not be undefined');
+    assert_not_equals(template.content, null,
+            'Content attribute of template element should not be null');
+
+    var div = template.content.querySelector('div');
+    assert_equals(template.content.ownerDocument, div.ownerDocument,
+            'Wrong DIV node owner document');
+
+}, 'Parsing XHTML: Node\'s node document must be set to that of the element '
+    + 'to which it will be appended. Test not empty template');
+
+
+
+test(function() {
+    var doc = newXHTMLDocument();
+    doc.body = doc.createElement('body');
+    doc.body.innerHTML = ''
+            + '<template id="tmpl"><div>Div content</div> And some more text'
+            + '<template id="tmpl2"><div>Template content</div></template>'
+            + '</template>';
+
+    var template = doc.querySelector('#tmpl');
+    assert_not_equals(template, null, 'Template element should not be null');
+    assert_equals(template.ownerDocument, doc, 'Wrong template node owner document');
+    assert_not_equals(template.content, undefined,
+            'Content attribute of template element should not be undefined');
+    assert_not_equals(template.content, null,
+            'Content attribute of template element should not be null');
+
+    var nestedTemplate = template.content.querySelector('#tmpl2');
+    assert_not_equals(nestedTemplate, null, 'Nested template element should not be null');
+    assert_not_equals(nestedTemplate.content, undefined,
+            'Content attribute of nested template element should not be undefined');
+    assert_not_equals(nestedTemplate.content, null,
+            'Content attribute of nested template element should not be null');
+
+    assert_equals(nestedTemplate.ownerDocument, template.content.ownerDocument,
+            'Wrong nested template node owner document');
+
+
+    var div = nestedTemplate.content.querySelector('div');
+    assert_equals(nestedTemplate.content.ownerDocument, div.ownerDocument,
+            'Wrong DIV node owner document');
+
+}, 'Parsing XHTML: Node\'s node document must be set to that of the element '
+    + 'to which it will be appended. Test nested templates');
+
+
+
+testInIFrame('../resources/template-child-nodes-div.xhtml', function(context) {
+    var doc = context.iframes[0].contentDocument;
+
+    var template = doc.querySelector('template');
+
+    assert_equals(template.ownerDocument, doc, 'Wrong template node owner document');
+
+    assert_not_equals(template.content, undefined,
+            'Content attribute of template element should not be undefined');
+    assert_not_equals(template.content, null,
+            'Content attribute of template element should not be null');
+
+    var div = template.content.querySelector('div');
+    assert_equals(template.content.ownerDocument, div.ownerDocument,
+            'Wrong DIV node owner document');
+
+}, 'Parsing XHTML: Node\'s node document must be set to that of the element '
+    + 'to which it will be appended. Test loading XHTML document from a file');
+
+
+
+testInIFrame('../resources/template-child-nodes-nested.xhtml', function(context) {
+    var doc = context.iframes[0].contentDocument;
+
+    var template = doc.querySelector('template');
+
+    assert_equals(template.ownerDocument, doc, 'Wrong template node owner document');
+
+    var nestedTemplate = template.content.querySelector('template');
+
+    assert_equals(nestedTemplate.ownerDocument, template.content.ownerDocument,
+            'Wrong template node owner document');
+
+    var div = nestedTemplate.content.querySelector('div');
+    assert_equals(nestedTemplate.content.ownerDocument, div.ownerDocument,
+            'Wrong DIV node owner document');
+
+}, 'Parsing XHTML: Node\'s node document must be set to that of the element '
+    + 'to which it will be appended. Test loading of XHTML document '
+    + 'with nested templates from a file');
+
+</script>
+</body>
+</html>

Added: trunk/LayoutTests/imported/w3c/html-templates/additions-to-parsing-xhtml-documents/template-child-nodes-expected.txt (0 => 160037)


--- trunk/LayoutTests/imported/w3c/html-templates/additions-to-parsing-xhtml-documents/template-child-nodes-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/html-templates/additions-to-parsing-xhtml-documents/template-child-nodes-expected.txt	2013-12-03 22:19:32 UTC (rev 160037)
@@ -0,0 +1,6 @@
+
+PASS Child nodes of template element in XHTML documents must be appended to template content 
+PASS Child nodes of nested template element in XHTML documents must be appended to template content 
+PASS Child nodes of template element in XHTML documents must be appended to template content. Test loading XHTML document from a file 
+PASS Child nodes of nested template element in XHTML documents must be appended to template content. Test loading XHTML document from a file 
+

Added: trunk/LayoutTests/imported/w3c/html-templates/additions-to-parsing-xhtml-documents/template-child-nodes.html (0 => 160037)


--- trunk/LayoutTests/imported/w3c/html-templates/additions-to-parsing-xhtml-documents/template-child-nodes.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/html-templates/additions-to-parsing-xhtml-documents/template-child-nodes.html	2013-12-03 22:19:32 UTC (rev 160037)
@@ -0,0 +1,103 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>HTML Templates: Child nodes of template element in XHTML documents</title>
+<meta name="author" title="Sergey G. Grekhov" href=""
+<meta name="author" title="Aleksei Yu. Semenov" href=""
+<meta name="assert" content="Child nodes of template element in XHTML documents are always appended to the template content (instead of template itself)">
+<link rel="help" href=""
+<script src=""
+<script src=""
+<script src=''></script>
+<link rel="stylesheet" href=""
+</head>
+<body>
+<div id="log"></div>
+<script type="text/_javascript_">
+
+
+test(function() {
+    var doc = newXHTMLDocument();
+
+    doc.body = doc.createElement('body');
+    doc.body.innerHTML = '<template id="tmpl1">'
+            + '<div id="div1">This is div inside template</div>'
+            + '<div id="div2">This is another div inside template</div>'
+            + '</template>';
+
+    var template = doc.querySelector('#tmpl1');
+
+    assert_equals(template.childNodes.length, 0,
+            'Wrong number of template child nodes');
+    assert_equals(template.content.childNodes.length, 2,
+            'Wrong number of template content child nodes');
+
+}, 'Child nodes of template element in XHTML documents must be appended to template content');
+
+
+
+test(function() {
+    var doc = newXHTMLDocument();
+    doc.body = doc.createElement('body');
+    doc.body.innerHTML = '<template id="tmpl1">'
+            + '<div id="div1">This is div inside template</div>'
+            + '<div id="div2">This is another div inside template</div>'
+            + '<template id="tmpl2">'
+            + '<div id="div3">This is div inside nested template</div>'
+            + '<div id="div4">This is another div inside nested template</div>'
+            + '</template>' + '</template>';
+
+    var template = doc.querySelector('#tmpl1');
+
+    assert_equals(template.childNodes.length, 0,
+            'Wrong number of template child nodes');
+    assert_equals(template.content.childNodes.length, 3,
+            'Wrong number of template content child nodes');
+
+    var nestedTemplate = template.content.querySelector('#tmpl2');
+
+    assert_equals(nestedTemplate.childNodes.length, 0,
+            'Wrong number of template child nodes');
+    assert_equals(nestedTemplate.content.childNodes.length, 2,
+            'Wrong number of nested template content child nodes');
+
+}, 'Child nodes of nested template element in XHTML documents must be appended to template content');
+
+
+
+testInIFrame('../resources/template-child-nodes-div.xhtml', function(context) {
+    var doc = context.iframes[0].contentDocument;
+
+    var template = doc.querySelector('template');
+
+    assert_equals(template.childNodes.length, 0,
+            'Wrong number of template child nodes');
+    assert_equals(template.content.querySelectorAll('div').length, 2,
+            'Wrong number of template content child nodes');
+
+}, 'Child nodes of template element in XHTML documents must be appended to template content. '
+    + 'Test loading XHTML document from a file');
+
+
+testInIFrame('../resources/template-child-nodes-nested.xhtml', function(context) {
+    var doc = context.iframes[0].contentDocument;
+
+    var template = doc.querySelector('template');
+
+    assert_equals(template.childNodes.length, 0,
+            'Wrong number of template child nodes');
+
+    var nestedTemplate = template.content.querySelector('template');
+
+    assert_equals(nestedTemplate.childNodes.length, 0,
+            'Wrong number of template child nodes');
+
+    assert_equals(nestedTemplate.content.querySelectorAll('div').length, 2,
+            'Wrong number of template content child nodes');
+
+}, 'Child nodes of nested template element in XHTML documents must be appended to template content. '
+    + 'Test loading XHTML document from a file');
+
+</script>
+</body>
+</html>

Added: trunk/LayoutTests/imported/w3c/html-templates/additions-to-serializing-xhtml-documents/outerhtml-expected.txt (0 => 160037)


--- trunk/LayoutTests/imported/w3c/html-templates/additions-to-serializing-xhtml-documents/outerhtml-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/html-templates/additions-to-serializing-xhtml-documents/outerhtml-expected.txt	2013-12-03 22:19:32 UTC (rev 160037)
@@ -0,0 +1,5 @@
+
+PASS Template contents should be serialized instead of template element if serializing template element 
+PASS Template contents should be serialized instead of template element if serializing template element. Test nested template 
+PASS Template contents should be serialized instead of template element if serializing template element. Test serializing whole document 
+

Added: trunk/LayoutTests/imported/w3c/html-templates/additions-to-serializing-xhtml-documents/outerhtml.html (0 => 160037)


--- trunk/LayoutTests/imported/w3c/html-templates/additions-to-serializing-xhtml-documents/outerhtml.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/html-templates/additions-to-serializing-xhtml-documents/outerhtml.html	2013-12-03 22:19:32 UTC (rev 160037)
@@ -0,0 +1,72 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>HTML Templates: serialize template contents instead of template element</title>
+<meta name="author" title="Aleksei Yu. Semenov" href=""
+<meta name="assert" content="Template contents should be serialized instead of template element if serializing template element in XHTML document">
+<link rel="help" href=""
+<script src=""
+<script src=""
+<script src=''></script>
+<link rel="stylesheet" href=""
+</head>
+<body>
+<div id="log"></div>
+<script type="text/_javascript_">
+
+test(function () {
+    var doc = newXHTMLDocument();
+    var template = doc.createElement('template');
+
+    var div = doc.createElement('div');
+    div.setAttribute('id', 'div1');
+    div.innerHTML = 'some text';
+    template.content.appendChild(div);
+
+    assert_equals(template.outerHTML, '<template xmlns="http://www.w3.org/1999/xhtml"><div id="div1">some text</div></template>',
+       'template element is serialized incorrectly');
+
+}, 'Template contents should be serialized instead of template element if serializing template element');
+
+
+
+test(function () {
+    var doc = newXHTMLDocument();
+    var template = doc.createElement('template');
+    var nestedTemplate = doc.createElement('template');
+
+    template.content.appendChild(nestedTemplate);
+
+    var div = doc.createElement('div');
+    div.setAttribute('id', 'div1');
+    div.innerHTML = 'some text';
+    nestedTemplate.content.appendChild(div);
+
+    assert_equals(template.outerHTML, '<template xmlns="http://www.w3.org/1999/xhtml"><template><div id="div1">some text</div></template></template>',
+       'template element is serialized incorrectly');
+
+
+}, 'Template contents should be serialized instead of template element if serializing template element. '
+    + 'Test nested template');
+
+
+test(function () {
+    var doc = newXHTMLDocument();
+    var template = doc.createElement('template');
+
+    var div = doc.createElement('div');
+    div.setAttribute('id', 'div1');
+    div.innerHTML = 'some text';
+    template.content.appendChild(div);
+    doc.body = doc.createElement('body');
+    doc.body.appendChild(template);
+
+    assert_equals(doc.documentElement.outerHTML, '<html xmlns="http://www.w3.org/1999/xhtml"><body><template><div id="div1">some text</div></template></body></html>',
+       'template element is serialized incorrectly');
+
+}, 'Template contents should be serialized instead of template element if serializing template element. '
+    + 'Test serializing whole document');
+
+</script>
+</body>
+</html>

Modified: trunk/LayoutTests/imported/w3c/html-templates/resources/template-child-nodes-div.xhtml (160036 => 160037)


--- trunk/LayoutTests/imported/w3c/html-templates/resources/template-child-nodes-div.xhtml	2013-12-03 21:53:21 UTC (rev 160036)
+++ trunk/LayoutTests/imported/w3c/html-templates/resources/template-child-nodes-div.xhtml	2013-12-03 22:19:32 UTC (rev 160037)
@@ -2,7 +2,7 @@
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
 	<title>Template tag with children div tags inside</title>
-    <link rel="author" title="Aleksei Yu. Semenov" href=""
+    <link rel="author" title="Aleksei Yu. Semenov" href=""
 </head>
 <body>
 	<p>Template tag with div tags inside</p>

Modified: trunk/LayoutTests/imported/w3c/html-templates/resources/template-child-nodes-nested.xhtml (160036 => 160037)


--- trunk/LayoutTests/imported/w3c/html-templates/resources/template-child-nodes-nested.xhtml	2013-12-03 21:53:21 UTC (rev 160036)
+++ trunk/LayoutTests/imported/w3c/html-templates/resources/template-child-nodes-nested.xhtml	2013-12-03 22:19:32 UTC (rev 160037)
@@ -2,7 +2,7 @@
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
 	<title>Template tag with children div tags inside another template tag</title>
-    <link rel="author" title="Aleksei Yu. Semenov" href=""
+    <link rel="author" title="Aleksei Yu. Semenov" href=""
 </head>
 <body>
 	<p>Template tag with children div tags inside another template tag</p>
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to