001: /*
002: * Copyright (c) 2002-2008 Gargoyle Software Inc. All rights reserved.
003: *
004: * Redistribution and use in source and binary forms, with or without
005: * modification, are permitted provided that the following conditions are met:
006: *
007: * 1. Redistributions of source code must retain the above copyright notice,
008: * this list of conditions and the following disclaimer.
009: * 2. Redistributions in binary form must reproduce the above copyright notice,
010: * this list of conditions and the following disclaimer in the documentation
011: * and/or other materials provided with the distribution.
012: * 3. The end-user documentation included with the redistribution, if any, must
013: * include the following acknowledgment:
014: *
015: * "This product includes software developed by Gargoyle Software Inc.
016: * (http://www.GargoyleSoftware.com/)."
017: *
018: * Alternately, this acknowledgment may appear in the software itself, if
019: * and wherever such third-party acknowledgments normally appear.
020: * 4. The name "Gargoyle Software" must not be used to endorse or promote
021: * products derived from this software without prior written permission.
022: * For written permission, please contact info@GargoyleSoftware.com.
023: * 5. Products derived from this software may not be called "HtmlUnit", nor may
024: * "HtmlUnit" appear in their name, without prior written permission of
025: * Gargoyle Software Inc.
026: *
027: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
028: * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
029: * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GARGOYLE
030: * SOFTWARE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
031: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
032: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
033: * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
034: * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
035: * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
036: * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
037: */
038: package com.gargoylesoftware.htmlunit.libraries;
039:
040: import java.util.Iterator;
041:
042: /**
043: * Tests for compatibility with version 1.1.3.1 of the <a href="http://jquery.com/">jQuery JavaScript library</a>.
044: *
045: * @version $Revision: 2132 $
046: * @author Daniel Gredler
047: */
048: public class JQuery1131Test extends JQueryTestBase {
049:
050: /**
051: * Creates an instance.
052: *
053: * @param name The name of the test.
054: */
055: public JQuery1131Test(final String name) {
056: super (name);
057: }
058:
059: /**
060: * {@inheritDoc}
061: */
062: protected String getVersion() {
063: return "1.1.3.1";
064: }
065:
066: /**
067: * {@inheritDoc}
068: */
069: public void testJQueryWithFirefox2() throws Exception {
070: if (notYetImplemented()) {
071: return;
072: }
073: super .testJQueryWithFirefox2();
074: }
075:
076: /**
077: * {@inheritDoc}
078: */
079: protected void verify(final Iterator i, final boolean ie)
080: throws Exception {
081:
082: final int failedDollar, passedDollar;
083: final int failedAppend, passedAppend;
084: final int failedElement, passedElement;
085: final int failedMultiple, passedMultiple;
086:
087: if (ie) {
088: failedDollar = 1;
089: passedDollar = 2;
090: failedAppend = 0;
091: passedAppend = 17; // TODO: all 17 pass, but one shoud fail!
092: failedElement = 1;
093: passedElement = 8;
094: failedMultiple = 4;
095: passedMultiple = 0;
096: } else {
097: failedDollar = 0;
098: passedDollar = 3;
099: failedAppend = 0;
100: passedAppend = 17;
101: failedElement = 0;
102: passedElement = 9;
103: failedMultiple = 0;
104: passedMultiple = 4;
105: }
106:
107: ok(i, "core module: Basic requirements", 0, 7);
108: ok(i, "core module: $()", failedDollar, passedDollar);
109: ok(i, "core module: isFunction", 0, 21);
110: ok(i, "core module: length", 0, 1);
111: ok(i, "core module: size()", 0, 1);
112: ok(i, "core module: get()", 0, 1);
113: ok(i, "core module: get(Number)", 0, 1);
114: ok(i, "core module: add(String|Element|Array)", 0, 7);
115: ok(i, "core module: each(Function)", 0, 1);
116: ok(i, "core module: index(Object)", 0, 8);
117: ok(i, "core module: attr(String)", 0, 13);
118: ok(i, "core module: attr(String, Function)", 0, 2);
119: ok(i, "core module: attr(Hash)", 0, 1);
120: ok(i, "core module: attr(String, Object)", 0, 8);
121: ok(i, "core module: css(String|Hash)", 0, 19);
122: ok(i, "core module: css(String, Object)", 0, 18);
123: ok(i, "core module: text()", 0, 1);
124: ok(i, "core module: wrap(String|Element)", 0, 7);
125: ok(
126: i,
127: "core module: append(String|Element|Array<Element>|jQuery)",
128: failedAppend, passedAppend);
129: ok(
130: i,
131: "core module: appendTo(String|Element|Array<Element>|jQuery)",
132: 0, 6);
133: ok(
134: i,
135: "core module: prepend(String|Element|Array<Element>|jQuery)",
136: 0, 5);
137: ok(
138: i,
139: "core module: prependTo(String|Element|Array<Element>|jQuery)",
140: 0, 6);
141: ok(
142: i,
143: "core module: before(String|Element|Array<Element>|jQuery)",
144: 0, 4);
145: ok(
146: i,
147: "core module: insertBefore(String|Element|Array<Element>|jQuery)",
148: 0, 4);
149: ok(
150: i,
151: "core module: after(String|Element|Array<Element>|jQuery)",
152: 0, 4);
153: ok(
154: i,
155: "core module: insertAfter(String|Element|Array<Element>|jQuery)",
156: 0, 4);
157: ok(i, "core module: end()", 0, 3);
158: ok(i, "core module: find(String)", 0, 1);
159: ok(i, "core module: clone()", 0, 3);
160: ok(i, "core module: is(String)", 0, 26);
161: ok(i, "core module: $.extend(Object, Object)", 0, 2);
162: ok(i, "core module: $.extend(Object, Object, Object, Object)",
163: 0, 4);
164: ok(i, "core module: val()", 0, 2);
165: ok(i, "core module: val(String)", 0, 2);
166: ok(i, "core module: html(String)", 0, 1);
167: ok(i, "core module: filter()", 0, 4);
168: ok(i, "core module: not()", 0, 3);
169: ok(i, "core module: siblings([String])", 0, 4);
170: ok(i, "core module: children([String])", 0, 3);
171: ok(i, "core module: parent[s]([String])", 0, 8);
172: ok(i, "core module: next/prev([String])", 0, 8);
173: ok(i, "core module: show()", 0, 1);
174: ok(i, "core module: addClass(String)", 0, 1);
175: ok(i, "core module: removeClass(String) - simple", 0, 3);
176: ok(i, "core module: toggleClass(String)", 0, 3);
177: ok(i, "core module: removeAttr(String", 0, 1);
178: ok(i, "core module: text(String)", 0, 1);
179: ok(i, "core module: $.each(Object,Function)", 0, 8);
180: ok(i, "core module: $.prop", 0, 2);
181: ok(i, "core module: $.className", 0, 6);
182: ok(i, "core module: remove()", 0, 4);
183: ok(i, "core module: empty()", 0, 2);
184: ok(i, "core module: eq(), gt(), lt(), contains()", 0, 4);
185:
186: ok(i, "selector module: element", failedElement, passedElement);
187: ok(i, "selector module: broken", 0, 7);
188: ok(i, "selector module: id", 0, 24);
189: ok(i, "selector module: class", 0, 16);
190: ok(i, "selector module: multiple", failedMultiple,
191: passedMultiple);
192: ok(i, "selector module: child and adjacent", 0, 19);
193: ok(i, "selector module: attributes", 0, 20);
194: ok(i, "selector module: pseudo (:) selectors", 0, 30);
195: ok(i, "selector module: basic xpath", 0, 15);
196:
197: ok(i, "event module: bind()", 0, 12);
198: ok(i, "event module: click()", 0, 3);
199: ok(i, "event module: unbind(event)", 0, 6);
200: ok(i, "event module: trigger(event, [data]", 0, 3);
201: ok(i, "event module: toggle(Function, Function)", 0, 4);
202:
203: ok(i, "fx module: animate(Hash, Object, Function)", 0, 1);
204: ok(i, "fx module: toggle()", 0, 3);
205: }
206:
207: }
|