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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/dom/Node/initial-values.html

Issue 2667393002: Stop using script-tests in fast/dom/. (Closed)
Patch Set: . Created 3 years, 10 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
OLDNEW
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../../../resources/js-test.js"></script> 4 <script src="../../../resources/js-test.js"></script>
5 </head> 5 </head>
6 <body> 6 <body>
7 <script src="script-tests/initial-values.js"></script> 7 <script>
8 description("Test creation of each type of Node and check initial values")
9
10 var xmlDoc = document.implementation.createDocument("http://www.w3.org/1999/xhtm l", "html", null);
11
12 debug("Attribute creation using createElement on an HTML doc:")
13 var attr = document.createAttribute("foo");
14 shouldBe("attr.nodeName", "'foo'");
15 shouldBe("attr.name", "'foo'");
16 // Spec: http://www.w3.org/TR/DOM-Level-2-Core/core.html#Level-2-Core-DOM-create Attribute
17 // Both FF and WebKit return "foo" for Attribute.localName, even though the spec says null
18 shouldBe("attr.localName", "null");
19 shouldBe("attr.namespaceURI", "null");
20 shouldBe("attr.prefix", "null");
21 shouldBe("attr.value", "''");
22
23 debug("Attribute creation using createElementNS on an HTML doc:")
24 attr = document.createAttributeNS("http://www.example.com", "example:foo");
25 shouldBe("attr.nodeName", "'example:foo'");
26 shouldBe("attr.name", "'example:foo'");
27 shouldBe("attr.localName", "'foo'");
28 shouldBe("attr.namespaceURI", "'http://www.example.com'");
29 shouldBe("attr.prefix", "'example'");
30 shouldBe("attr.nodeValue", "''");
31 shouldBe("attr.value", "''");
32
33 debug("Attribute creation using createElement on an XHTML doc:")
34 attr = xmlDoc.createAttribute("foo");
35 shouldBe("attr.nodeName", "'foo'");
36 shouldBe("attr.name", "'foo'");
37 // Spec: http://www.w3.org/TR/DOM-Level-2-Core/core.html#Level-2-Core-DOM-create Attribute
38 // Both FF and WebKit return "foo" for Attribute.localName, even though the spec says null
39 shouldBe("attr.localName", "null");
40 shouldBe("attr.namespaceURI", "null");
41 shouldBe("attr.prefix", "null");
42 shouldBe("attr.value", "''");
43
44 debug("Attribute creation using createElementNS on an XHTML doc:")
45 attr = xmlDoc.createAttributeNS("http://www.example.com", "example:foo");
46 shouldBe("attr.nodeName", "'example:foo'");
47 shouldBe("attr.name", "'example:foo'");
48 shouldBe("attr.localName", "'foo'");
49 shouldBe("attr.namespaceURI", "'http://www.example.com'");
50 shouldBe("attr.prefix", "'example'");
51 shouldBe("attr.nodeValue", "''");
52 shouldBe("attr.value", "''");
53
54 var comment = document.createComment("foo");
55 shouldBe("comment.nodeName", "'#comment'");
56 shouldBe("comment.localName", "undefined");
57 shouldBe("comment.namespaceURI", "undefined");
58 shouldBe("comment.nodeValue", "'foo'");
59 shouldBe("comment.data", "'foo'");
60
61 shouldThrow("document.createCDATASection('foo')");
62 var cdata = xmlDoc.createCDATASection("foo");
63 shouldBe("cdata.nodeName", "'#cdata-section'");
64 shouldBe("cdata.localName", "undefined");
65 shouldBe("cdata.namespaceURI", "undefined");
66 shouldBe("cdata.nodeValue", "'foo'");
67 shouldBe("cdata.data", "'foo'");
68
69 var fragment = document.createDocumentFragment();
70 shouldBe("fragment.nodeName", "'#document-fragment'");
71 shouldBe("fragment.localName", "undefined");
72 shouldBe("fragment.namespaceURI", "undefined");
73 shouldBe("fragment.nodeValue", "null");
74
75 var doc = document.implementation.createDocument("http://www.w3.org/1999/xhtml", "html", null);
76 shouldBe("doc.nodeName", "'#document'");
77 shouldBe("doc.localName", "undefined");
78 shouldBe("doc.namespaceURI", "undefined");
79 shouldBe("doc.nodeValue", "null");
80
81 var doctype = document.implementation.createDocumentType("svg", "-//W3C//DTD SVG 1.1//EN", "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd");
82 shouldBe("doctype.nodeName", "'svg'");
83 shouldBe("doctype.name", "'svg'");
84 shouldBe("doctype.localName", "undefined");
85 shouldBe("doctype.namespaceURI", "undefined");
86 shouldBe("doctype.nodeValue", "null");
87
88 debug("Element creation using createElement on an HTML doc:")
89 var element = document.createElement("pre");
90 shouldBe("element.nodeName", "'PRE'");
91 // Spec: http://www.w3.org/TR/DOM-Level-2-Core/core.html#Level-2-Core-DOM-create Element
92 // FF returns "PRE" for localName, WebKit returns "pre", the spec says we should return null
93 shouldBe("element.localName", "null");
94 // FF returns null for namespaceURI, WebKit returns http://www.w3.org/1999/xhtml , the spec says we should return null
95 shouldBe("element.namespaceURI", "null");
96 shouldBe("element.prefix", "null");
97 shouldBe("element.nodeValue", "null");
98 shouldBe("element.attributes.toString()", "'[object NamedNodeMap]'");
99
100 debug("Prefixed element creation using createElementNS on an HTML doc:")
101 element = document.createElementNS("http://www.w3.org/1999/xhtml", "html:pre");
102 shouldBe("element.nodeName", "'HTML:PRE'");
103 shouldBe("element.localName", "'pre'");
104 shouldBe("element.namespaceURI", "'http://www.w3.org/1999/xhtml'");
105 shouldBe("element.prefix", "'html'");
106 shouldBe("element.nodeValue", "null");
107 shouldBe("element.attributes.toString()", "'[object NamedNodeMap]'");
108
109 debug("SVG Element creation using createElementNS on an HTML doc:")
110 element = document.createElementNS("http://www.w3.org/2000/svg", "svg");
111 shouldBe("element.nodeName", "'svg'");
112 shouldBe("element.localName", "'svg'");
113 shouldBe("element.namespaceURI", "'http://www.w3.org/2000/svg'");
114 shouldBe("element.prefix", "null");
115 shouldBe("element.nodeValue", "null");
116 shouldBe("element.attributes.toString()", "'[object NamedNodeMap]'");
117
118 debug("Unknown Element creation using createElementNS on an HTML doc:")
119 element = document.createElementNS("http://www.webkit.org", "foo:svg");
120 shouldBe("element.nodeName", "'foo:svg'");
121 shouldBe("element.localName", "'svg'");
122 shouldBe("element.namespaceURI", "'http://www.webkit.org'");
123 shouldBe("element.prefix", "'foo'");
124 shouldBe("element.nodeValue", "null");
125 shouldBe("element.attributes.toString()", "'[object NamedNodeMap]'");
126
127 debug("Element creation using createElementNS on an HTML doc:")
128 element = document.createElementNS("http://www.w3.org/1999/xhtml", "pre");
129 // Spec: http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-104682815 (element.t agName)
130 // FF and Opera returns "pre" for nodeName as it is an XHTML element, WebKit ret urns "PRE".
131 shouldBe("element.nodeName", "'pre'");
132 shouldBe("element.localName", "'pre'");
133 shouldBe("element.namespaceURI", "'http://www.w3.org/1999/xhtml'");
134 shouldBe("element.prefix", "null");
135 shouldBe("element.nodeValue", "null");
136 shouldBe("element.attributes.toString()", "'[object NamedNodeMap]'");
137
138 debug("Element creation using createElement on an XHTML doc:")
139 element = xmlDoc.createElement("pre");
140 shouldBe("element.nodeName", "'pre'");
141 shouldBe("element.localName", "null");
142 // FF returns null for namespaceURI, WebKit returns http://www.w3.org/1999/xhtml , the spec says we should return null
143 shouldBe("element.namespaceURI", "null");
144 shouldBe("element.prefix", "null");
145 shouldBe("element.nodeValue", "null");
146 shouldBe("element.attributes.toString()", "'[object NamedNodeMap]'");
147
148 debug("Element creation using createElementNS on an XHTML doc:")
149 element = xmlDoc.createElementNS("http://www.w3.org/1999/xhtml", "html:pre");
150 shouldBe("element.nodeName", "'html:pre'");
151 shouldBe("element.localName", "'pre'");
152 shouldBe("element.namespaceURI", "'http://www.w3.org/1999/xhtml'");
153 shouldBe("element.prefix", "'html'");
154 shouldBe("element.nodeValue", "null");
155 shouldBe("element.attributes.toString()", "'[object NamedNodeMap]'");
156
157 debug("Processing instruction creation using createProcessingInstruction on an H TML doc:")
158 var processingInstruction = document.createProcessingInstruction('xml-stylesheet ', 'type="text/xsl" href="missing.xsl"');
159 shouldBe("processingInstruction.nodeName", "'xml-stylesheet'");
160 shouldBe("processingInstruction.localName", "undefined");
161 shouldBe("processingInstruction.namespaceURI", "undefined");
162 // DOM Core Level 2 and DOM Core Level 3 disagree on ProcessingInstruction.nodeV alue
163 // L2: entire content excluding the target
164 // L3: same as ProcessingInstruction.data
165 // We're following Level 3
166 shouldBe("processingInstruction.nodeValue", "'type=\"text/xsl\" href=\"missing.x sl\"'");
167 shouldBe("processingInstruction.target", "'xml-stylesheet'");
168 shouldBe("processingInstruction.data", "'type=\"text/xsl\" href=\"missing.xsl\"' ");
169
170 debug("Processing instruction creation using createProcessingInstruction on an X HTML doc:")
171 processingInstruction = xmlDoc.createProcessingInstruction('xml-stylesheet', 'ty pe="text/xsl" href="missing.xsl"');
172 shouldBe("processingInstruction.nodeName", "'xml-stylesheet'");
173 shouldBe("processingInstruction.localName", "undefined");
174 shouldBe("processingInstruction.namespaceURI", "undefined");
175 shouldBe("processingInstruction.nodeValue", "'type=\"text/xsl\" href=\"missing.x sl\"'");
176 shouldBe("processingInstruction.target", "'xml-stylesheet'");
177 shouldBe("processingInstruction.data", "'type=\"text/xsl\" href=\"missing.xsl\"' ");
178
179 debug("Text node creation using createTextNode on an HTML doc:")
180 var text = document.createTextNode("foo");
181 shouldBe("text.nodeName", "'#text'");
182 shouldBe("text.localName", "undefined");
183 shouldBe("text.namespaceURI", "undefined");
184 shouldBe("text.nodeValue", "'foo'");
185 shouldBe("text.data", "'foo'");
186 </script>
8 </body> 187 </body>
9 </html> 188 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698