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