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