@@ -81,4 +81,167 @@ public void responseXML_htmlObject() throws Exception {
8181 loadPage2 (html );
8282 verifyTitle2 (DEFAULT_WAIT_TIME , getWebDriver (), getExpectedAlerts ());
8383 }
84+
85+ /**
86+ * Method willValidate must always be false
87+ * for an <object>, regardless of hidden/style/disabled-ancestor
88+ * state.
89+ * @throws Exception if an error occurs
90+ */
91+ @ Test
92+ @ Alerts ({"false" , "false" , "false" , "false" })
93+ public void willValidateAlwaysFalse () throws Exception {
94+ final String html = DOCTYPE_HTML
95+ + "<html><head>\n "
96+ + " <script>\n "
97+ + LOG_TITLE_FUNCTION
98+ + " function test() {\n "
99+ + " log(document.getElementById('i1').willValidate);\n "
100+ + " log(document.getElementById('i2').willValidate);\n "
101+ + " log(document.getElementById('i3').willValidate);\n "
102+ + " log(document.getElementById('i4').willValidate);\n "
103+ + " }\n "
104+ + " </script>\n "
105+ + "</head>\n "
106+ + "<body onload='test()'>\n "
107+ + " <form>\n "
108+ + " <object id='i1'></object>"
109+ + " <object id='i2' hidden></object>"
110+ + " <object id='i3' style='display: none'></object>"
111+ + " <fieldset disabled><object id='i4'></object></fieldset>"
112+ + " </form>\n "
113+ + "</body></html>" ;
114+
115+ loadPageVerifyTitle2 (html );
116+ }
117+
118+ /**
119+ * The checkValidity() must always return true on an <object>, regardless
120+ * of hidden/style/disabled-ancestor state.
121+ * @throws Exception if an error occurs
122+ */
123+ @ Test
124+ @ Alerts ({"true" , "true" , "true" , "true" })
125+ public void checkValidityAlwaysTrue () throws Exception {
126+ final String html = DOCTYPE_HTML
127+ + "<html><head>\n "
128+ + " <script>\n "
129+ + LOG_TITLE_FUNCTION
130+ + " function test() {\n "
131+ + " log(document.getElementById('i1').checkValidity());\n "
132+ + " log(document.getElementById('i2').checkValidity());\n "
133+ + " log(document.getElementById('i3').checkValidity());\n "
134+ + " log(document.getElementById('i4').checkValidity());\n "
135+ + " }\n "
136+ + " </script>\n "
137+ + "</head>\n "
138+ + "<body onload='test()'>\n "
139+ + " <form>\n "
140+ + " <object id='i1'></object>"
141+ + " <object id='i2' hidden></object>"
142+ + " <object id='i3' style='display: none'></object>"
143+ + " <fieldset disabled><object id='i4'></object></fieldset>"
144+ + " </form>\n "
145+ + "</body></html>" ;
146+
147+ loadPageVerifyTitle2 (html );
148+ }
149+
150+ /**
151+ * The reportValidity() must always return true on an <object>, mirroring
152+ * checkValidity().
153+ * @throws Exception if an error occurs
154+ */
155+ @ Test
156+ @ Alerts ({"true" , "true" , "true" , "true" })
157+ public void reportValidityAlwaysTrue () throws Exception {
158+ final String html = DOCTYPE_HTML
159+ + "<html><head>\n "
160+ + " <script>\n "
161+ + LOG_TITLE_FUNCTION
162+ + " function test() {\n "
163+ + " log(document.getElementById('i1').reportValidity());\n "
164+ + " log(document.getElementById('i2').reportValidity());\n "
165+ + " log(document.getElementById('i3').reportValidity());\n "
166+ + " log(document.getElementById('i4').reportValidity());\n "
167+ + " }\n "
168+ + " </script>\n "
169+ + "</head>\n "
170+ + "<body onload='test()'>\n "
171+ + " <form>\n "
172+ + " <object id='i1'></object>"
173+ + " <object id='i2' hidden></object>"
174+ + " <object id='i3' style='display: none'></object>"
175+ + " <fieldset disabled><object id='i4'></object></fieldset>"
176+ + " </form>\n "
177+ + "</body></html>" ;
178+
179+ loadPageVerifyTitle2 (html );
180+ }
181+
182+ /**
183+ * Since an <object> is never itself a candidate for
184+ * constraint validation, a custom validity message set on it must have NO
185+ * effect on checkValidity() -- must still report true, and
186+ * .validity.valid must still be true.
187+ * @throws Exception if an error occurs
188+ */
189+ @ Test
190+ @ Alerts ({"false" , "false" , "true" })
191+ public void setCustomValidityDoesNotAffectCheckValidity () throws Exception {
192+ final String html = DOCTYPE_HTML
193+ + "<html><head>\n "
194+ + " <script>\n "
195+ + LOG_TITLE_FUNCTION
196+ + " function test() {\n "
197+ + " var o = document.getElementById('o');\n "
198+ + " o.setCustomValidity('some error');\n "
199+ + " log(o.willValidate);\n "
200+ + " log(o.validity.valid);\n "
201+ + " log(o.checkValidity());\n "
202+ // + " log(o.validationMessage);\n"
203+ + " }\n "
204+ + " </script>\n "
205+ + "</head>\n "
206+ + "<body onload='test()'>\n "
207+ + " <form>\n "
208+ + " <object id='o'></object>"
209+ + " </form>\n "
210+ + "</body></html>" ;
211+
212+ loadPageVerifyTitle2 (html );
213+ }
214+ //
215+ // /**
216+ // * The validationMessage must always be empty on an <object>, 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+ // }
84247}
0 commit comments