Skip to content

Commit f2117f4

Browse files
committed
on the way to use html5 doctype for all our tests
1 parent 4e66127 commit f2117f4

12 files changed

+678
-519
lines changed

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

Lines changed: 331 additions & 256 deletions
Large diffs are not rendered by default.

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ public class HTMLEmbedElementTest extends WebDriverTestCase {
4545
"absbottom", "absmiddle", "bottom", "texttop", "wrong", ""})
4646
@NotYetImplemented({FF, FF_ESR})
4747
public void getAlign() throws Exception {
48-
final String html
49-
= "<html><body>\n"
48+
final String html = DOCTYPE_HTML
49+
+ "<html><body>\n"
5050
+ " <embed id='e1' align='left' ></embed>\n"
5151
+ " <embed id='e2' align='right' ></embed>\n"
5252
+ " <embed id='e3' align='bottom' ></embed>\n"
@@ -82,8 +82,8 @@ public void getAlign() throws Exception {
8282
"absbottom", "absmiddle", "bottom", "texttop"})
8383
@NotYetImplemented({FF, FF_ESR})
8484
public void setAlign() throws Exception {
85-
final String html
86-
= "<html><body>\n"
85+
final String html = DOCTYPE_HTML
86+
+ "<html><body>\n"
8787
+ " <embed id='e1' align='left' ></embed>\n"
8888

8989
+ "<script>\n"
@@ -122,8 +122,8 @@ public void setAlign() throws Exception {
122122
@Test
123123
@Alerts({"10px", "20em", "80%", "40", "wrong", ""})
124124
public void getHeight() throws Exception {
125-
final String html
126-
= "<html><body>\n"
125+
final String html = DOCTYPE_HTML
126+
+ "<html><body>\n"
127127
+ " <embed id='e1' height='10px' ></embed>\n"
128128
+ " <embed id='e2' height='20em' ></embed>\n"
129129
+ " <embed id='e3' height='80%' ></embed>\n"
@@ -148,8 +148,8 @@ public void getHeight() throws Exception {
148148
@Test
149149
@Alerts({"20px", "8", "foo"})
150150
public void setHeight() throws Exception {
151-
final String html
152-
= "<html><body>\n"
151+
final String html = DOCTYPE_HTML
152+
+ "<html><body>\n"
153153
+ " <embed id='e1' height='10px' ></embed>\n"
154154

155155
+ "<script>\n"
@@ -179,8 +179,8 @@ public void setHeight() throws Exception {
179179
@Test
180180
@Alerts({"10px", "20em", "80%", "40", "wrong", ""})
181181
public void getWidth() throws Exception {
182-
final String html
183-
= "<html><body>\n"
182+
final String html = DOCTYPE_HTML
183+
+ "<html><body>\n"
184184
+ " <embed id='e1' width='10px' ></embed>\n"
185185
+ " <embed id='e2' width='20em' ></embed>\n"
186186
+ " <embed id='e3' width='80%' ></embed>\n"
@@ -205,8 +205,8 @@ public void getWidth() throws Exception {
205205
@Test
206206
@Alerts({"20px", "8", "foo"})
207207
public void setWidth() throws Exception {
208-
final String html
209-
= "<html><body>\n"
208+
final String html = DOCTYPE_HTML
209+
+ "<html><body>\n"
210210
+ " <embed id='e1' width='10px' ></embed>\n"
211211

212212
+ "<script>\n"

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ public class HTMLFieldSetElementTest extends WebDriverTestCase {
3737
@Alerts({"undefined", "undefined", "undefined", "undefined", "undefined", "undefined",
3838
"undefined", "undefined", "undefined", "undefined", "undefined"})
3939
public void getAlign() throws Exception {
40-
final String html
41-
= "<html><body>\n"
40+
final String html = DOCTYPE_HTML
41+
+ "<html><body>\n"
4242
+ " <form>\n"
4343
+ " <fieldset id='f1' align='left' ></fieldset>\n"
4444
+ " <fieldset id='f2' align='right' ></fieldset>\n"
@@ -71,8 +71,8 @@ public void getAlign() throws Exception {
7171
@Alerts({"CenTer", "8", "foo", "left", "right",
7272
"bottom", "middle", "top", "absbottom", "absmiddle", "baseline", "texttop"})
7373
public void setAlign() throws Exception {
74-
final String html
75-
= "<html><body>\n"
74+
final String html = DOCTYPE_HTML
75+
+ "<html><body>\n"
7676
+ " <form>\n"
7777
+ " <fieldset id='i1' align='left' />\n"
7878
+ " <form>\n"
@@ -113,8 +113,8 @@ public void setAlign() throws Exception {
113113
@Test
114114
@Alerts("[object HTMLFormElement]")
115115
public void form() throws Exception {
116-
final String html
117-
= "<html>\n"
116+
final String html = DOCTYPE_HTML
117+
+ "<html>\n"
118118
+ "<body>\n"
119119
+ " <form>\n"
120120
+ " <fieldset id='a' />\n"
@@ -134,8 +134,8 @@ public void form() throws Exception {
134134
@Test
135135
@Alerts({"false", "false", "false", "false", "false"})
136136
public void willValidate() throws Exception {
137-
final String html =
138-
"<html><head>\n"
137+
final String html = DOCTYPE_HTML
138+
+ "<html><head>\n"
139139
+ " <script>\n"
140140
+ LOG_TITLE_FUNCTION
141141
+ " function test() {\n"
@@ -166,8 +166,8 @@ public void willValidate() throws Exception {
166166
@Test
167167
@Alerts({"true", "false", "true", "true", "true"})
168168
public void willValidateChild() throws Exception {
169-
final String html =
170-
"<html><head>\n"
169+
final String html = DOCTYPE_HTML
170+
+ "<html><head>\n"
171171
+ " <script>\n"
172172
+ LOG_TITLE_FUNCTION
173173
+ " function test() {\n"

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ public class HTMLFormControlsCollectionTest extends WebDriverTestCase {
3535
@Test
3636
@Alerts({"true", "true", "2", "true", "1", "null"})
3737
public void namedItem() 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"
@@ -71,7 +72,8 @@ public void namedItem() throws Exception {
7172
@Test
7273
@Alerts({"first", "first", "first", "first", "second"})
7374
public void iterable() throws Exception {
74-
final String html = "<html><head>\n"
75+
final String html = DOCTYPE_HTML
76+
+ "<html><head>\n"
7577
+ "<script>\n"
7678
+ LOG_TITLE_FUNCTION
7779
+ " function test() {\n"

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

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,16 @@ public class HTMLFormElement2Test extends SimpleWebTestCase {
4747
*/
4848
@Test
4949
public void formSubmit() throws Exception {
50-
final String html
51-
= "<html><head><title>first</title></head><body>\n"
50+
final String html = DOCTYPE_HTML
51+
+ "<html><head><title>first</title></head><body>\n"
5252
+ "<p>hello world</p>\n"
5353
+ "<form name='form1' method='get' action='" + URL_SECOND + "'>\n"
5454
+ " <input type='button' name='button1' />\n"
5555
+ " <input type='button' name='button2' />\n"
5656
+ "</form>\n"
5757
+ "</body></html>";
58-
final String secondContent
59-
= "<html><head><title>second</title></head><body>\n"
58+
final String secondContent = DOCTYPE_HTML
59+
+ "<html><head><title>second</title></head><body>\n"
6060
+ "<p>hello world</p>\n"
6161
+ "</body></html>";
6262

@@ -74,8 +74,8 @@ public void formSubmit() throws Exception {
7474
@Test
7575
@Alerts("javaScript")
7676
public void formSubmitWithJavascript() throws Exception {
77-
final String html
78-
= "<html><head><title>first</title></head><body>\n"
77+
final String html = DOCTYPE_HTML
78+
+ "<html><head><title>first</title></head><body>\n"
7979
+ "<p>hello world</p>\n"
8080
+ "<form name='form1' method='get' action='javascript:alert(\"javaScript\")'>\n"
8181
+ " <input type='button' name='button1' />\n"
@@ -99,8 +99,8 @@ public void formSubmitWithJavascript() throws Exception {
9999
@Test
100100
@Alerts("javaScript")
101101
public void formSubmitWithJavascriptLeadingWhitespace() throws Exception {
102-
final String html
103-
= "<html><head><title>first</title></head><body>\n"
102+
final String html = DOCTYPE_HTML
103+
+ "<html><head><title>first</title></head><body>\n"
104104
+ "<p>hello world</p>\n"
105105
+ "<form name='form1' method='get' action=' javascript:alert(\"javaScript\")'>\n"
106106
+ " <input type='button' name='button1' />\n"
@@ -124,8 +124,8 @@ public void formSubmitWithJavascriptLeadingWhitespace() throws Exception {
124124
@Test
125125
@Alerts("javaScript")
126126
public void formSubmitWithJavascriptMixedCase() throws Exception {
127-
final String html
128-
= "<html><head><title>first</title></head><body>\n"
127+
final String html = DOCTYPE_HTML
128+
+ "<html><head><title>first</title></head><body>\n"
129129
+ "<p>hello world</p>\n"
130130
+ "<form name='form1' method='get' action='javaSCript:alert(\"javaScript\")'>\n"
131131
+ " <input type='button' name='button1' />\n"
@@ -148,8 +148,8 @@ public void formSubmitWithJavascriptMixedCase() throws Exception {
148148
*/
149149
@Test
150150
public void onSubmitChangesAction() throws Exception {
151-
final String html
152-
= "<html><body>\n"
151+
final String html = DOCTYPE_HTML
152+
+ "<html><body>\n"
153153
+ "<form name='form1' action='" + URL_SECOND + "' onsubmit='this.action=\"" + URL_THIRD + "\"' "
154154
+ "method='post'>\n"
155155
+ " <input type='submit' id='button1' />\n"
@@ -169,15 +169,15 @@ public void onSubmitChangesAction() throws Exception {
169169
*/
170170
@Test
171171
public void formSubmit_target() throws Exception {
172-
final String html
173-
= "<html><head><title>first</title></head><body>\n"
172+
final String html = DOCTYPE_HTML
173+
+ "<html><head><title>first</title></head><body>\n"
174174
+ "<p>hello world</p>\n"
175175
+ "<form name='form1' method='get' action='" + URL_SECOND + "' target='MyNewWindow'>\n"
176176
+ " <input type='button' name='button1' />\n"
177177
+ "</form>\n"
178178
+ "</body></html>";
179-
final String secondContent
180-
= "<html><head><title>second</title></head><body>\n"
179+
final String secondContent = DOCTYPE_HTML
180+
+ "<html><head><title>second</title></head><body>\n"
181181
+ "<p>hello world</p>\n"
182182
+ "</body></html>";
183183

@@ -197,15 +197,15 @@ public void formSubmit_target() throws Exception {
197197
*/
198198
@Test
199199
public void formSubmitDoesntCallOnSubmit() throws Exception {
200-
final String html
201-
= "<html><head><title>first</title></head><body>\n"
200+
final String html = DOCTYPE_HTML
201+
+ "<html><head><title>first</title></head><body>\n"
202202
+ "<form name='form1' method='get' action='" + URL_SECOND + "' onsubmit=\"this.action = 'foo.html'\">\n"
203203
+ " <input type='submit' />\n"
204204
+ "</form>\n"
205205
+ "<a href='javascript:document.form1.submit()' id='link1'>Click me</a>\n"
206206
+ "</body></html>";
207-
final String secondContent
208-
= "<html><head><title>second</title></head><body>\n"
207+
final String secondContent = DOCTYPE_HTML
208+
+ "<html><head><title>second</title></head><body>\n"
209209
+ "<p>hello world</p>\n"
210210
+ "</body></html>";
211211

@@ -222,16 +222,16 @@ public void formSubmitDoesntCallOnSubmit() throws Exception {
222222
*/
223223
@Test
224224
public void formSubmit_MultipleButtons() throws Exception {
225-
final String html
226-
= "<html><head><title>first</title></head><body>\n"
225+
final String html = DOCTYPE_HTML
226+
+ "<html><head><title>first</title></head><body>\n"
227227
+ "<p>hello world</p>\n"
228228
+ "<form name='form1' method='get' action='" + URL_SECOND + "'>\n"
229229
+ " <button type='submit' name='button1' id='button1'/>\n"
230230
+ " <button type='submit' name='button2' />\n"
231231
+ "</form>\n"
232232
+ "</body></html>";
233-
final String secondContent
234-
= "<html><head><title>second</title></head><body>\n"
233+
final String secondContent = DOCTYPE_HTML
234+
+ "<html><head><title>second</title></head><body>\n"
235235
+ "<p>hello world</p>\n"
236236
+ "</body></html>";
237237

@@ -252,8 +252,8 @@ public void formSubmit_MultipleButtons() throws Exception {
252252
@Test
253253
@Alerts("hi!")
254254
public void lostFunction() throws Exception {
255-
final String content
256-
= "<html><head><title>foo</title><script>\n"
255+
final String content = DOCTYPE_HTML
256+
+ "<html><head><title>foo</title><script>\n"
257257
+ " function onSubmit() { alert('hi!'); return false; }\n"
258258
+ "</script></head><body>\n"
259259
+ "<form onsubmit='return onSubmit();'>\n"
@@ -274,8 +274,8 @@ public void lostFunction() throws Exception {
274274
@Test
275275
@Alerts("hi!")
276276
public void assignedOnsubmit() throws Exception {
277-
final String content
278-
= "<html><head><title>foo</title><script>\n"
277+
final String content = DOCTYPE_HTML
278+
+ "<html><head><title>foo</title><script>\n"
279279
+ " function onSubmit() { alert('hi!'); return false; }\n"
280280
+ " function init() { document.myForm.onsubmit = onSubmit; }\n"
281281
+ " window.onload = init;\n"
@@ -299,8 +299,8 @@ public void assignedOnsubmit() throws Exception {
299299
@Test
300300
@Alerts("true")
301301
public void thisInJavascriptAction() throws Exception {
302-
final String content
303-
= "<html>\n"
302+
final String content = DOCTYPE_HTML
303+
+ "<html>\n"
304304
+ "<body>\n"
305305
+ "<form action='javascript:alert(this == window)'>\n"
306306
+ "<input type='submit' id='theButton'>\n"
@@ -321,7 +321,8 @@ public void thisInJavascriptAction() throws Exception {
321321
@Test
322322
@Alerts("onchange")
323323
public void fileInput_fireOnChange() throws Exception {
324-
final String html = "<html><body>\n"
324+
final String html = DOCTYPE_HTML
325+
+ "<html><body>\n"
325326
+ "<form>\n"
326327
+ " <input type='file' name='myFile' id='myFile' onchange='alert(\"onchange\")'/>\n"
327328
+ "</form>\n"

0 commit comments

Comments
 (0)