Skip to content

Commit 83f6d98

Browse files
committed
on the way to use html5 doctype for all our tests
1 parent 6e4a975 commit 83f6d98

12 files changed

+183
-131
lines changed

src/test/java/org/htmlunit/html/HtmlRadioButtonInputTest.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ public class HtmlRadioButtonInputTest extends SimpleWebTestCase {
4242
*/
4343
@Test
4444
public void asTextWhenNotChecked() throws Exception {
45-
final String html
46-
= "<html><head></head><body>\n"
45+
final String html = DOCTYPE_HTML
46+
+ "<html><head></head><body>\n"
4747
+ "<form id='form1'>\n"
4848
+ " <input type='radio' name='radio' id='radio'>Check me</input>\n"
4949
+ "</form></body></html>";
@@ -63,8 +63,8 @@ public void asTextWhenNotChecked() throws Exception {
6363
@Test
6464
@Alerts("newtrue")
6565
public void onchangeHandlerInvoked() throws Exception {
66-
final String html
67-
= "<html><head><title>foo</title></head><body>\n"
66+
final String html = DOCTYPE_HTML
67+
+ "<html><head><title>foo</title></head><body>\n"
6868
+ "<form id='form1'>\n"
6969
+ " <input type='radio' name='radio' id='radio'"
7070
+ "onchange='this.value=\"new\" + this.checked'>Check me</input>\n"
@@ -87,8 +87,8 @@ public void onchangeHandlerInvoked() throws Exception {
8787
*/
8888
@Test
8989
public void onchangeHandlerNotInvokedIfNotChanged() throws Exception {
90-
final String html
91-
= "<html><head><title>foo</title></head><body>\n"
90+
final String html = DOCTYPE_HTML
91+
+ "<html><head><title>foo</title></head><body>\n"
9292
+ "<form id='form1'>\n"
9393
+ " <input type='radio' name='radio' id='radio'"
9494
+ "onchange='this.value=\"new\" + this.checked'>Check me</input>\n"
@@ -113,8 +113,8 @@ public void onchangeHandlerNotInvokedIfNotChanged() throws Exception {
113113
@Test
114114
@Alerts({"oneItem.checked: false twoItems.checked: true", "oneItem.checked: true twoItems.checked: false"})
115115
public void updateStateFirstForOnclickHandler() throws Exception {
116-
final String html
117-
= "<html><head><title>foo</title></head><body>\n"
116+
final String html = DOCTYPE_HTML
117+
+ "<html><head><title>foo</title></head><body>\n"
118118
+ "<script type='text/javascript'>\n"
119119
+ " function itemOnClickHandler() {\n"
120120
+ " var oneItem = document.getElementById('oneItem');\n"
@@ -159,14 +159,14 @@ public void updateStateFirstForOnclickHandler() throws Exception {
159159
@Test
160160
@Alerts("Second")
161161
public void setChecked() throws Exception {
162-
final String firstHtml
163-
= "<html><head><title>First</title></head><body>\n"
162+
final String firstHtml = DOCTYPE_HTML
163+
+ "<html><head><title>First</title></head><body>\n"
164164
+ "<form>\n"
165165
+ "<input id='myRadio' type='radio' onchange=\"window.location.href='" + URL_SECOND + "'\">\n"
166166
+ "</form>\n"
167167
+ "</body></html>";
168-
final String secondHtml
169-
= "<html><head><title>Second</title></head><body></body></html>";
168+
final String secondHtml = DOCTYPE_HTML
169+
+ "<html><head><title>Second</title></head><body></body></html>";
170170

171171
final WebClient client = getWebClient();
172172

@@ -189,8 +189,8 @@ public void setChecked() throws Exception {
189189
*/
190190
@Test
191191
public void clickResponse() throws Exception {
192-
final String html
193-
= "<html><head>\n"
192+
final String html = DOCTYPE_HTML
193+
+ "<html><head>\n"
194194
+ "</head>\n"
195195
+ "<body>\n"
196196
+ "<form name='myForm'>\n"

src/test/java/org/htmlunit/html/HtmlRangeInput2Test.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ public class HtmlRangeInput2Test extends SimpleWebTestCase {
3232
*/
3333
@Test
3434
public void testDefault() throws Exception {
35-
final String htmlContent = "<html>\n"
35+
final String htmlContent = DOCTYPE_HTML
36+
+ "<html>\n"
3637
+ "<head></head>\n"
3738
+ "<body>\n"
3839
+ "<form id='form1'>\n"
@@ -65,7 +66,8 @@ public void testDefault() throws Exception {
6566
*/
6667
@Test
6768
public void minValidation() throws Exception {
68-
final String htmlContent = "<html>\n"
69+
final String htmlContent = DOCTYPE_HTML
70+
+ "<html>\n"
6971
+ "<head></head>\n"
7072
+ "<body>\n"
7173
+ "<form id='form1'>\n"
@@ -122,7 +124,8 @@ public void minValidation() throws Exception {
122124
*/
123125
@Test
124126
public void maxValidation() throws Exception {
125-
final String htmlContent = "<html>\n"
127+
final String htmlContent = DOCTYPE_HTML
128+
+ "<html>\n"
126129
+ "<head></head>\n"
127130
+ "<body>\n"
128131
+ "<form id='form1'>\n"

src/test/java/org/htmlunit/html/HtmlRangeInputTest.java

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ public class HtmlRangeInputTest extends WebDriverTestCase {
3838
@Test
3939
@Alerts({"50----", "50----", "50----"})
4040
public void defaultValues() throws Exception {
41-
final String html = "<html><head>\n"
41+
final String html = DOCTYPE_HTML
42+
+ "<html><head>\n"
4243
+ "<script>\n"
4344
+ LOG_TITLE_FUNCTION
4445
+ " function test() {\n"
@@ -76,7 +77,8 @@ public void defaultValues() throws Exception {
7677
@Test
7778
@Alerts({"50----", "50----", "50----"})
7879
public void defaultValuesAfterClone() throws Exception {
79-
final String html = "<html><head>\n"
80+
final String html = DOCTYPE_HTML
81+
+ "<html><head>\n"
8082
+ "<script>\n"
8183
+ LOG_TITLE_FUNCTION
8284
+ " function test() {\n"
@@ -117,7 +119,8 @@ public void defaultValuesAfterClone() throws Exception {
117119
@Test
118120
@Alerts({"7-7---", "7-7---", "4-7---", "4-7---", "4-2---", "4-2---"})
119121
public void resetByClick() throws Exception {
120-
final String html = "<html><head>\n"
122+
final String html = DOCTYPE_HTML
123+
+ "<html><head>\n"
121124
+ "<script>\n"
122125
+ LOG_TITLE_FUNCTION
123126
+ " function test() {\n"
@@ -168,7 +171,8 @@ public void resetByClick() throws Exception {
168171
@Test
169172
@Alerts({"7-7---", "7-7---", "4-7---", "4-7---", "4-2---", "4-2---"})
170173
public void resetByJS() throws Exception {
171-
final String html = "<html><head>\n"
174+
final String html = DOCTYPE_HTML
175+
+ "<html><head>\n"
172176
+ "<script>\n"
173177
+ LOG_TITLE_FUNCTION
174178
+ " function test() {\n"
@@ -218,7 +222,8 @@ public void resetByJS() throws Exception {
218222
@Test
219223
@Alerts({"7-7---", "4-4---", "2-4---", "2-8---"})
220224
public void defaultValue() throws Exception {
221-
final String html = "<html><head>\n"
225+
final String html = DOCTYPE_HTML
226+
+ "<html><head>\n"
222227
+ "<script>\n"
223228
+ LOG_TITLE_FUNCTION
224229
+ " function test() {\n"
@@ -259,7 +264,8 @@ public void defaultValue() throws Exception {
259264
@Alerts({"50----", "50--100-0-", "5--10-0-", "4--7-0-",
260265
"2--7--4-", "4.3--7.01-1.3-"})
261266
public void valueDependsOnMinMax() throws Exception {
262-
final String html = "<html>\n"
267+
final String html = DOCTYPE_HTML
268+
+ "<html>\n"
263269
+ "<head>\n"
264270
+ "<script>\n"
265271
+ LOG_TITLE_FUNCTION
@@ -294,7 +300,8 @@ public void valueDependsOnMinMax() throws Exception {
294300
@Test
295301
@Alerts({"41-42-1234-2-13", "5-5-10-2-1", "6-5-10-2-2"})
296302
public void properties() throws Exception {
297-
final String html = "<html><head>\n"
303+
final String html = DOCTYPE_HTML
304+
+ "<html><head>\n"
298305
+ "<script>\n"
299306
+ LOG_TITLE_FUNCTION
300307
+ " function test() {\n"
@@ -326,7 +333,8 @@ public void properties() throws Exception {
326333
@Test
327334
@Alerts({"42", "50"})
328335
public void clearInput() throws Exception {
329-
final String html = "<html>\n"
336+
final String html = DOCTYPE_HTML
337+
+ "<html>\n"
330338
+ "<body>\n"
331339
+ "<form>\n"
332340
+ " <input type='range' id='tester' value='42'>\n"
@@ -351,7 +359,8 @@ public void clearInput() throws Exception {
351359
@Test
352360
@Alerts("--")
353361
public void minMaxStep() throws Exception {
354-
final String html = "<html>\n"
362+
final String html = DOCTYPE_HTML
363+
+ "<html>\n"
355364
+ "<head>\n"
356365
+ "<script>\n"
357366
+ LOG_TITLE_FUNCTION
@@ -377,7 +386,8 @@ public void minMaxStep() throws Exception {
377386
@Test
378387
@Alerts({"true-true-true-true-true-true", "55-10-10-100-0-0"})
379388
public void minValidation() throws Exception {
380-
final String html = "<html>\n"
389+
final String html = DOCTYPE_HTML
390+
+ "<html>\n"
381391
+ "<head>\n"
382392
+ "<script>\n"
383393
+ LOG_TITLE_FUNCTION
@@ -416,7 +426,8 @@ public void minValidation() throws Exception {
416426
@Test
417427
@Alerts({"true-true-true-true-true-true", "5-1-10-10-0-0"})
418428
public void maxValidation() throws Exception {
419-
final String html = "<html>\n"
429+
final String html = DOCTYPE_HTML
430+
+ "<html>\n"
420431
+ "<head>\n"
421432
+ "<script>\n"
422433
+ LOG_TITLE_FUNCTION
@@ -456,8 +467,8 @@ public void maxValidation() throws Exception {
456467
@Test
457468
@Alerts({"true", "false", "true", "false", "true"})
458469
public void willValidate() throws Exception {
459-
final String html =
460-
"<html><head>\n"
470+
final String html = DOCTYPE_HTML
471+
+ "<html><head>\n"
461472
+ " <script>\n"
462473
+ LOG_TITLE_FUNCTION
463474
+ " function test() {\n"
@@ -550,8 +561,8 @@ public void validationRequiredValueSet() throws Exception {
550561
}
551562

552563
private void validation(final String htmlPart, final String jsPart) throws Exception {
553-
final String html =
554-
"<html><head>\n"
564+
final String html = DOCTYPE_HTML
565+
+ "<html><head>\n"
555566
+ " <script>\n"
556567
+ LOG_TITLE_FUNCTION
557568
+ " function logValidityState(s) {\n"

src/test/java/org/htmlunit/html/HtmlResetInput2Test.java

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ public class HtmlResetInput2Test extends WebDriverTestCase {
3838
@Test
3939
@Alerts({"-", "-", "-"})
4040
public void defaultValues() throws Exception {
41-
final String html = "<html><head>\n"
41+
final String html = DOCTYPE_HTML
42+
+ "<html><head>\n"
4243
+ "<script>\n"
4344
+ LOG_TITLE_FUNCTION
4445
+ " function test() {\n"
@@ -70,7 +71,8 @@ public void defaultValues() throws Exception {
7071
@Test
7172
@Alerts({"-", "-", "-"})
7273
public void defaultValuesAfterClone() throws Exception {
73-
final String html = "<html><head>\n"
74+
final String html = DOCTYPE_HTML
75+
+ "<html><head>\n"
7476
+ "<script>\n"
7577
+ LOG_TITLE_FUNCTION
7678
+ " function test() {\n"
@@ -106,7 +108,8 @@ public void defaultValuesAfterClone() throws Exception {
106108
@Alerts({"initial-initial", "initial-initial", "newValue-newValue", "newValue-newValue",
107109
"newDefault-newDefault", "newDefault-newDefault"})
108110
public void resetByClick() throws Exception {
109-
final String html = "<html><head>\n"
111+
final String html = DOCTYPE_HTML
112+
+ "<html><head>\n"
110113
+ "<script>\n"
111114
+ LOG_TITLE_FUNCTION
112115
+ " function test() {\n"
@@ -146,7 +149,8 @@ public void resetByClick() throws Exception {
146149
@Alerts({"initial-initial", "initial-initial", "newValue-newValue", "newValue-newValue",
147150
"newDefault-newDefault", "newDefault-newDefault"})
148151
public void resetByJS() throws Exception {
149-
final String html = "<html><head>\n"
152+
final String html = DOCTYPE_HTML
153+
+ "<html><head>\n"
150154
+ "<script>\n"
151155
+ LOG_TITLE_FUNCTION
152156
+ " function test() {\n"
@@ -184,7 +188,8 @@ public void resetByJS() throws Exception {
184188
@Test
185189
@Alerts({"initial-initial", "default-default", "newValue-newValue", "newdefault-newdefault"})
186190
public void defaultValue() throws Exception {
187-
final String html = "<html><head>\n"
191+
final String html = DOCTYPE_HTML
192+
+ "<html><head>\n"
188193
+ "<script>\n"
189194
+ LOG_TITLE_FUNCTION
190195
+ " function test() {\n"
@@ -215,7 +220,8 @@ public void defaultValue() throws Exception {
215220
@Test
216221
@Alerts("--")
217222
public void minMaxStep() throws Exception {
218-
final String html = "<html>\n"
223+
final String html = DOCTYPE_HTML
224+
+ "<html>\n"
219225
+ "<head>\n"
220226
+ "<script>\n"
221227
+ LOG_TITLE_FUNCTION
@@ -241,7 +247,8 @@ public void minMaxStep() throws Exception {
241247
@Test
242248
@Alerts({"foo", "foonewValue", "foo"})
243249
public void reset() throws Exception {
244-
final String html = "<html><head>\n"
250+
final String html = DOCTYPE_HTML
251+
+ "<html><head>\n"
245252
+ " <script type='text/javascript'>\n"
246253
+ " function submitForm() {\n"
247254
+ " }\n"
@@ -279,7 +286,8 @@ public void reset() throws Exception {
279286
@Test
280287
@Alerts({"foo", "foonewValue", "foonewValue"})
281288
public void onclickDisables() throws Exception {
282-
final String html = "<html><head>\n"
289+
final String html = DOCTYPE_HTML
290+
+ "<html><head>\n"
283291
+ " <script type='text/javascript'>\n"
284292
+ " function submitForm() {\n"
285293
+ " document.deliveryChannelForm.resetBtn.disabled = true;\n"
@@ -316,8 +324,8 @@ public void onclickDisables() throws Exception {
316324
@Test
317325
@Alerts({"false", "false", "false", "false", "false"})
318326
public void willValidate() throws Exception {
319-
final String html =
320-
"<html><head>\n"
327+
final String html = DOCTYPE_HTML
328+
+ "<html><head>\n"
321329
+ " <script>\n"
322330
+ LOG_TITLE_FUNCTION
323331
+ " function test() {\n"
@@ -399,8 +407,8 @@ public void validationRequired() throws Exception {
399407
}
400408

401409
private void validation(final String htmlPart, final String jsPart) throws Exception {
402-
final String html =
403-
"<html><head>\n"
410+
final String html = DOCTYPE_HTML
411+
+ "<html><head>\n"
404412
+ " <script>\n"
405413
+ LOG_TITLE_FUNCTION
406414
+ " function logValidityState(s) {\n"

src/test/java/org/htmlunit/html/HtmlRpTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ public class HtmlRpTest extends WebDriverTestCase {
3535
@Test
3636
@Alerts({"", "none", "none"})
3737
public void defaultStyle() throws Exception {
38-
final String html = "<html><head>\n"
38+
final String html = DOCTYPE_HTML
39+
+ "<html><head>\n"
3940
+ "<script>\n"
4041
+ LOG_TITLE_FUNCTION
4142
+ " function test() {\n"

src/test/java/org/htmlunit/html/HtmlRtTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ public class HtmlRtTest extends WebDriverTestCase {
3737
FF = {"", "ruby-text", "ruby-text"},
3838
FF_ESR = {"", "ruby-text", "ruby-text"})
3939
public void defaultStyle() throws Exception {
40-
final String html = "<html><head>\n"
40+
final String html = DOCTYPE_HTML
41+
+ "<html><head>\n"
4142
+ "<script>\n"
4243
+ LOG_TITLE_FUNCTION
4344
+ " function test() {\n"
@@ -71,7 +72,7 @@ public void defaultStyle() throws Exception {
7172
FF = {"", "ruby-text", "ruby-text"},
7273
FF_ESR = {"", "ruby-text", "ruby-text"})
7374
public void defaultStyleStandards() throws Exception {
74-
final String html = HtmlPageTest.STANDARDS_MODE_PREFIX_
75+
final String html = DOCTYPE_HTML
7576
+ "<html><head>\n"
7677
+ "<script>\n"
7778
+ LOG_TITLE_FUNCTION

src/test/java/org/htmlunit/html/HtmlRtcTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ public class HtmlRtcTest extends WebDriverTestCase {
3636
FF = {"", "ruby-text-container", "ruby-text-container"},
3737
FF_ESR = {"", "ruby-text-container", "ruby-text-container"})
3838
public void defaultStyle() throws Exception {
39-
final String html = "<html><head>\n"
39+
final String html = DOCTYPE_HTML
40+
+ "<html><head>\n"
4041
+ "<script>\n"
4142
+ LOG_TITLE_FUNCTION
4243
+ " function test() {\n"

0 commit comments

Comments
 (0)