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/Element/getAttribute-check-case-sensitivity.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/getAttribute-check-case-sensitivity.js"></script> 7 <script>
8 description(
9 "<p>This file test the behaviour of getAttribute with regard to case.</p><p>See Bug 20247: setAttributeNode() does not work when attribute name has a capital le tter in it</p>"
10 );
11
12 function testGetAttributeCaseInsensitive()
13 {
14 var div = document.createElement('div');
15 div.setAttribute("mixedCaseAttrib", "x");
16
17 // Do original case lookup, and lowercase lookup.
18 return div.getAttribute("mixedcaseattrib");
19 }
20
21 shouldBe("testGetAttributeCaseInsensitive()", '"x"');
22
23 function testGetAttributeNodeMixedCase()
24 {
25 var div = document.createElement('div');
26 var a = div.ownerDocument.createAttribute("mixedCaseAttrib");
27 a.value = "x";
28 div.setAttributeNode(a);
29 return div.getAttribute("mixedCaseAttrib");
30 }
31
32 shouldBe("testGetAttributeNodeMixedCase()", '"x"');
33
34 function testGetAttributeNodeLowerCase(div)
35 {
36 var div = document.createElement('div');
37 var a = div.ownerDocument.createAttribute("lowercaseattrib");
38 a.value = "x";
39 div.setAttributeNode(a);
40 return div.getAttribute("lowerCaseAttrib");
41 }
42
43 shouldBe("testGetAttributeNodeLowerCase()", '"x"');
44
45 function testSetAttributeNodeKeepsRef(div)
46 {
47 var div = document.createElement('div');
48 var a = div.ownerDocument.createAttribute("attrib_name");
49 a.value = "0";
50 div.setAttributeNode(a);
51
52 // Mutate the attribute node.
53 a.value = "1";
54
55 return div.getAttribute("attrib_name");
56 }
57
58 shouldBe("testSetAttributeNodeKeepsRef()", '"1"');
59
60 function testAttribNodeNamePreservesCase()
61 {
62 var div = document.createElement('div');
63 var a = div.ownerDocument.createAttribute("A");
64 a.value = "x";
65 div.setAttributeNode(a);
66
67 var result = [ a.name, a.nodeName ];
68 return result.join(",");
69 }
70
71 shouldBe("testAttribNodeNamePreservesCase()", '"a,a"');
72
73
74 function testAttribNodeNamePreservesCaseGetNode()
75 {
76 // getAttributeNode doesn't work on DIVs, use body element
77 var body = document.body;
78
79 var a = body.ownerDocument.createAttribute("A");
80 a.value = "x";
81
82 body.setAttributeNode(a);
83
84 a = document.body.getAttributeNode("A");
85 if (!a)
86 return "FAIL";
87
88 var result = [ a.name, a.nodeName ];
89 return result.join(",");
90 }
91
92 shouldBe("testAttribNodeNamePreservesCaseGetNode()", '"a,a"');
93
94 function testAttribNodeNamePreservesCaseGetNode2()
95 {
96 // getAttributeNode doesn't work on DIVs, use body element
97 var body = document.body;
98
99 var a = body.ownerDocument.createAttribute("B");
100 a.value = "x";
101
102 body.setAttributeNode(a);
103
104 a = document.body.getAttributeNode("B");
105 if (!a)
106 return "FAIL";
107
108 // Now create node second time -- this time case is preserved in FF!
109 a = body.ownerDocument.createAttribute("B");
110 a.value = "x";
111 body.setAttributeNode(a);
112
113 a = document.body.getAttributeNode("B");
114
115 var result = [ a.name, a.nodeName ];
116 return result.join(",");
117 }
118
119 shouldBe("testAttribNodeNamePreservesCaseGetNode2()", '"b,b"');
120
121 function testAttribNodeNameGetMutate()
122 {
123 // getAttributeNode doesn't work on DIVs, use body element.
124 var body = document.body;
125
126 var a = body.ownerDocument.createAttribute("c");
127 a.value = "0";
128 body.setAttributeNode(a);
129
130 a = document.body.getAttributeNode("c");
131 a.value = "1";
132
133 a = document.body.getAttributeNode("c");
134
135 return a.value;
136 }
137
138 shouldBe("testAttribNodeNameGetMutate()", '"1"');
139
140 var node = document.createElement("div");
141 var attrib = document.createAttribute("myAttrib");
142 attrib.value = "XXX";
143 node.setAttributeNode(attrib);
144
145 shouldBe("(new XMLSerializer).serializeToString(node)", '"<div xmlns=\\"http://w ww.w3.org/1999/xhtml\\" myattrib=\\"XXX\\"></div>"');
146 shouldBe("node.getAttributeNode('myAttrib').name", '"myattrib"');
147 shouldBe("node.getAttributeNode('myattrib').name", '"myattrib"');
148 shouldBe("attrib.name", '"myattrib"');
149 </script>
8 </body> 150 </body>
9 </html> 151 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698