Skip to content

Commit 83e296c

Browse files
committed
on the way to use html5 doctype for all our tests
1 parent cac67ca commit 83e296c

35 files changed

+899
-693
lines changed

src/test/java/org/htmlunit/javascript/host/dom/AbstractRangeTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ public class AbstractRangeTest extends WebDriverTestCase {
3434
@Test
3535
@Alerts("true")
3636
public void prototype() throws Exception {
37-
final String html
38-
= "<html><head><script>\n"
37+
final String html = DOCTYPE_HTML
38+
+ "<html><head><script>\n"
3939
+ LOG_TITLE_FUNCTION
4040
+ " function test() {\n"
4141
+ " try {\n"
@@ -54,8 +54,8 @@ public void prototype() throws Exception {
5454
@Test
5555
@Alerts("TypeError")
5656
public void ctor() throws Exception {
57-
final String html
58-
= "<html><head><script>\n"
57+
final String html = DOCTYPE_HTML
58+
+ "<html><head><script>\n"
5959
+ LOG_TITLE_FUNCTION
6060
+ " function test() {\n"
6161
+ " try {\n"

src/test/java/org/htmlunit/javascript/host/dom/AttrTest.java

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ public class AttrTest extends WebDriverTestCase {
3939
@Test
4040
@Alerts({"true", "TypeError"})
4141
public void specified() throws Exception {
42-
final String html
43-
= "<html><head><script>\n"
42+
final String html = DOCTYPE_HTML
43+
+ "<html><head><script>\n"
4444
+ LOG_TITLE_FUNCTION
4545
+ "function doTest() {\n"
4646
+ " try {\n"
@@ -71,8 +71,8 @@ public void specified() throws Exception {
7171
@Test
7272
@Alerts({"true", "true"})
7373
public void specified2() throws Exception {
74-
final String html
75-
= "<html><body onload='test()'><div id='div' class='test'></div>\n"
74+
final String html = DOCTYPE_HTML
75+
+ "<html><body onload='test()'><div id='div' class='test'></div>\n"
7676
+ "<script>\n"
7777
+ LOG_TITLE_FUNCTION
7878
+ " function test() {\n"
@@ -91,8 +91,8 @@ public void specified2() throws Exception {
9191
@Test
9292
@Alerts("[object HTMLOptionElement]")
9393
public void ownerElement() throws Exception {
94-
final String html
95-
= "<html><head><script>\n"
94+
final String html = DOCTYPE_HTML
95+
+ "<html><head><script>\n"
9696
+ LOG_TITLE_FUNCTION
9797
+ "function doTest() {\n"
9898
+ " var s = document.getElementById('testSelect');\n"
@@ -117,8 +117,8 @@ public void ownerElement() throws Exception {
117117
@Test
118118
@Alerts({"undefined", "undefined", "undefined"})
119119
public void isId() throws Exception {
120-
final String html
121-
= "<html><head><script>\n"
120+
final String html = DOCTYPE_HTML
121+
+ "<html><head><script>\n"
122122
+ LOG_TITLE_FUNCTION
123123
+ "function test() {\n"
124124
+ " var d = document.getElementById('d');\n"
@@ -140,8 +140,8 @@ public void isId() throws Exception {
140140
@Test
141141
@Alerts({"undefined", "undefined", "undefined", "undefined", "undefined"})
142142
public void expando() throws Exception {
143-
final String html
144-
= "<html><head><script>\n"
143+
final String html = DOCTYPE_HTML
144+
+ "<html><head><script>\n"
145145
+ LOG_TITLE_FUNCTION
146146
+ "function test() {\n"
147147
+ " var d = document.getElementById('d');\n"
@@ -166,8 +166,8 @@ public void expando() throws Exception {
166166
@Test
167167
@Alerts("undefined")
168168
public void expandoEvent() throws Exception {
169-
final String html
170-
= "<html><head><script>\n"
169+
final String html = DOCTYPE_HTML
170+
+ "<html><head><script>\n"
171171
+ LOG_TITLE_FUNCTION
172172
+ "function test() {\n"
173173
+ " var d = document.getElementById('d');\n"
@@ -188,8 +188,8 @@ public void expandoEvent() throws Exception {
188188
@Test
189189
@Alerts("test()")
190190
public void textContent() throws Exception {
191-
final String html
192-
= "<html><head><script>\n"
191+
final String html = DOCTYPE_HTML
192+
+ "<html><head><script>\n"
193193
+ LOG_TITLE_FUNCTION
194194
+ "function test() {\n"
195195
+ " var a = document.body.getAttributeNode('onload');\n"
@@ -207,8 +207,8 @@ public void textContent() throws Exception {
207207
@Test
208208
@Alerts({"null", "null", "null", "null"})
209209
public void getAttributeNodeUndefinedAttribute() throws Exception {
210-
final String html
211-
= "<html><head><script>\n"
210+
final String html = DOCTYPE_HTML
211+
+ "<html><head><script>\n"
212212
+ LOG_TITLE_FUNCTION
213213
+ "function test() {\n"
214214
+ " var elem = document.getElementById('myDiv');\n"
@@ -230,8 +230,8 @@ public void getAttributeNodeUndefinedAttribute() throws Exception {
230230
@Test
231231
@Alerts({"null", "null", "null", "null"})
232232
public void getAttributesUndefinedAttribute() throws Exception {
233-
final String html
234-
= "<html><head><script>\n"
233+
final String html = DOCTYPE_HTML
234+
+ "<html><head><script>\n"
235235
+ LOG_TITLE_FUNCTION
236236
+ "function test() {\n"
237237
+ " var elem = document.getElementById('myDiv');\n"
@@ -253,7 +253,8 @@ public void getAttributesUndefinedAttribute() throws Exception {
253253
@Test
254254
@Alerts({"[object Attr]", "", "[object Attr]", ""})
255255
public void value() throws Exception {
256-
final String html = "<html><head><script>\n"
256+
final String html = DOCTYPE_HTML
257+
+ "<html><head><script>\n"
257258
+ LOG_TITLE_FUNCTION
258259
+ " function test() {\n"
259260
+ " var attr = document.createAttribute('hi');\n"
@@ -315,8 +316,8 @@ public void html_prefix() throws Exception {
315316
}
316317

317318
private void html(final String methodName) throws Exception {
318-
final String html
319-
= "<html>\n"
319+
final String html = DOCTYPE_HTML
320+
+ "<html>\n"
320321
+ "<script>\n"
321322
+ LOG_TITLE_FUNCTION
322323
+ " function test() {\n"
@@ -383,8 +384,8 @@ public void xml_prefix() throws Exception {
383384
}
384385

385386
private void xml(final String methodName) throws Exception {
386-
final String html =
387-
"<html>\n"
387+
final String html = DOCTYPE_HTML
388+
+ "<html>\n"
388389
+ " <head>\n"
389390
+ " <script>\n"
390391
+ LOG_TITLE_FUNCTION

src/test/java/org/htmlunit/javascript/host/dom/CDATASectionTest.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ public class CDATASectionTest extends WebDriverTestCase {
3636
@Test
3737
@Alerts("[object Comment]")
3838
public void simpleScriptable() throws Exception {
39-
final String html
40-
= "<html><head>\n"
39+
final String html = DOCTYPE_HTML
40+
+ "<html><head>\n"
4141
+ "<script>\n"
4242
+ LOG_TITLE_FUNCTION
4343
+ "function test() {\n"
@@ -54,9 +54,10 @@ public void simpleScriptable() throws Exception {
5454
@Test
5555
@Alerts("2")
5656
public void splitText() throws Exception {
57-
final String html = "<html><head>\n"
58-
+ "<script>\n"
59-
+ LOG_TITLE_FUNCTION
57+
final String html = DOCTYPE_HTML
58+
+ "<html><head>\n"
59+
+ "<script>\n"
60+
+ LOG_TITLE_FUNCTION
6061
+ " function test() {\n"
6162
+ " var doc = document.implementation.createDocument('', '', null);\n"
6263
+ " var root = doc.appendChild(doc.createElement('root'));\n"

src/test/java/org/htmlunit/javascript/host/dom/CharacterDataTest.java

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ public class CharacterDataTest extends WebDriverTestCase {
3636
@Test
3737
@Alerts({"Some Text", "9", "3", "Some Text", "#text"})
3838
public void textNode() throws Exception {
39-
final String html
40-
= "<html><head><script>\n"
39+
final String html = DOCTYPE_HTML
40+
+ "<html><head><script>\n"
4141
+ LOG_TITLE_FUNCTION
4242
+ "function doTest() {\n"
4343
+ " var div1=document.getElementById('div1');\n"
@@ -61,8 +61,8 @@ public void textNode() throws Exception {
6161
@Test
6262
@Alerts({"Some New Text", "Some New Text"})
6363
public void setData() throws Exception {
64-
final String html
65-
= "<html><head>\n"
64+
final String html = DOCTYPE_HTML
65+
+ "<html><head>\n"
6666
+ "<script>\n"
6767
+ LOG_TITLE_FUNCTION
6868
+ "function doTest() {\n"
@@ -85,8 +85,8 @@ public void setData() throws Exception {
8585
@Test
8686
@Alerts({"Some New Text", "Some New Text"})
8787
public void setNodeValue() throws Exception {
88-
final String html
89-
= "<html><head>\n"
88+
final String html = DOCTYPE_HTML
89+
+ "<html><head>\n"
9090
+ "<script>\n"
9191
+ LOG_TITLE_FUNCTION
9292
+ "function doTest() {\n"
@@ -109,8 +109,8 @@ public void setNodeValue() throws Exception {
109109
@Test
110110
@Alerts("Some Text Appended")
111111
public void appendData() throws Exception {
112-
final String html
113-
= "<html><head>\n"
112+
final String html = DOCTYPE_HTML
113+
+ "<html><head>\n"
114114
+ "<script>\n"
115115
+ LOG_TITLE_FUNCTION
116116
+ "function doTest() {\n"
@@ -132,8 +132,8 @@ public void appendData() throws Exception {
132132
@Test
133133
@Alerts({"Some Text", "Some", "Some", "me", ""})
134134
public void deleteData() throws Exception {
135-
final String html
136-
= "<html><head>\n"
135+
final String html = DOCTYPE_HTML
136+
+ "<html><head>\n"
137137
+ "<script>\n"
138138
+ LOG_TITLE_FUNCTION
139139
+ "function doTest() {\n"
@@ -178,8 +178,8 @@ public void deleteData() throws Exception {
178178
@Test
179179
@Alerts({"", "", "", ""})
180180
public void deleteDataEmptyImput() throws Exception {
181-
final String html
182-
= "<html><head>\n"
181+
final String html = DOCTYPE_HTML
182+
+ "<html><head>\n"
183183
+ "<script>\n"
184184
+ LOG_TITLE_FUNCTION
185185
+ "function doTest() {\n"
@@ -219,8 +219,8 @@ public void deleteDataEmptyImput() throws Exception {
219219
@Alerts({"IndexSizeError/DOMException", "IndexSizeError/DOMException",
220220
"IndexSizeError/DOMException", "IndexSizeError/DOMException"})
221221
public void deleteDataInvalidStart() throws Exception {
222-
final String html
223-
= "<html><head>\n"
222+
final String html = DOCTYPE_HTML
223+
+ "<html><head>\n"
224224
+ "<script>\n"
225225
+ LOG_TITLE_FUNCTION
226226
+ "function doTest() {\n"
@@ -258,8 +258,8 @@ public void deleteDataInvalidStart() throws Exception {
258258
@Test
259259
@Alerts({"Some Not So New Te", "Some ", "So"})
260260
public void deleteDataNegativeCount() throws Exception {
261-
final String html
262-
= "<html><head>\n"
261+
final String html = DOCTYPE_HTML
262+
+ "<html><head>\n"
263263
+ "<script>\n"
264264
+ LOG_TITLE_FUNCTION
265265
+ "function doTest() {\n"
@@ -293,8 +293,8 @@ public void deleteDataNegativeCount() throws Exception {
293293
@Test
294294
@Alerts("Some New Text")
295295
public void insertData() throws Exception {
296-
final String html
297-
= "<html><head><script>\n"
296+
final String html = DOCTYPE_HTML
297+
+ "<html><head><script>\n"
298298
+ LOG_TITLE_FUNCTION
299299
+ "function doTest() {\n"
300300
+ " var div1=document.getElementById('div1');\n"
@@ -315,8 +315,8 @@ public void insertData() throws Exception {
315315
@Test
316316
@Alerts("Some New Text")
317317
public void replaceData() throws Exception {
318-
final String html
319-
= "<html><head>\n"
318+
final String html = DOCTYPE_HTML
319+
+ "<html><head>\n"
320320
+ "<script>\n"
321321
+ LOG_TITLE_FUNCTION
322322
+ "function doTest() {\n"
@@ -338,8 +338,8 @@ public void replaceData() throws Exception {
338338
@Test
339339
@Alerts({"New", "Some New Text"})
340340
public void substringData() throws Exception {
341-
final String html
342-
= "<html><head>\n"
341+
final String html = DOCTYPE_HTML
342+
+ "<html><head>\n"
343343
+ "<script>\n"
344344
+ LOG_TITLE_FUNCTION
345345
+ "function doTest() {\n"
@@ -361,8 +361,8 @@ public void substringData() throws Exception {
361361
@Test
362362
@Alerts({"Some ", "Text", "true"})
363363
public void textImpl_splitText() throws Exception {
364-
final String html
365-
= "<html><head>\n"
364+
final String html = DOCTYPE_HTML
365+
+ "<html><head>\n"
366366
+ "<script>\n"
367367
+ LOG_TITLE_FUNCTION
368368
+ "function doTest() {\n"

src/test/java/org/htmlunit/javascript/host/dom/CommentTest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ public class CommentTest extends WebDriverTestCase {
3636
@Test
3737
@Alerts("[object Comment]")
3838
public void simpleScriptable() throws Exception {
39-
final String html
40-
= "<html><head>\n"
39+
final String html = DOCTYPE_HTML
40+
+ "<html><head>\n"
4141
+ "<script>\n"
4242
+ LOG_TITLE_FUNCTION
4343
+ "function test() {\n"
@@ -54,8 +54,8 @@ public void simpleScriptable() throws Exception {
5454
@Test
5555
@Alerts({"after", "comment"})
5656
public void textContent() throws Exception {
57-
final String html
58-
= "<html><body>\n"
57+
final String html = DOCTYPE_HTML
58+
+ "<html><body>\n"
5959
+ "<div id='it'><!--comment-->after</div>\n"
6060
+ "<script>\n"
6161
+ LOG_TITLE_FUNCTION
@@ -73,8 +73,8 @@ public void textContent() throws Exception {
7373
@Test
7474
@Alerts({"after", "undefined"})
7575
public void innerText() throws Exception {
76-
final String html
77-
= "<html><body>\n"
76+
final String html = DOCTYPE_HTML
77+
+ "<html><body>\n"
7878
+ "<div id='it'><!--comment-->after</div>\n"
7979
+ "<script>\n"
8080
+ LOG_TITLE_FUNCTION
@@ -86,8 +86,8 @@ public void innerText() throws Exception {
8686
}
8787

8888
private void property(final String property) throws Exception {
89-
final String html
90-
= "<html><body>\n"
89+
final String html = DOCTYPE_HTML
90+
+ "<html><body>\n"
9191
+ "<div id='it'><!--abcdefg-->after</div>\n"
9292
+ "<script>\n"
9393
+ LOG_TITLE_FUNCTION

0 commit comments

Comments
 (0)