1 /*
2 * Copyright (c) 2002-2025 Gargoyle Software Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 * https://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15 package org.htmlunit.libraries;
16
17 import org.htmlunit.WebServerTestCase;
18 import org.junit.jupiter.api.BeforeAll;
19 import org.junit.jupiter.api.Test;
20
21 /**
22 * Tests for compatibility with version 1.7.1 of
23 * <a href="http://www.prototypejs.org/">Prototype JavaScript library</a>.
24 *
25 * @author Ronald Brill
26 */
27 public class Prototype171Test extends PrototypeTestBase {
28
29 /**
30 * @throws Exception if an error occurs
31 */
32 @BeforeAll
33 public static void aaa_startSesrver() throws Exception {
34 SERVER_ = WebServerTestCase.createWebServer("src/test/resources/libraries/prototype/1.7.1/test/unit/", null);
35 }
36
37 /**
38 * {@inheritDoc}
39 */
40 @Override
41 protected String getVersion() {
42 return "1.7.1";
43 }
44
45 /**
46 * @throws Exception if test fails
47 */
48 @Test
49 public void ajax() throws Exception {
50 test("ajax_test.html");
51 }
52
53 /**
54 * @throws Exception if test fails
55 */
56 @Test
57 public void array() throws Exception {
58 test("array_test.html");
59 }
60
61 /**
62 * @throws Exception if test fails
63 */
64 @Test
65 public void base() throws Exception {
66 test("base_test.html");
67 }
68
69 /**
70 * @throws Exception if test fails
71 */
72 @Test
73 public void clazz() throws Exception {
74 test("class_test.html");
75 }
76
77 /**
78 * @throws Exception if test fails
79 */
80 @Test
81 public void date() throws Exception {
82 test("date_test.html");
83 }
84
85 /**
86 * Note: <tt>testElementGetDimensions:</tt>, <tt>testElementGetStyle</tt>, <tt>testElementGetHeight</tt>,
87 * <tt>testElementScrollTo:</tt>, <tt>testPositionedOffset</tt>, <tt>testViewportOffset</tt>,
88 * <tt>testViewportDimensions</tt>, <tt>testViewportScrollOffsets</tt>
89 * and <tt>testElementGetWidth</tt> are expected to fail with HtmlUnit,
90 * as they need calculating width and height of all elements.
91 *
92 * Other tests succeed.
93 *
94 * @throws Exception if test fails
95 */
96 @Test
97 public void dom() throws Exception {
98 test("dom_test.html");
99 }
100
101 /**
102 * Depends on {@link org.htmlunit.javascript.HtmlUnitScriptable2Test#parentProtoFeature()}.
103 *
104 * @throws Exception if test fails
105 */
106 @Test
107 public void elementMixins() throws Exception {
108 test("element_mixins_test.html");
109 }
110
111 /**
112 * @throws Exception if test fails
113 */
114 @Test
115 public void enumerable() throws Exception {
116 test("enumerable_test.html");
117 }
118
119 /**
120 * @throws Exception if test fails
121 */
122 @Test
123 public void eventHandler() throws Exception {
124 test("event_handler_test.html");
125 }
126
127 /**
128 * @throws Exception if test fails
129 */
130 @Test
131 public void event() throws Exception {
132 test("event_test.html");
133 }
134
135 /**
136 * @throws Exception if test fails
137 */
138 @Test
139 public void form() throws Exception {
140 test("form_test.html");
141 }
142
143 /**
144 * @throws Exception if test fails
145 */
146 @Test
147 public void function() throws Exception {
148 test("function_test.html");
149 }
150
151 /**
152 * @throws Exception if test fails
153 */
154 @Test
155 public void hash() throws Exception {
156 test("hash_test.html");
157 }
158
159 /**
160 * @throws Exception if test fails
161 */
162 @Test
163 public void layout() throws Exception {
164 test("layout_test.html");
165 }
166
167 /**
168 * @throws Exception if test fails
169 */
170 @Test
171 public void number() throws Exception {
172 test("number_test.html");
173 }
174
175 /**
176 * @throws Exception if test fails
177 */
178 @Test
179 public void object() throws Exception {
180 test("object_test.html");
181 }
182
183 /**
184 * @throws Exception if test fails
185 */
186 @Test
187 public void periodicalExecuter() throws Exception {
188 test("periodical_executer_test.html");
189 }
190
191 /**
192 * @throws Exception if test fails
193 */
194 @Test
195 public void position() throws Exception {
196 test("position_test.html");
197 }
198
199 /**
200 * @throws Exception if test fails
201 */
202 @Test
203 public void prototype() throws Exception {
204 test("prototype_test.html");
205 }
206
207 /**
208 * @throws Exception if test fails
209 */
210 @Test
211 public void range() throws Exception {
212 test("range_test.html");
213 }
214
215 /**
216 * @throws Exception if test fails
217 */
218 @Test
219 public void regexp() throws Exception {
220 test("regexp_test.html");
221 }
222
223 /**
224 * @throws Exception if test fails
225 */
226 @Test
227 public void selectorEngine() throws Exception {
228 test("selector_engine_test.html");
229 }
230
231 /**
232 * @throws Exception if test fails
233 */
234 @Test
235 public void selector() throws Exception {
236 test("selector_test.html");
237 }
238
239 /**
240 * @throws Exception if test fails
241 */
242 @Test
243 public void string() throws Exception {
244 // blocks real chrome/ff
245 // test("string_test.html");
246 }
247
248 /**
249 * 1 expected failure is because the server port is other than 4711.
250 * @throws Exception if test fails
251 */
252 @Test
253 public void unitTests() throws Exception {
254 test("unittest_test.html");
255 }
256 }