Skip to content

Commit 82290ba

Browse files
committed
on the way to use html5 doctype for all our tests
1 parent a110b4b commit 82290ba

11 files changed

+484
-350
lines changed

src/test/java/org/htmlunit/javascript/host/html/HTMLDListElementTest.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ public class HTMLDListElementTest extends WebDriverTestCase {
4141
@Test
4242
@Alerts("[object HTMLDListElement]")
4343
public void simpleScriptable() throws Exception {
44-
final String html = "<html><head>\n"
44+
final String html = DOCTYPE_HTML
45+
+ "<html><head>\n"
4546
+ "<script>\n"
4647
+ LOG_TITLE_FUNCTION
4748
+ " function test() {\n"
@@ -66,8 +67,8 @@ public void simpleScriptable() throws Exception {
6667
@Alerts({"false", "true", "true", "true", "null", "", "blah", "2",
6768
"true", "false", "true", "false", "", "null", "", "null"})
6869
public void compact() throws Exception {
69-
final String html =
70-
"<html>\n"
70+
final String html = DOCTYPE_HTML
71+
+ "<html>\n"
7172
+ " <head>\n"
7273
+ " <script>\n"
7374
+ LOG_TITLE_FUNCTION
@@ -114,8 +115,8 @@ public void compact() throws Exception {
114115
@Alerts({"undefined", "undefined", "undefined", "undefined",
115116
"null", "", "blah", "A", "1", "a", "A", "i", "I", "u"})
116117
public void type() throws Exception {
117-
final String html =
118-
"<html>\n"
118+
final String html = DOCTYPE_HTML
119+
+ "<html>\n"
119120
+ " <head>\n"
120121
+ " <script>\n"
121122
+ LOG_TITLE_FUNCTION

src/test/java/org/htmlunit/javascript/host/html/HTMLDTElementTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ public class HTMLDTElementTest extends WebDriverTestCase {
3434
@Test
3535
@Alerts({"undefined", "null", "nowrap", "null", "x", "null", "x", "blah", "", "blah"})
3636
public void noWrap() throws Exception {
37-
final String html =
38-
"<html>\n"
37+
final String html = DOCTYPE_HTML
38+
+ "<html>\n"
3939
+ " <head>\n"
4040
+ " <script>\n"
4141
+ LOG_TITLE_FUNCTION

src/test/java/org/htmlunit/javascript/host/html/HTMLDialogElementTest.java

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ public class HTMLDialogElementTest extends WebDriverTestCase {
4747
@Alerts({"false", "null", "true", "", "false", "null", "true", "",
4848
"true", "", "true", "TrUE", "false", "null"})
4949
public void open() throws Exception {
50-
final String html =
51-
"<html>\n"
50+
final String html = DOCTYPE_HTML
51+
+ "<html>\n"
5252
+ " <head>\n"
5353
+ " <script>\n"
5454
+ LOG_TITLE_FUNCTION
@@ -106,8 +106,8 @@ public void open() throws Exception {
106106
@Test
107107
@Alerts({"false", "null", "false", "null", "true", "", "true", "blah", "false", "null"})
108108
public void openString() throws Exception {
109-
final String html =
110-
"<html>\n"
109+
final String html = DOCTYPE_HTML
110+
+ "<html>\n"
111111
+ " <head>\n"
112112
+ " <script>\n"
113113
+ LOG_TITLE_FUNCTION
@@ -157,8 +157,8 @@ public void openString() throws Exception {
157157
@Test
158158
@Alerts({"false", "null", "true", "", "true", ""})
159159
public void show() throws Exception {
160-
final String html =
161-
"<html>\n"
160+
final String html = DOCTYPE_HTML
161+
+ "<html>\n"
162162
+ " <head>\n"
163163
+ " <script>\n"
164164
+ LOG_TITLE_FUNCTION
@@ -200,8 +200,8 @@ public void show() throws Exception {
200200
@Test
201201
@Alerts({"true", "", "true", ""})
202202
public void showAlreadyOpend() throws Exception {
203-
final String html =
204-
"<html>\n"
203+
final String html = DOCTYPE_HTML
204+
+ "<html>\n"
205205
+ " <head>\n"
206206
+ " <script>\n"
207207
+ LOG_TITLE_FUNCTION
@@ -239,8 +239,8 @@ public void showAlreadyOpend() throws Exception {
239239
@Test
240240
@Alerts({"false", "null", "true", "", "true", ""})
241241
public void showModal() throws Exception {
242-
final String html =
243-
"<html>\n"
242+
final String html = DOCTYPE_HTML
243+
+ "<html>\n"
244244
+ " <head>\n"
245245
+ " <script>\n"
246246
+ LOG_TITLE_FUNCTION
@@ -284,8 +284,8 @@ public void showModal() throws Exception {
284284
@Test
285285
@Alerts({"true", "", "InvalidStateError", "true", ""})
286286
public void showModalAlreadyOpend() throws Exception {
287-
final String html =
288-
"<html>\n"
287+
final String html = DOCTYPE_HTML
288+
+ "<html>\n"
289289
+ " <head>\n"
290290
+ " <script>\n"
291291
+ LOG_TITLE_FUNCTION
@@ -325,8 +325,8 @@ public void showModalAlreadyOpend() throws Exception {
325325
@Test
326326
@Alerts({"false", "null", "true", "", "true", ""})
327327
public void showAfterShow() throws Exception {
328-
final String html =
329-
"<html>\n"
328+
final String html = DOCTYPE_HTML
329+
+ "<html>\n"
330330
+ " <head>\n"
331331
+ " <script>\n"
332332
+ LOG_TITLE_FUNCTION
@@ -370,8 +370,8 @@ public void showAfterShow() throws Exception {
370370
@Test
371371
@Alerts({"false", "null", "true", "", "InvalidStateError", "true", ""})
372372
public void showAfterShowModal() throws Exception {
373-
final String html =
374-
"<html>\n"
373+
final String html = DOCTYPE_HTML
374+
+ "<html>\n"
375375
+ " <head>\n"
376376
+ " <script>\n"
377377
+ LOG_TITLE_FUNCTION
@@ -415,8 +415,8 @@ public void showAfterShowModal() throws Exception {
415415
@Test
416416
@Alerts({"false", "null", "true", "", "InvalidStateError", "true", ""})
417417
public void showModalAfterShow() throws Exception {
418-
final String html =
419-
"<html>\n"
418+
final String html = DOCTYPE_HTML
419+
+ "<html>\n"
420420
+ " <head>\n"
421421
+ " <script>\n"
422422
+ LOG_TITLE_FUNCTION
@@ -460,8 +460,8 @@ public void showModalAfterShow() throws Exception {
460460
@Test
461461
@Alerts({"false", "null", "true", "", "true", ""})
462462
public void showModalAfterShowModal() throws Exception {
463-
final String html =
464-
"<html>\n"
463+
final String html = DOCTYPE_HTML
464+
+ "<html>\n"
465465
+ " <head>\n"
466466
+ " <script>\n"
467467
+ LOG_TITLE_FUNCTION
@@ -507,8 +507,8 @@ public void showModalAfterShowModal() throws Exception {
507507
"false", "null", "", "false", "null", "",
508508
"[object Event]", "close", "false", "false", "false", "[object HTMLDialogElement]"})
509509
public void close() throws Exception {
510-
final String html =
511-
"<html>\n"
510+
final String html = DOCTYPE_HTML
511+
+ "<html>\n"
512512
+ " <head>\n"
513513
+ " <script>\n"
514514
+ LOG_TITLE_FUNCTION
@@ -559,8 +559,8 @@ public void close() throws Exception {
559559
@Alerts({"false", "null", "", "true", "", "",
560560
"false", "null", "", "false", "null", "", "closed"})
561561
public void closeOnclose() throws Exception {
562-
final String html =
563-
"<html>\n"
562+
final String html = DOCTYPE_HTML
563+
+ "<html>\n"
564564
+ " <head>\n"
565565
+ " <script>\n"
566566
+ LOG_TITLE_FUNCTION
@@ -608,8 +608,8 @@ public void closeOnclose() throws Exception {
608608
"false", "null", "Html", "false", "null", "Html",
609609
"[object Event]", "close", "false", "false", "false", "[object HTMLDialogElement]"})
610610
public void closeReturnValue() throws Exception {
611-
final String html =
612-
"<html>\n"
611+
final String html = DOCTYPE_HTML
612+
+ "<html>\n"
613613
+ " <head>\n"
614614
+ " <script>\n"
615615
+ LOG_TITLE_FUNCTION
@@ -660,8 +660,8 @@ public void closeReturnValue() throws Exception {
660660
@Alerts({"false", "", "1", "true", "1", "2", "false", "3", "4",
661661
"[object Event]", "close", "false", "false", "false", "[object HTMLDialogElement]"})
662662
public void returnValue() throws Exception {
663-
final String html =
664-
"<html>\n"
663+
final String html = DOCTYPE_HTML
664+
+ "<html>\n"
665665
+ " <head>\n"
666666
+ " <script>\n"
667667
+ LOG_TITLE_FUNCTION
@@ -712,8 +712,8 @@ public void returnValue() throws Exception {
712712
@Test
713713
@Alerts({"false", "string ", "string null", "string undefined", "string 4", "string [object Object]"})
714714
public void returnValueSpecial() throws Exception {
715-
final String html =
716-
"<html>\n"
715+
final String html = DOCTYPE_HTML
716+
+ "<html>\n"
717717
+ " <head>\n"
718718
+ " <script>\n"
719719
+ LOG_TITLE_FUNCTION
@@ -772,8 +772,8 @@ public void returnValueSpecial() throws Exception {
772772
"[object Event]", "close", "false", "false", "false", "[object HTMLDialogElement]",
773773
"false"})
774774
public void formClosesDialog() throws Exception {
775-
final String html =
776-
"<html>\n"
775+
final String html = DOCTYPE_HTML
776+
+ "<html>\n"
777777
+ " <head>\n"
778778
+ " <script>\n"
779779
+ LOG_TITLE_FUNCTION
@@ -828,8 +828,8 @@ public void formClosesDialog() throws Exception {
828828
"[object Event]", "close", "false", "false", "false", "[object HTMLDialogElement]",
829829
"false"})
830830
public void formClosesDialogWithoutJs() throws Exception {
831-
final String html =
832-
"<html>\n"
831+
final String html = DOCTYPE_HTML
832+
+ "<html>\n"
833833
+ " <head>\n"
834834
+ " <script>\n"
835835
+ LOG_TITLE_FUNCTION
@@ -871,8 +871,8 @@ public void formClosesDialogWithoutJs() throws Exception {
871871
@Test
872872
@Alerts({"false", "true", "true"})
873873
public void formGet() throws Exception {
874-
final String html =
875-
"<html>\n"
874+
final String html = DOCTYPE_HTML
875+
+ "<html>\n"
876876
+ " <head>\n"
877877
+ " <script>\n"
878878
+ LOG_WINDOW_NAME_FUNCTION
@@ -904,8 +904,8 @@ public void formGet() throws Exception {
904904
+ " </body>\n"
905905
+ "</html>";
906906

907-
final String secondContent
908-
= "<html><head><title>second</title></head><body>\n"
907+
final String secondContent = DOCTYPE_HTML
908+
+ "<html><head><title>second</title></head><body>\n"
909909
+ "<p>hello world</p>\n"
910910
+ "</body></html>";
911911
getMockWebConnection().setDefaultResponse(secondContent);
@@ -921,8 +921,8 @@ public void formGet() throws Exception {
921921
@Test
922922
@Alerts({"false", "true", "true"})
923923
public void formOutsideDialog() throws Exception {
924-
final String html =
925-
"<html>\n"
924+
final String html = DOCTYPE_HTML
925+
+ "<html>\n"
926926
+ " <head>\n"
927927
+ " <script>\n"
928928
+ LOG_TITLE_FUNCTION
@@ -968,8 +968,8 @@ public void formOutsideDialog() throws Exception {
968968
"Show dialog\nHello World\nDismiss", "true",
969969
"Show dialog", "false"})
970970
public void useCaseIssue598() throws Exception {
971-
final String html =
972-
"<html>\n"
971+
final String html = DOCTYPE_HTML
972+
+ "<html>\n"
973973
+ " <body>\n"
974974
+ " <button id='showMyDialog'>Show dialog</button><br/>\n"
975975
+ " <dialog id='mydialog'>\n"

src/test/java/org/htmlunit/javascript/host/html/HTMLDirectoryElementTest.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ public class HTMLDirectoryElementTest extends WebDriverTestCase {
4141
@Test
4242
@Alerts("[object HTMLDirectoryElement]")
4343
public void simpleScriptable() throws Exception {
44-
final String html = "<html><head>\n"
44+
final String html = DOCTYPE_HTML
45+
+ "<html><head>\n"
4546
+ "<script>\n"
4647
+ LOG_TITLE_FUNCTION
4748
+ " function test() {\n"
@@ -66,8 +67,8 @@ public void simpleScriptable() throws Exception {
6667
@Alerts({"false", "true", "true", "true", "null", "", "blah", "2",
6768
"true", "false", "true", "false", "", "null", "", "null"})
6869
public void compact() throws Exception {
69-
final String html =
70-
"<html>\n"
70+
final String html = DOCTYPE_HTML
71+
+ "<html>\n"
7172
+ " <head>\n"
7273
+ " <script>\n"
7374
+ LOG_TITLE_FUNCTION
@@ -114,8 +115,8 @@ public void compact() throws Exception {
114115
@Alerts({"undefined", "undefined", "undefined", "undefined",
115116
"null", "", "blah", "A", "1", "a", "A", "i", "I", "u"})
116117
public void type() throws Exception {
117-
final String html =
118-
"<html>\n"
118+
final String html = DOCTYPE_HTML
119+
+ "<html>\n"
119120
+ " <head>\n"
120121
+ " <script>\n"
121122
+ LOG_TITLE_FUNCTION

src/test/java/org/htmlunit/javascript/host/html/HTMLDivElementTest.java

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
package org.htmlunit.javascript.host.html;
1616

1717
import org.htmlunit.WebDriverTestCase;
18-
import org.htmlunit.html.HtmlPageTest;
1918
import org.htmlunit.junit.BrowserRunner;
2019
import org.htmlunit.junit.annotation.Alerts;
2120
import org.junit.Test;
@@ -39,8 +38,8 @@ public class HTMLDivElementTest extends WebDriverTestCase {
3938
@Test
4039
@Alerts("no")
4140
public void doScroll() throws Exception {
42-
final String html =
43-
"<html>\n"
41+
final String html = DOCTYPE_HTML
42+
+ "<html>\n"
4443
+ " <head>\n"
4544
+ " <script>\n"
4645
+ LOG_TITLE_FUNCTION
@@ -68,8 +67,8 @@ public void doScroll() throws Exception {
6867
@Test
6968
@Alerts({"left", "right", "justify", "center", "wrong", ""})
7069
public void getAlign() throws Exception {
71-
final String html
72-
= "<html><body>\n"
70+
final String html = DOCTYPE_HTML
71+
+ "<html><body>\n"
7372
+ " <table>\n"
7473
+ " <div id='d1' align='left' ></div>\n"
7574
+ " <div id='d2' align='right' ></div>\n"
@@ -96,8 +95,8 @@ public void getAlign() throws Exception {
9695
@Test
9796
@Alerts({"CenTer", "8", "foo", "left", "right", "justify", "center"})
9897
public void setAlign() throws Exception {
99-
final String html
100-
= "<html><body>\n"
98+
final String html = DOCTYPE_HTML
99+
+ "<html><body>\n"
101100
+ " <table>\n"
102101
+ " <div id='d1' align='left' ></div>\n"
103102
+ " </table>\n"
@@ -134,8 +133,8 @@ public void setAlign() throws Exception {
134133
@Test
135134
@Alerts({"null", "true", "null", "true"})
136135
public void handlers() throws Exception {
137-
final String html
138-
= "<html><body>\n"
136+
final String html = DOCTYPE_HTML
137+
+ "<html><body>\n"
139138
+ "<div id='d1'></div>\n"
140139
+ "<script>\n"
141140
+ LOG_TITLE_FUNCTION
@@ -156,8 +155,7 @@ public void handlers() throws Exception {
156155
@Test
157156
@Alerts({"true", "true", "true", "true", "true", "true"})
158157
public void clientHeight() throws Exception {
159-
final String html =
160-
HtmlPageTest.STANDARDS_MODE_PREFIX_
158+
final String html = DOCTYPE_HTML
161159
+ "<html>\n"
162160
+ "<head>\n"
163161
+ " <script>\n"
@@ -201,8 +199,7 @@ public void clientHeight() throws Exception {
201199
@Test
202200
@Alerts({"true", "true", "true", "true", "true", "true"})
203201
public void clientWidth() throws Exception {
204-
final String html =
205-
HtmlPageTest.STANDARDS_MODE_PREFIX_
202+
final String html = DOCTYPE_HTML
206203
+ "<html>\n"
207204
+ "<head>\n"
208205
+ " <script>\n"
@@ -246,8 +243,7 @@ public void clientWidth() throws Exception {
246243
@Test
247244
@Alerts({"true", "true", "true", "true", "true", "true"})
248245
public void clientWidthNested() throws Exception {
249-
final String html =
250-
HtmlPageTest.STANDARDS_MODE_PREFIX_
246+
final String html = DOCTYPE_HTML
251247
+ "<html>\n"
252248
+ "<head>\n"
253249
+ " <script>\n"
@@ -291,8 +287,8 @@ public void clientWidthNested() throws Exception {
291287
@Test
292288
@Alerts({"undefined", "null", "nowrap", "null", "x", "null", "x", "blah", "", "blah"})
293289
public void noWrap() throws Exception {
294-
final String html =
295-
"<html>\n"
290+
final String html = DOCTYPE_HTML
291+
+ "<html>\n"
296292
+ " <head>\n"
297293
+ " <script>\n"
298294
+ LOG_TITLE_FUNCTION

0 commit comments

Comments
 (0)