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.prototype;
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.6.1 of
23 * <a href="http://www.prototypejs.org/">Prototype JavaScript library</a>.
24 *
25 * @author Ronald Brill
26 */
27 public class Prototype161Test 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.6.1/test/unit/", null);
35 }
36
37 /**
38 * {@inheritDoc}
39 */
40 @Override
41 protected String getVersion() {
42 return "1.6.1";
43 }
44
45 /**
46 * @throws Exception if test fails
47 */
48 @Test
49 public void ajax() throws Exception {
50 test("ajax.html");
51 }
52
53 /**
54 * @throws Exception if test fails
55 */
56 @Test
57 public void array() throws Exception {
58 test("array.html");
59 }
60
61 /**
62 * @throws Exception if test fails
63 */
64 @Test
65 public void base() throws Exception {
66 test("base.html");
67 }
68
69 /**
70 * @throws Exception if test fails
71 */
72 @Test
73 public void clazz() throws Exception {
74 test("class.html");
75 }
76
77 /**
78 * @throws Exception if test fails
79 */
80 @Test
81 public void date() throws Exception {
82 test("date.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.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.html");
109 }
110
111 /**
112 * @throws Exception if test fails
113 */
114 @Test
115 public void enumerable() throws Exception {
116 test("enumerable.html");
117 }
118
119 /**
120 * @throws Exception if test fails
121 */
122 @Test
123 public void event() throws Exception {
124 test("event.html");
125 }
126
127 /**
128 * @throws Exception if test fails
129 */
130 @Test
131 public void form() throws Exception {
132 test("form.html");
133 }
134
135 /**
136 * @throws Exception if test fails
137 */
138 @Test
139 public void function() throws Exception {
140 test("function.html");
141 }
142
143 /**
144 * @throws Exception if test fails
145 */
146 @Test
147 public void hash() throws Exception {
148 test("hash.html");
149 }
150
151 /**
152 * @throws Exception if test fails
153 */
154 @Test
155 public void number() throws Exception {
156 test("number.html");
157 }
158
159 /**
160 * @throws Exception if test fails
161 */
162 @Test
163 public void periodicalExecuter() throws Exception {
164 test("periodical_executer.html");
165 }
166
167 /**
168 * @throws Exception if test fails
169 */
170 @Test
171 public void position() throws Exception {
172 test("position.html");
173 }
174
175 /**
176 * @throws Exception if test fails
177 */
178 @Test
179 public void prototype() throws Exception {
180 test("prototype.html");
181 }
182
183 /**
184 * @throws Exception if test fails
185 */
186 @Test
187 public void range() throws Exception {
188 test("range.html");
189 }
190
191 /**
192 * @throws Exception if test fails
193 */
194 @Test
195 public void regexp() throws Exception {
196 test("regexp.html");
197 }
198
199 /**
200 * @throws Exception if test fails
201 */
202 @Test
203 public void selector() throws Exception {
204 test("selector.html");
205 }
206
207 /**
208 * @throws Exception if test fails
209 */
210 @Test
211 public void string() throws Exception {
212 // blocks real chrome/ff
213 // test("string.html");
214 }
215
216 /**
217 * @throws Exception if test fails
218 */
219 @Test
220 public void object() throws Exception {
221 test("object.html");
222 }
223
224 /**
225 * 1 expected failure is because the server port is other than 4711.
226 * @throws Exception if test fails
227 */
228 @Test
229 public void unitTests() throws Exception {
230 test("unittest.html");
231 }
232 }