Skip to content

Commit 50afc66

Browse files
committed
bing back the so far disabled validationMessage tests
1 parent 6df8766 commit 50afc66

6 files changed

Lines changed: 138 additions & 137 deletions

File tree

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ public void reportValidityAlwaysTrueOnFieldsetItself() throws Exception {
261261
* @throws Exception if an error occurs
262262
*/
263263
@Test
264-
@Alerts({"false", "false", "true"})
264+
@Alerts({"false", "false", "true", "some error"})
265265
public void setCustomValidityOnFieldset_doesNotAffectCheckValidity() throws Exception {
266266
final String html = DOCTYPE_HTML
267267
+ "<html><head>\n"
@@ -273,7 +273,7 @@ public void setCustomValidityOnFieldset_doesNotAffectCheckValidity() throws Exce
273273
+ " log(f.willValidate);\n"
274274
+ " log(f.validity.valid);\n"
275275
+ " log(f.checkValidity());\n"
276-
// + " log(f.validationMessage);\n"
276+
+ " log(f.validationMessage);\n"
277277
+ " }\n"
278278
+ " </script>\n"
279279
+ "</head>\n"

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

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3519,38 +3519,39 @@ public void clearCustomValidity_restoresValid() throws Exception {
35193519
loadPageVerifyTitle2(html);
35203520
}
35213521

3522-
// /**
3523-
// * The validationMessage should reflect the custom validity message for a
3524-
// * validation-participating (editable) input, and should be empty for a
3525-
// * barred-from-validation (disabled) one, regardless of a custom message
3526-
// * being set.
3527-
// * @throws Exception if the test fails
3528-
// */
3529-
// @Test
3530-
// @Alerts({"editable error", ""})
3531-
// public void validationMessageReflectsCustomValidityWhereApplicable() throws Exception {
3532-
// final String html = DOCTYPE_HTML
3533-
// + "<html><head>\n"
3534-
// + "<script>\n"
3535-
// + LOG_TITLE_FUNCTION
3536-
// + " function test() {\n"
3537-
// + " var editable = document.getElementById('editable');\n"
3538-
// + " var disabled = document.getElementById('disabled');\n"
3539-
// + " editable.setCustomValidity('editable error');\n"
3540-
// + " disabled.setCustomValidity('disabled error');\n"
3541-
// + " log(editable.validationMessage);\n"
3542-
// + " log(disabled.validationMessage);\n"
3543-
// + " }\n"
3544-
// + "</script></head>\n"
3545-
// + "<body onload='test()'>\n"
3546-
// + " <form>\n"
3547-
// + " <input id='editable' type='text'>\n"
3548-
// + " <input id='disabled' type='text' disabled>\n"
3549-
// + " </form>\n"
3550-
// + "</body></html>";
3551-
//
3552-
// loadPageVerifyTitle2(html);
3553-
// }
3522+
/**
3523+
* The validationMessage should reflect the custom validity message for a
3524+
* validation-participating (editable) input, and should be empty for a
3525+
* barred-from-validation (disabled) one, regardless of a custom message
3526+
* being set.
3527+
* @throws Exception if the test fails
3528+
*/
3529+
@Test
3530+
@Alerts({"editable error", ""})
3531+
public void validationMessageReflectsCustomValidityWhereApplicable() throws Exception {
3532+
final String html = DOCTYPE_HTML
3533+
+ "<html><head>\n"
3534+
+ "<script>\n"
3535+
+ LOG_TITLE_FUNCTION
3536+
+ " function test() {\n"
3537+
+ " var editable = document.getElementById('editable');\n"
3538+
+ " var disabled = document.getElementById('disabled');\n"
3539+
+ " editable.setCustomValidity('editable error');\n"
3540+
+ " disabled.setCustomValidity('disabled error');\n"
3541+
+ " log(editable.validationMessage);\n"
3542+
+ " log(disabled.validationMessage);\n"
3543+
+ " }\n"
3544+
+ "</script></head>\n"
3545+
+ "<body onload='test()'>\n"
3546+
+ " <form>\n"
3547+
+ " <input id='editable' type='text'>\n"
3548+
+ " <input id='disabled' type='text' disabled>\n"
3549+
+ " </form>\n"
3550+
+ "</body></html>";
3551+
3552+
loadPageVerifyTitle2(html);
3553+
}
3554+
35543555
/**
35553556
* The reportValidity() is untested anywhere in this file -- basic coverage that
35563557
* it returns the same boolean as checkValidity() for an input with a custom

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

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ public void reportValidityAlwaysTrue() throws Exception {
187187
* @throws Exception if an error occurs
188188
*/
189189
@Test
190-
@Alerts({"false", "false", "true"})
190+
@Alerts({"false", "false", "true", ""})
191191
public void setCustomValidityDoesNotAffectCheckValidity() throws Exception {
192192
final String html = DOCTYPE_HTML
193193
+ "<html><head>\n"
@@ -199,7 +199,7 @@ public void setCustomValidityDoesNotAffectCheckValidity() throws Exception {
199199
+ " log(o.willValidate);\n"
200200
+ " log(o.validity.valid);\n"
201201
+ " log(o.checkValidity());\n"
202-
// + " log(o.validationMessage);\n"
202+
+ " log(o.validationMessage);\n"
203203
+ " }\n"
204204
+ " </script>\n"
205205
+ "</head>\n"
@@ -212,38 +212,38 @@ public void setCustomValidityDoesNotAffectCheckValidity() throws Exception {
212212
loadPageVerifyTitle2(html);
213213
}
214214

215-
// /**
216-
// * The validationMessage must always be empty on an &lt;object&gt;, even with a
217-
// * custom validity message set and even when additionally barred via an
218-
// * ancestor disabled fieldset.
219-
// * @throws Exception if an error occurs
220-
// */
221-
// @Test
222-
// @Alerts({"", ""})
223-
// public void validationMessageAlwaysEmpty() throws Exception {
224-
// final String html = DOCTYPE_HTML
225-
// + "<html><head>\n"
226-
// + " <script>\n"
227-
// + LOG_TITLE_FUNCTION
228-
// + " function test() {\n"
229-
// + " var plain = document.getElementById('plain');\n"
230-
// + " var inFieldset = document.getElementById('inFieldset');\n"
231-
// + " plain.setCustomValidity('error1');\n"
232-
// + " inFieldset.setCustomValidity('error2');\n"
233-
// + " log(plain.validationMessage);\n"
234-
// + " log(inFieldset.validationMessage);\n"
235-
// + " }\n"
236-
// + " </script>\n"
237-
// + "</head>\n"
238-
// + "<body onload='test()'>\n"
239-
// + " <form>\n"
240-
// + " <object id='plain'></object>"
241-
// + " <fieldset disabled><object id='inFieldset'></object></fieldset>"
242-
// + " </form>\n"
243-
// + "</body></html>";
244-
//
245-
// loadPageVerifyTitle2(html);
246-
// }
215+
/**
216+
* The validationMessage must always be empty on an &lt;object&gt;, even with a
217+
* custom validity message set and even when additionally barred via an
218+
* ancestor disabled fieldset.
219+
* @throws Exception if an error occurs
220+
*/
221+
@Test
222+
@Alerts({"", ""})
223+
public void validationMessageAlwaysEmpty() throws Exception {
224+
final String html = DOCTYPE_HTML
225+
+ "<html><head>\n"
226+
+ " <script>\n"
227+
+ LOG_TITLE_FUNCTION
228+
+ " function test() {\n"
229+
+ " var plain = document.getElementById('plain');\n"
230+
+ " var inFieldset = document.getElementById('inFieldset');\n"
231+
+ " plain.setCustomValidity('error1');\n"
232+
+ " inFieldset.setCustomValidity('error2');\n"
233+
+ " log(plain.validationMessage);\n"
234+
+ " log(inFieldset.validationMessage);\n"
235+
+ " }\n"
236+
+ " </script>\n"
237+
+ "</head>\n"
238+
+ "<body onload='test()'>\n"
239+
+ " <form>\n"
240+
+ " <object id='plain'></object>"
241+
+ " <fieldset disabled><object id='inFieldset'></object></fieldset>"
242+
+ " </form>\n"
243+
+ "</body></html>";
244+
245+
loadPageVerifyTitle2(html);
246+
}
247247

248248
/**
249249
* A object with a custom validity message set must

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public void willValidate() throws Exception {
9999
* @throws Exception if an error occurs
100100
*/
101101
@Test
102-
@Alerts({"false", "true", "false", "true"})
102+
@Alerts({"false", "true", "false", "true", ""})
103103
public void setCustomValidityOnPlainOutput() throws Exception {
104104
final String html = DOCTYPE_HTML
105105
+ "<html><head>\n"
@@ -112,7 +112,7 @@ public void setCustomValidityOnPlainOutput() throws Exception {
112112
+ " log(o.validity.customError);\n"
113113
+ " log(o.validity.valid);\n"
114114
+ " log(o.checkValidity());\n"
115-
// + " log(o.validationMessage);\n"
115+
+ " log(o.validationMessage);\n"
116116
+ " }\n"
117117
+ " </script>\n"
118118
+ "</head>\n"

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

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3110,39 +3110,39 @@ public void clearCustomValidity_restoresValid() throws Exception {
31103110
loadPageVerifyTitle2(html);
31113111
}
31123112

3113-
// /**
3114-
// * The validationMessage should reflect the custom validity message for a
3115-
// * validation-participating (editable) select, and should be empty for a
3116-
// * barred-from-validation (disabled) one, regardless of a custom message
3117-
// * being set.
3118-
// * @throws Exception if an error occurs
3119-
// */
3120-
// @Test
3121-
// @Alerts({"editable error", ""})
3122-
// public void validationMessageReflectsCustomValidityWhereApplicable() throws Exception {
3123-
// final String html = DOCTYPE_HTML
3124-
// + "<html><head>\n"
3125-
// + " <script>\n"
3126-
// + LOG_TITLE_FUNCTION
3127-
// + " function test() {\n"
3128-
// + " var editable = document.getElementById('editable');\n"
3129-
// + " var disabled = document.getElementById('disabled');\n"
3130-
// + " editable.setCustomValidity('editable error');\n"
3131-
// + " disabled.setCustomValidity('disabled error');\n"
3132-
// + " log(editable.validationMessage);\n"
3133-
// + " log(disabled.validationMessage);\n"
3134-
// + " }\n"
3135-
// + " </script>\n"
3136-
// + "</head>\n"
3137-
// + "<body onload='test()'>\n"
3138-
// + " <form>\n"
3139-
// + " <select id='editable'><option value='a'>a</option></select>"
3140-
// + " <select id='disabled' disabled><option value='a'>a</option></select>"
3141-
// + " </form>\n"
3142-
// + "</body></html>";
3143-
//
3144-
// loadPageVerifyTitle2(html);
3145-
// }
3113+
/**
3114+
* The validationMessage should reflect the custom validity message for a
3115+
* validation-participating (editable) select, and should be empty for a
3116+
* barred-from-validation (disabled) one, regardless of a custom message
3117+
* being set.
3118+
* @throws Exception if an error occurs
3119+
*/
3120+
@Test
3121+
@Alerts({"editable error", ""})
3122+
public void validationMessageReflectsCustomValidityWhereApplicable() throws Exception {
3123+
final String html = DOCTYPE_HTML
3124+
+ "<html><head>\n"
3125+
+ " <script>\n"
3126+
+ LOG_TITLE_FUNCTION
3127+
+ " function test() {\n"
3128+
+ " var editable = document.getElementById('editable');\n"
3129+
+ " var disabled = document.getElementById('disabled');\n"
3130+
+ " editable.setCustomValidity('editable error');\n"
3131+
+ " disabled.setCustomValidity('disabled error');\n"
3132+
+ " log(editable.validationMessage);\n"
3133+
+ " log(disabled.validationMessage);\n"
3134+
+ " }\n"
3135+
+ " </script>\n"
3136+
+ "</head>\n"
3137+
+ "<body onload='test()'>\n"
3138+
+ " <form>\n"
3139+
+ " <select id='editable'><option value='a'>a</option></select>"
3140+
+ " <select id='disabled' disabled><option value='a'>a</option></select>"
3141+
+ " </form>\n"
3142+
+ "</body></html>";
3143+
3144+
loadPageVerifyTitle2(html);
3145+
}
31463146

31473147
/**
31483148
* @throws Exception if an error occurs

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

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2569,7 +2569,7 @@ public void willValidate() throws Exception {
25692569
* @throws Exception if the test fails
25702570
*/
25712571
@Test
2572-
@Alerts("true")
2572+
@Alerts({"true", ""})
25732573
public void checkValidityWithoutCustomValidity() throws Exception {
25742574
final String html = DOCTYPE_HTML
25752575
+ "<html><head>\n"
@@ -2578,7 +2578,7 @@ public void checkValidityWithoutCustomValidity() throws Exception {
25782578
+ " function test() {\n"
25792579
+ " var t = document.getElementById('t');\n"
25802580
+ " log(t.checkValidity());\n"
2581-
// + " log(t.validationMessage);\n"
2581+
+ " log(t.validationMessage);\n"
25822582
+ " }\n"
25832583
+ "</script></head>\n"
25842584
+ "<body onload='test()'>\n"
@@ -2714,38 +2714,38 @@ public void clearCustomValidity_restoresValid() throws Exception {
27142714
loadPageVerifyTitle2(html);
27152715
}
27162716

2717-
// /**
2718-
// * The validationMessage should reflect the custom validity message for a
2719-
// * validation-participating (editable) textarea, and should be empty for a
2720-
// * barred-from-validation (disabled) one, regardless of a custom message
2721-
// * being set.
2722-
// * @throws Exception if the test fails
2723-
// */
2724-
// @Test
2725-
// @Alerts({"editable error", ""})
2726-
// public void validationMessageReflectsCustomValidityWhereApplicable() throws Exception {
2727-
// final String html = DOCTYPE_HTML
2728-
// + "<html><head>\n"
2729-
// + "<script>\n"
2730-
// + LOG_TITLE_FUNCTION
2731-
// + " function test() {\n"
2732-
// + " var editable = document.getElementById('editable');\n"
2733-
// + " var disabled = document.getElementById('disabled');\n"
2734-
// + " editable.setCustomValidity('editable error');\n"
2735-
// + " disabled.setCustomValidity('disabled error');\n"
2736-
// + " log(editable.validationMessage);\n"
2737-
// + " log(disabled.validationMessage);\n"
2738-
// + " }\n"
2739-
// + "</script></head>\n"
2740-
// + "<body onload='test()'>\n"
2741-
// + " <form>\n"
2742-
// + " <textarea id='editable'>content</textarea>\n"
2743-
// + " <textarea id='disabled' disabled>content</textarea>\n"
2744-
// + " </form>\n"
2745-
// + "</body></html>";
2746-
//
2747-
// loadPageVerifyTitle2(html);
2748-
// }
2717+
/**
2718+
* The validationMessage should reflect the custom validity message for a
2719+
* validation-participating (editable) textarea, and should be empty for a
2720+
* barred-from-validation (disabled) one, regardless of a custom message
2721+
* being set.
2722+
* @throws Exception if the test fails
2723+
*/
2724+
@Test
2725+
@Alerts({"editable error", ""})
2726+
public void validationMessageReflectsCustomValidityWhereApplicable() throws Exception {
2727+
final String html = DOCTYPE_HTML
2728+
+ "<html><head>\n"
2729+
+ "<script>\n"
2730+
+ LOG_TITLE_FUNCTION
2731+
+ " function test() {\n"
2732+
+ " var editable = document.getElementById('editable');\n"
2733+
+ " var disabled = document.getElementById('disabled');\n"
2734+
+ " editable.setCustomValidity('editable error');\n"
2735+
+ " disabled.setCustomValidity('disabled error');\n"
2736+
+ " log(editable.validationMessage);\n"
2737+
+ " log(disabled.validationMessage);\n"
2738+
+ " }\n"
2739+
+ "</script></head>\n"
2740+
+ "<body onload='test()'>\n"
2741+
+ " <form>\n"
2742+
+ " <textarea id='editable'>content</textarea>\n"
2743+
+ " <textarea id='disabled' disabled>content</textarea>\n"
2744+
+ " </form>\n"
2745+
+ "</body></html>";
2746+
2747+
loadPageVerifyTitle2(html);
2748+
}
27492749

27502750
/**
27512751
* @throws Exception if the test fails

0 commit comments

Comments
 (0)