[jboss-svn-commits] JBoss Portal SVN: r5278 - in trunk/theme: . src/bin src/bin/test-portal-ajax-war src/bin/test-portal-ajax-war/jsunit src/bin/test-portal-ajax-war/jsunit/app src/bin/test-portal-ajax-war/jsunit/app/css src/bin/test-portal-ajax-war/jsunit/css src/bin/test-portal-ajax-war/jsunit/images
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Sep 27 21:31:20 EDT 2006
Author: roy.russo at jboss.com
Date: 2006-09-27 21:31:15 -0400 (Wed, 27 Sep 2006)
New Revision: 5278
Added:
trunk/theme/src/bin/test-portal-ajax-war/
trunk/theme/src/bin/test-portal-ajax-war/jsunit/
trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/
trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/css/
trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/css/jsUnitStyle.css
trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/css/readme
trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/emptyPage.html
trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/jsUnitCore.js
trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/jsUnitTestManager.js
trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/jsUnitTestSuite.js
trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/jsUnitTracer.js
trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/main-counts-errors.html
trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/main-counts-failures.html
trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/main-counts-runs.html
trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/main-counts.html
trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/main-data.html
trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/main-errors.html
trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/main-frame.html
trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/main-loader.html
trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/main-progress.html
trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/main-results.html
trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/main-status.html
trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/testContainer.html
trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/testContainerController.html
trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/xbDebug.js
trunk/theme/src/bin/test-portal-ajax-war/jsunit/css/
trunk/theme/src/bin/test-portal-ajax-war/jsunit/css/jsUnitStyle.css
trunk/theme/src/bin/test-portal-ajax-war/jsunit/images/
trunk/theme/src/bin/test-portal-ajax-war/jsunit/images/green.gif
trunk/theme/src/bin/test-portal-ajax-war/jsunit/images/logo_jsunit.gif
trunk/theme/src/bin/test-portal-ajax-war/jsunit/images/red.gif
trunk/theme/src/bin/test-portal-ajax-war/jsunit/testRunner.html
trunk/theme/src/bin/test-portal-ajax-war/testDragandDrop.html
Modified:
trunk/theme/build.xml
Log:
JBPORTAL-1009
- added static unit testing resources to test packaging
- added html/js resources for javascript unit testing
Modified: trunk/theme/build.xml
===================================================================
--- trunk/theme/build.xml 2006-09-28 01:23:53 UTC (rev 5277)
+++ trunk/theme/build.xml 2006-09-28 01:31:15 UTC (rev 5278)
@@ -211,15 +211,30 @@
<jar jarfile="${build.lib}/portal-theme-test-lib.jar">
<fileset dir="${build.classes}" includes="org/jboss/portal/test/**"/>
</jar>
-
<copy todir="${build.resources}/test-portal-ajax-war/WEB-INF/lib">
<fileset dir="${build.lib}/" includes="portal-theme-test-lib.jar"/>
</copy>
+ <!-- copy reusable javascript libraries -->
+ <copy todir="${build.resources}/test-portal-ajax-war/js">
+ <fileset dir="${source.bin}/portal-ajax-war/js/portal"/>
+ </copy>
+
<jar jarfile="${build.lib}/test-portal-ajax.war">
<fileset dir="${build.resources}/test-portal-ajax-war"/>
+ <fileset dir="${source.bin}/test-portal-ajax-war"/>
</jar>
+ </target>
+ <target name="tests" depends="init">
+ <property name="build.testlog" value="${module.output}/log"/>
+
+ <!--
+ TODO: after deployment of test-portal-ajax.war the relevant urls are:
+ JSUnit TestRunner URL: http://localhost:8080/test/jsunit/testRunner.html
+ testPage URL: http://localhost:8080/test/testDragandDrop.html
+ -->
+
<!-- start jsunit server
<junit showoutput="true" haltonerror="true" haltonfailure="true">
<classpath refid="library.classpath"/>
@@ -232,9 +247,4 @@
-->
</target>
-
- <target name="tests" depends="init">
- <property name="build.testlog" value="${module.output}/log"/>
- </target>
-
</project>
Added: trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/css/jsUnitStyle.css
===================================================================
--- trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/css/jsUnitStyle.css 2006-09-28 01:23:53 UTC (rev 5277)
+++ trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/css/jsUnitStyle.css 2006-09-28 01:31:15 UTC (rev 5278)
@@ -0,0 +1,120 @@
+/* jsUnit */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Edward Hieatt code.
+ *
+ * The Initial Developer of the Original Code is
+ * Edward Hieatt, edward at jsunit.net.
+ * Portions created by the Initial Developer are Copyright (C) 2001
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Edward Hieatt, edward at jsunit.net (original author)
+ * Bob Clary, bc at bclary.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+body
+{
+ margin-top: 0;
+ margin-bottom: 0;
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ color: #000;
+ font-size: 0.8em;
+ background-color: #fff;
+}
+
+td
+{
+ padding: 0;
+ margin: 0;
+}
+
+td img
+{
+ padding: 0;
+ margin: 0;
+ vertical-align: baseline;
+ display: block;
+}
+
+input
+{
+}
+
+select
+{
+}
+
+a:link, a:visited
+{
+ color : #00F;
+}
+
+a:hover
+{
+ color : #F00;
+}
+
+.jsUnitDefault
+{
+}
+
+h1, th
+{
+ font-size: 1.3em;
+ font-weight: bold;
+ color: #039;
+}
+
+h2
+{
+ font-weight: bold;
+ color: #039;
+}
+
+h3
+{
+ font-weight: bold;
+ color: #039;
+ text-decoration: underline;
+}
+
+h4
+{
+ font-weight: bold;
+ color: #039;
+}
+
+.jsUnitTestResultSuccess
+{
+ color: #000;
+}
+
+.jsUnitTestResultNotSuccess
+{
+ color: #F00;
+}
Added: trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/css/readme
===================================================================
--- trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/css/readme 2006-09-28 01:23:53 UTC (rev 5277)
+++ trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/css/readme 2006-09-28 01:31:15 UTC (rev 5278)
@@ -0,0 +1,10 @@
+this file is required due to differences in behavior between Mozilla/Opera
+and Internet Explorer.
+
+main-data.html calls kickOffTests() which calls top.testManager.start()
+in the top most frame. top.testManager.start() initializes the output
+frames using document.write and HTML containing a relative <link> to the
+jsUnitStyle.css file. In MSIE, the base href used to find the CSS file is
+that of the top level frame however in Mozilla/Opera the base href is
+that of main-data.html. This leads to not-found for the jsUnitStyle.css
+in Mozilla/Opera. Creating app/css/jsUnitStyle.css works around this problem.
Added: trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/emptyPage.html
===================================================================
--- trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/emptyPage.html 2006-09-28 01:23:53 UTC (rev 5277)
+++ trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/emptyPage.html 2006-09-28 01:31:15 UTC (rev 5278)
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<!-- @author Edward Hieatt, edward at jsunit.net -->
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>emptyPage</title>
+ </head>
+
+ <body>
+ </body>
+</html>
+
Added: trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/jsUnitCore.js
===================================================================
--- trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/jsUnitCore.js 2006-09-28 01:23:53 UTC (rev 5277)
+++ trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/jsUnitCore.js 2006-09-28 01:31:15 UTC (rev 5278)
@@ -0,0 +1,383 @@
+/* @author Edward Hieatt, edward at jsunit.net */
+
+var JSUNIT_UNDEFINED_VALUE;
+var JSUNIT_VERSION="2.1";
+var isTestPageLoaded = false;
+
+//hack for NS62 bug
+function jsUnitFixTop() {
+ var tempTop = top;
+ if (!tempTop) {
+ tempTop = window;
+ while (tempTop.parent) {
+ tempTop = tempTop.parent;
+ if (tempTop.top && tempTop.top.jsUnitTestSuite) {
+ tempTop = tempTop.top;
+ break;
+ }
+ }
+ }
+ try {
+ window.top = tempTop;
+ } catch (e) {}
+}
+
+jsUnitFixTop();
+
+function _displayStringForValue(aVar) {
+ if (aVar === null)
+ return 'null';
+
+ if (aVar === top.JSUNIT_UNDEFINED_VALUE)
+ return 'undefined';
+
+ return aVar;
+}
+
+function fail(failureMessage) {
+ throw new JsUnitException(null, failureMessage);
+}
+
+function error(errorMessage) {
+ var errorObject = new Object();
+ errorObject.description = errorMessage;
+ errorObject.stackTrace = getStackTrace();
+ throw errorObject;
+}
+
+function argumentsIncludeComments(expectedNumberOfNonCommentArgs, args) {
+ return args.length == expectedNumberOfNonCommentArgs + 1;
+}
+
+function commentArg(expectedNumberOfNonCommentArgs, args) {
+ if (argumentsIncludeComments(expectedNumberOfNonCommentArgs, args))
+ return args[0];
+
+ return null;
+}
+
+function nonCommentArg(desiredNonCommentArgIndex, expectedNumberOfNonCommentArgs, args) {
+ return argumentsIncludeComments(expectedNumberOfNonCommentArgs, args) ?
+ args[desiredNonCommentArgIndex] :
+ args[desiredNonCommentArgIndex - 1];
+}
+
+function _validateArguments(expectedNumberOfNonCommentArgs, args) {
+ if (!( args.length == expectedNumberOfNonCommentArgs ||
+ (args.length == expectedNumberOfNonCommentArgs + 1 && typeof(args[0]) == 'string') ))
+ error('Incorrect arguments passed to assert function');
+}
+
+function _assert(comment, booleanValue, failureMessage) {
+ if (!booleanValue)
+ throw new JsUnitException(comment, failureMessage);
+}
+
+function assert() {
+ _validateArguments(1, arguments);
+ var booleanValue=nonCommentArg(1, 1, arguments);
+
+ if (typeof(booleanValue) != 'boolean')
+ error('Bad argument to assert(boolean)');
+
+ _assert(commentArg(1, arguments), booleanValue === true, 'Call to assert(boolean) with false');
+}
+
+function assertTrue() {
+ _validateArguments(1, arguments);
+ var booleanValue=nonCommentArg(1, 1, arguments);
+
+ if (typeof(booleanValue) != 'boolean')
+ error('Bad argument to assertTrue(boolean)');
+
+ _assert(commentArg(1, arguments), booleanValue === true, 'Call to assertTrue(boolean) with false');
+}
+
+function assertFalse() {
+ _validateArguments(1, arguments);
+ var booleanValue=nonCommentArg(1, 1, arguments);
+
+ if (typeof(booleanValue) != 'boolean')
+ error('Bad argument to assertFalse(boolean)');
+
+ _assert(commentArg(1, arguments), booleanValue === false, 'Call to assertFalse(boolean) with true');
+}
+
+function assertEquals() {
+ _validateArguments(2, arguments);
+ var var1=nonCommentArg(1, 2, arguments);
+ var var2=nonCommentArg(2, 2, arguments);
+ _assert(commentArg(2, arguments), var1 === var2, 'Expected ' + var1 + ' (' + typeof(var1) + ') but was ' + _displayStringForValue(var2) + ' (' + typeof(var2) + ')');
+}
+
+function assertNotEquals() {
+ _validateArguments(2, arguments);
+ var var1=nonCommentArg(1, 2, arguments);
+ var var2=nonCommentArg(2, 2, arguments);
+ _assert(commentArg(2, arguments), var1 !== var2, 'Expected not to be ' + _displayStringForValue(var2));
+}
+
+function assertNull() {
+ _validateArguments(1, arguments);
+ var aVar=nonCommentArg(1, 1, arguments);
+ _assert(commentArg(1, arguments), aVar === null, 'Expected null but was ' + _displayStringForValue(aVar));
+}
+
+function assertNotNull() {
+ _validateArguments(1, arguments);
+ var aVar=nonCommentArg(1, 1, arguments);
+ _assert(commentArg(1, arguments), aVar !== null, 'Expected not to be null');
+}
+
+function assertUndefined() {
+ _validateArguments(1, arguments);
+ var aVar=nonCommentArg(1, 1, arguments);
+ _assert(commentArg(1, arguments), aVar === top.JSUNIT_UNDEFINED_VALUE, 'Expected undefined but was ' + _displayStringForValue(aVar));
+}
+
+function assertNotUndefined() {
+ _validateArguments(1, arguments);
+ var aVar=nonCommentArg(1, 1, arguments);
+ _assert(commentArg(1, arguments), aVar !== top.JSUNIT_UNDEFINED_VALUE, 'Expected not to be undefined');
+}
+
+function assertNaN() {
+ _validateArguments(1, arguments);
+ var aVar=nonCommentArg(1, 1, arguments);
+ _assert(commentArg(1, arguments), isNaN(aVar), 'Expected NaN');
+}
+
+function assertNotNaN() {
+ _validateArguments(1, arguments);
+ var aVar=nonCommentArg(1, 1, arguments);
+ _assert(commentArg(1, arguments), !isNaN(aVar), 'Expected not NaN');
+}
+
+function isLoaded() {
+ return isTestPageLoaded;
+}
+
+function setUp() {
+}
+
+function tearDown() {
+}
+
+function getFunctionName(aFunction) {
+ var name = aFunction.toString().match(/function (\w*)/)[1];
+
+ if ((name == null) || (name.length == 0))
+ name = 'anonymous';
+
+ return name;
+}
+
+function getStackTrace() {
+ var result = '';
+
+ if (typeof(arguments.caller) != 'undefined') { // IE, not ECMA
+ for (var a = arguments.caller; a != null; a = a.caller) {
+ result += '> ' + getFunctionName(a.callee) + '\n';
+ if (a.caller == a) {
+ result += '*';
+ break;
+ }
+ }
+ }
+ else { // Mozilla, not ECMA
+ // fake an exception so we can get Mozilla's error stack
+ var testExcp;
+ try
+ {
+ foo.bar;
+ }
+ catch(testExcp)
+ {
+ var stack = parseErrorStack(testExcp);
+ for (var i = 1; i < stack.length; i++)
+ {
+ result += '> ' + stack[i] + '\n';
+ }
+ }
+ }
+
+ return result;
+}
+
+function parseErrorStack(excp)
+{
+ var stack = [];
+ var name;
+
+ if (!excp || !excp.stack)
+ {
+ return stack;
+ }
+
+ var stacklist = excp.stack.split('\n');
+
+ for (var i = 0; i < stacklist.length - 1; i++)
+ {
+ var framedata = stacklist[i];
+
+ name = framedata.match(/^(\w*)/)[1];
+ if (!name) {
+ name = 'anonymous';
+ }
+
+ stack[stack.length] = name;
+ }
+ // remove top level anonymous functions to match IE
+
+ while (stack.length && stack[stack.length - 1] == 'anonymous')
+ {
+ stack.length = stack.length - 1;
+ }
+ return stack;
+}
+
+function JsUnitException(comment, message) {
+ this.isJsUnitException = true;
+ this.comment = comment;
+ this.jsUnitMessage = message;
+ this.stackTrace = getStackTrace();
+}
+
+function warn() {
+ if (top.tracer != null)
+ top.tracer.warn(arguments[0], arguments[1]);
+}
+
+function inform() {
+ if (top.tracer != null)
+ top.tracer.inform(arguments[0], arguments[1]);
+}
+
+function info() {
+ inform(arguments[0], arguments[1]);
+}
+
+function debug() {
+ if (top.tracer != null)
+ top.tracer.debug(arguments[0], arguments[1]);
+}
+
+function setjsUnitTracer(ajsUnitTracer) {
+ top.tracer=ajsUnitTracer;
+}
+
+function trim(str) {
+ if (str == null)
+ return null;
+
+ var startingIndex = 0;
+ var endingIndex = str.length-1;
+
+ while (str.substring(startingIndex, startingIndex+1) == ' ')
+ startingIndex++;
+
+ while (str.substring(endingIndex, endingIndex+1) == ' ')
+ endingIndex--;
+
+ if (endingIndex < startingIndex)
+ return '';
+
+ return str.substring(startingIndex, endingIndex+1);
+}
+
+function isBlank(str) {
+ return trim(str) == '';
+}
+
+// the functions push(anArray, anObject) and pop(anArray)
+// exist because the JavaScript Array.push(anObject) and Array.pop()
+// functions are not available in IE 5.0
+
+function push(anArray, anObject) {
+ anArray[anArray.length]=anObject;
+}
+function pop(anArray) {
+ if (anArray.length>=1) {
+ delete anArray[anArray.length - 1];
+ anArray.length--;
+ }
+}
+
+// safe, strict access to jsUnitParmHash
+function jsUnitGetParm(name)
+{
+ if (typeof(top.jsUnitParmHash[name]) != 'undefined')
+ {
+ return top.jsUnitParmHash[name];
+ }
+ return null;
+}
+
+if (top && typeof(top.xbDEBUG) != 'undefined' && top.xbDEBUG.on && top.testManager)
+{
+ top.xbDebugTraceObject('top.testManager.containerTestFrame', 'JSUnitException');
+ // asserts
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', '_displayStringForValue');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'error');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'argumentsIncludeComments');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'commentArg');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'nonCommentArg');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', '_validateArguments');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', '_assert');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'assert');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'assertTrue');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'assertEquals');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'assertNotEquals');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'assertNull');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'assertNotNull');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'assertUndefined');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'assertNotUndefined');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'assertNaN');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'assertNotNaN');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'isLoaded');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'setUp');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'tearDown');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'getFunctionName');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'getStackTrace');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'warn');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'inform');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'debug');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'setjsUnitTracer');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'trim');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'isBlank');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'newOnLoadEvent');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'push');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'pop');
+}
+
+function newOnLoadEvent() {
+ isTestPageLoaded = true;
+}
+
+function jsUnitSetOnLoad(windowRef, onloadHandler)
+{
+ var isKonqueror = navigator.userAgent.indexOf('Konqueror/') != -1 ||
+ navigator.userAgent.indexOf('Safari/') != -1;
+
+ if (typeof(windowRef.attachEvent) != 'undefined') {
+ // Internet Explorer, Opera
+ windowRef.attachEvent("onload", onloadHandler);
+ } else if (typeof(windowRef.addEventListener) != 'undefined' && !isKonqueror){
+ // Mozilla, Konqueror
+ // exclude Konqueror due to load issues
+ windowRef.addEventListener("load", onloadHandler, false);
+ } else if (typeof(windowRef.document.addEventListener) != 'undefined' && !isKonqueror) {
+ // DOM 2 Events
+ // exclude Mozilla, Konqueror due to load issues
+ windowRef.document.addEventListener("load", onloadHandler, false);
+ } else if (typeof(windowRef.onload) != 'undefined' && windowRef.onload) {
+ windowRef.jsunit_original_onload = windowRef.onload;
+ windowRef.onload = function() { windowRef.jsunit_original_onload(); onloadHandler(); };
+ } else {
+ // browsers that do not support windowRef.attachEvent or
+ // windowRef.addEventListener will override a page's own onload event
+ windowRef.onload=onloadHandler;
+ }
+}
+
+jsUnitSetOnLoad(window, newOnLoadEvent);
\ No newline at end of file
Added: trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/jsUnitTestManager.js
===================================================================
--- trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/jsUnitTestManager.js 2006-09-28 01:23:53 UTC (rev 5277)
+++ trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/jsUnitTestManager.js 2006-09-28 01:31:15 UTC (rev 5278)
@@ -0,0 +1,676 @@
+/* @author Edward Hieatt, edward at jsunit.net */
+
+function jsUnitTestManager()
+{
+ this._windowForAllProblemMessages = null;
+
+
+ this.container = top.frames.testContainer
+ this.documentLoader = top.frames.documentLoader;
+ this.mainFrame = top.frames.mainFrame;
+
+ this.containerController = this.container.frames.testContainerController;
+ this.containerTestFrame = this.container.frames.testFrame;
+
+ var mainData = this.mainFrame.frames.mainData;
+
+ // form elements on mainData frame
+ this.testFileName = mainData.document.testRunnerForm.testFileName;
+ this.runButton = mainData.document.testRunnerForm.runButton;
+ this.traceLevel = mainData.document.testRunnerForm.traceLevel;
+ this.closeTraceWindowOnNewRun = mainData.document.testRunnerForm.closeTraceWindowOnNewRun;
+ this.timeout = mainData.document.testRunnerForm.timeout;
+ this.setUpPageTimeout = mainData.document.testRunnerForm.setUpPageTimeout;
+
+ // image output
+ this.progressBar = this.mainFrame.frames.mainProgress.document.progress;
+
+ this.problemsListField = this.mainFrame.frames.mainErrors.document.testRunnerForm.problemsList;
+ this.testCaseResultsField = this.mainFrame.frames.mainResults.document.resultsForm.testCases;
+ this.resultsTimeField = this.mainFrame.frames.mainResults.document.resultsForm.time;
+
+ // 'layer' output frames
+ this.uiFrames = new Object();
+ this.uiFrames.mainStatus = this.mainFrame.frames.mainStatus;
+
+ var mainCounts = this.mainFrame.frames.mainCounts;
+
+ this.uiFrames.mainCountsErrors = mainCounts.frames.mainCountsErrors;
+ this.uiFrames.mainCountsFailures = mainCounts.frames.mainCountsFailures;
+ this.uiFrames.mainCountsRuns = mainCounts.frames.mainCountsRuns;
+ this._baseURL = "";
+
+ this.setup();
+}
+
+// seconds to wait for each test page to load
+jsUnitTestManager.TESTPAGE_WAIT_SEC = 20;
+jsUnitTestManager.TIMEOUT_LENGTH = 20;
+
+// seconds to wait for setUpPage to complete
+jsUnitTestManager.SETUPPAGE_TIMEOUT = 60;
+
+// milliseconds to wait between polls on setUpPages
+jsUnitTestManager.SETUPPAGE_INTERVAL = 100;
+
+jsUnitTestManager.prototype.setup = function ()
+{
+ this.totalCount = 0;
+ this.errorCount = 0;
+ this.failureCount = 0;
+ this._suiteStack = Array();
+
+
+ var initialSuite = new top.jsUnitTestSuite();
+ push(this._suiteStack, initialSuite);
+}
+
+jsUnitTestManager.prototype.start = function ()
+{
+ this._baseURL = this.resolveUserEnteredTestFileName();
+ var firstQuery = this._baseURL.indexOf("?");
+ if (firstQuery >= 0) {
+ this._baseURL = this._baseURL.substring(0, firstQuery);
+ }
+ var lastSlash = this._baseURL.lastIndexOf("/");
+ var lastRevSlash = this._baseURL.lastIndexOf("\\");
+ if (lastRevSlash > lastSlash) {
+ lastSlash = lastRevSlash;
+ }
+ if (lastSlash > 0) {
+ this._baseURL = this._baseURL.substring(0, lastSlash + 1);
+ }
+
+ this._timeRunStarted = new Date();
+ this.initialize();
+ setTimeout('top.testManager._nextPage();', jsUnitTestManager.TIMEOUT_LENGTH);
+}
+
+jsUnitTestManager.prototype.getBaseURL = function () {
+ return this._baseURL;
+}
+
+jsUnitTestManager.prototype.doneLoadingPage = function (pageName)
+{
+ //this.containerTestFrame.setTracer(top.tracer);
+ this._testFileName = pageName;
+ if (this.isTestPageSuite())
+ this._handleNewSuite();
+ else
+ {
+ this._testIndex = 0;
+ this._testsInPage = this.getTestFunctionNames();
+ this._numberOfTestsInPage = this._testsInPage.length;
+ this._runTest();
+ }
+}
+
+jsUnitTestManager.prototype._handleNewSuite = function ()
+{
+ var allegedSuite = this.containerTestFrame.suite();
+ if (allegedSuite.isjsUnitTestSuite) {
+ var newSuite = allegedSuite.clone();
+ if (newSuite.containsTestPages())
+ push(this._suiteStack, newSuite);
+ this._nextPage();
+ }
+ else {
+ alert('Invalid test suite in file ' + this._testFileName);
+ this.abort();
+ }
+}
+
+jsUnitTestManager.prototype._runTest = function ()
+{
+ if (this._testIndex + 1 > this._numberOfTestsInPage)
+ {
+ this._nextPage();
+ return;
+ }
+
+ if (this._testIndex == 0 && typeof(this.containerTestFrame.setUpPage) == 'function')
+ {
+ // first test for this page and a setUpPage is defined
+ if (typeof(this.containerTestFrame.setUpPageStatus) == 'undefined')
+ {
+ // setUpPage() not called yet, so call it
+ this.containerTestFrame.setUpPageStatus = false;
+ this.containerTestFrame.startTime = new Date();
+ this.containerTestFrame.setUpPage();
+ // try test again later
+ setTimeout('top.testManager._runTest()', jsUnitTestManager.SETUPPAGE_INTERVAL);
+ return;
+ }
+
+ if (this.containerTestFrame.setUpPageStatus != 'complete')
+ {
+ // setUpPage called, but not complete yet
+ top.status = 'setUpPage not completed... ' + this.containerTestFrame.setUpPageStatus + ' ' + (new Date());
+ if ((new Date() - this.containerTestFrame.startTime) /1000 > this.getsetUpPageTimeout()) {
+ alert('setUpPage timed out without completing.');
+ if (prompt('Retry or Cancel ?', 'Retry') != 'Retry')
+ {
+ this.abort();
+ return;
+ }
+ this.containerTestFrame.startTime = (new Date());
+ }
+ // try test again later
+ setTimeout('top.testManager._runTest()', jsUnitTestManager.SETUPPAGE_INTERVAL);
+ return;
+ }
+ }
+
+ top.status = '';
+ // either not first test, or no setUpPage defined, or setUpPage completed
+ this.executeTestFunction(this._testsInPage[this._testIndex]);
+ this.totalCount++;
+ this.updateProgressIndicators();
+ this._testIndex++;
+ setTimeout('top.testManager._runTest()', jsUnitTestManager.TIMEOUT_LENGTH);
+}
+
+jsUnitTestManager.prototype._done = function ()
+{
+ var secondsSinceRunBegan=(new Date() - this._timeRunStarted)/1000;
+ this.setStatus('Done (' + secondsSinceRunBegan + ' seconds)');
+ this._cleanUp();
+ if (top.shouldSubmitResults()) {
+ this.resultsTimeField.value = secondsSinceRunBegan;
+ top.submitResults();
+ }
+}
+
+jsUnitTestManager.prototype._nextPage = function ()
+{
+ if (this._currentSuite().hasMorePages()) {
+ this.loadPage(this._currentSuite().nextPage());
+ }
+ else {
+ pop(this._suiteStack);
+ if (this._currentSuite() == null)
+ this._done();
+ else
+ this._nextPage();
+ }
+}
+
+jsUnitTestManager.prototype._currentSuite = function ()
+{
+ var suite = null;
+
+ if (this._suiteStack && this._suiteStack.length > 0)
+ suite = this._suiteStack[this._suiteStack.length-1];
+
+ return suite;
+}
+
+jsUnitTestManager.prototype.calculateProgressBarProportion = function ()
+{
+ if (this.totalCount == 0)
+ return 0;
+ var currentDivisor = 1;
+ var result = 0;
+
+ for (var i = 0; i < this._suiteStack.length; i++) {
+ var aSuite = this._suiteStack[i];
+ currentDivisor *= aSuite.testPages.length;
+ result += (aSuite.pageIndex - 1)/currentDivisor;
+ }
+ result += (this._testIndex + 1)/(this._numberOfTestsInPage * currentDivisor);
+ return result;
+}
+
+jsUnitTestManager.prototype._cleanUp = function ()
+{
+ this.containerController.setTestPage('./app/emptyPage.html');
+ this.finalize();
+ top.tracer.finalize();
+}
+
+jsUnitTestManager.prototype.abort = function ()
+{
+ this.setStatus('Aborted');
+ this._cleanUp();
+}
+
+jsUnitTestManager.prototype.getTimeout = function ()
+{
+ var result = jsUnitTestManager.TESTPAGE_WAIT_SEC;
+ try {
+ result = eval(this.timeout.value);
+ }
+ catch (e) {
+ }
+ return result;
+}
+
+jsUnitTestManager.prototype.getsetUpPageTimeout = function ()
+{
+ var result = jsUnitTestManager.SETUPPAGE_TIMEOUT;
+ try {
+ result = eval(this.setUpPageTimeout.value);
+ }
+ catch (e) {
+ }
+ return result;
+}
+
+jsUnitTestManager.prototype.isTestPageSuite = function ()
+{
+ var result = false;
+ if (typeof(this.containerTestFrame.suite) == 'function')
+ {
+ result = true;
+ }
+ return result;
+}
+
+jsUnitTestManager.prototype.getTestFunctionNames = function ()
+{
+ var testFrame = this.containerTestFrame;
+ var testFunctionNames = new Array();
+ var i;
+
+ if (testFrame && typeof(testFrame.exposeTestFunctionNames) == 'function')
+ return testFrame.exposeTestFunctionNames();
+
+ if (testFrame &&
+ testFrame.document &&
+ typeof(testFrame.document.scripts) != 'undefined') { // IE5 and up
+ var scriptsInTestFrame = testFrame.document.scripts;
+
+ for (i = 0; i < scriptsInTestFrame.length; i++) {
+ var someNames = this._extractTestFunctionNamesFromScript(scriptsInTestFrame[i]);
+ if (someNames)
+ testFunctionNames=testFunctionNames.concat(someNames);
+ }
+ }
+ else {
+ for (i in testFrame) {
+ if (i.substring(0, 4) == 'test' && typeof(testFrame[i]) == 'function')
+ push(testFunctionNames, i);
+ }
+ }
+ return testFunctionNames;
+}
+
+jsUnitTestManager.prototype._extractTestFunctionNamesFromScript = function (aScript)
+{
+ var result;
+ var remainingScriptToInspect = aScript.text;
+ var currentIndex = remainingScriptToInspect.indexOf('function test');
+ while (currentIndex != -1) {
+ if (!result)
+ result=new Array();
+
+ var fragment = remainingScriptToInspect.substring(currentIndex, remainingScriptToInspect.length);
+ result = result.concat(fragment.substring('function '.length, fragment.indexOf('(')));
+ remainingScriptToInspect=remainingScriptToInspect.substring(currentIndex+12, remainingScriptToInspect.length);
+ currentIndex=remainingScriptToInspect.indexOf('function test');
+ }
+ return result;
+}
+
+jsUnitTestManager.prototype.loadPage = function (testFileName)
+{
+ this._testFileName = testFileName;
+ this._loadAttemptStartTime = new Date();
+ this.setStatus('Opening Test Page "' + this._testFileName + '"');
+ this.containerController.setTestPage(this._testFileName);
+ this._callBackWhenPageIsLoaded();
+}
+
+jsUnitTestManager.prototype._callBackWhenPageIsLoaded = function ()
+{
+ if ((new Date() - this._loadAttemptStartTime) / 1000 > this.getTimeout()) {
+ alert('Reading Test Page ' + this._testFileName + ' timed out.\nMake sure that the file exists and is a Test Page.');
+ if (prompt('Retry or Cancel ?', 'Retry') != 'Retry')
+ {
+ this.abort();
+ return;
+ }
+ }
+ if (!this._isTestFrameLoaded()) {
+ setTimeout('top.testManager._callBackWhenPageIsLoaded();', jsUnitTestManager.TIMEOUT_LENGTH);
+ return;
+ }
+ this.doneLoadingPage(this._testFileName);
+}
+
+jsUnitTestManager.prototype._isTestFrameLoaded = function ()
+{
+ try {
+ return this.containerController.isPageLoaded();
+ }
+ catch (e) {
+ }
+ return false;
+}
+
+jsUnitTestManager.prototype.executeTestFunction = function (functionName)
+{
+ this._testFunctionName=functionName;
+ this.setStatus('Running test "' + this._testFunctionName + '"');
+ var excep=null;
+ var timeBefore = new Date();
+ try {
+ this.containerTestFrame.setUp();
+ eval('this.containerTestFrame.' + this._testFunctionName + '();');
+ }
+ catch (e1) {
+ excep = e1;
+ }
+ finally {
+ try {
+ this.containerTestFrame.tearDown();
+ }
+ catch (e2) {
+ excep = e2;
+ }
+ }
+ var timeTaken = (new Date() - timeBefore) / 1000;
+ if (excep != null)
+ this._handleTestException(excep);
+ var serializedTestCaseString = this._fullyQualifiedCurrentTestFunctionName()+"|"+timeTaken+"|";
+ if (excep==null)
+ serializedTestCaseString+="S||";
+ else {
+ if (typeof(excep.isJsUnitException) != 'undefined' && excep.isJsUnitException)
+ serializedTestCaseString+="F|";
+ else {
+ serializedTestCaseString+="E|";
+ }
+ serializedTestCaseString+=this._problemDetailMessageFor(excep);
+ }
+ var newOption = new Option(serializedTestCaseString);
+ this.testCaseResultsField[this.testCaseResultsField.length]=newOption;
+}
+
+jsUnitTestManager.prototype._fullyQualifiedCurrentTestFunctionName = function() {
+ var testURL = this.containerTestFrame.location.href;
+ var testQuery = testURL.indexOf("?");
+ if (testQuery >= 0) {
+ testURL = testURL.substring(0, testQuery);
+ }
+ if (testURL.substring(0, this._baseURL.length) == this._baseURL) {
+ testURL = testURL.substring(this._baseURL.length);
+ }
+ return testURL + ':' + this._testFunctionName;
+}
+
+
+jsUnitTestManager.prototype._handleTestException = function (excep)
+{
+ var problemMessage = this._fullyQualifiedCurrentTestFunctionName() + ' ';
+ var errOption;
+ if (typeof(excep.isJsUnitException) == 'undefined' || !excep.isJsUnitException) {
+ problemMessage += 'had an error';
+ this.errorCount++;
+ }
+ else {
+ problemMessage += 'failed';
+ this.failureCount++;
+ }
+ var listField = this.problemsListField;
+ var problemDocument = this.mainFrame.frames.mainErrors.document;
+ if (typeof(problemDocument.createElement) != 'undefined') {
+ // DOM Level 2 HTML method.
+ // this is required for Opera 7 since appending to the end of the
+ // options array does not work, and adding an Option created by new Option()
+ // and appended by listField.options.add() fails due to WRONG_DOCUMENT_ERR
+ errOption = problemDocument.createElement('option');
+ errOption.setAttribute('value', this._problemDetailMessageFor(excep));
+ errOption.appendChild(problemDocument.createTextNode(problemMessage));
+ listField.appendChild(errOption);
+ }
+ else {
+ // new Option() is DOM 0
+ errOption = new Option(problemMessage, this._problemDetailMessageFor(excep));
+ if (typeof(listField.add) != 'undefined') {
+ // DOM 2 HTML
+ listField.add( errOption , null);
+ }
+ else if (typeof(listField.options.add) != 'undefined') {
+ // DOM 0
+ listField.options.add( errOption, null);
+ }
+ else {
+ // DOM 0
+ listField.options[listField.length]= errOption;
+ }
+ }
+}
+
+jsUnitTestManager.prototype._problemDetailMessageFor = function (excep)
+{
+ var result=null;
+ if (typeof(excep.isJsUnitException) != 'undefined' && excep.isJsUnitException) {
+ result = '';
+ if (excep.comment != null)
+ result+=('"'+excep.comment+'"\n');
+
+ result += excep.jsUnitMessage;
+
+ if (excep.stackTrace)
+ result+='\n\nStack trace follows:\n'+excep.stackTrace;
+ }
+ else {
+ result = 'Error message is:\n"';
+ result +=
+ (typeof(excep.description) == 'undefined') ?
+ excep :
+ excep.description;
+ result += '"';
+ if (typeof(excep.stack) != 'undefined') // Mozilla only
+ result+='\n\nStack trace follows:\n'+excep.stack;
+ }
+ return result;
+}
+
+jsUnitTestManager.prototype._setTextOnLayer = function (layerName, str)
+{
+ var html = '';
+ html += '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';
+ html += '<html><head><link rel="stylesheet" type="text/css" href="css/jsUnitStyle.css"><\/head>';
+ html += '<body><div>';
+ html += str;
+ html += '<\/div><\/body>';
+ html += '<\/html>';
+ this.uiFrames[layerName].document.write(html);
+ this.uiFrames[layerName].document.close();
+}
+
+jsUnitTestManager.prototype.setStatus = function (str)
+{
+ this._setTextOnLayer('mainStatus', '<b>Status:<\/b> '+str);
+}
+
+jsUnitTestManager.prototype._setErrors = function (n)
+{
+ this._setTextOnLayer('mainCountsErrors', '<b>Errors: <\/b>' + n);
+}
+
+jsUnitTestManager.prototype._setFailures = function (n)
+{
+ this._setTextOnLayer('mainCountsFailures', '<b>Failures:<\/b> ' + n);
+}
+
+jsUnitTestManager.prototype._setTotal = function (n)
+{
+ this._setTextOnLayer('mainCountsRuns', '<b>Runs:<\/b> ' + n);
+}
+
+jsUnitTestManager.prototype._setProgressBarImage = function (imgName)
+{
+ this.progressBar.src=imgName;
+}
+
+jsUnitTestManager.prototype._setProgressBarWidth = function (w)
+{
+ this.progressBar.width=w;
+}
+
+jsUnitTestManager.prototype.updateProgressIndicators = function ()
+{
+ this._setTotal(this.totalCount);
+ this._setErrors(this.errorCount);
+ this._setFailures(this.failureCount);
+ this._setProgressBarWidth(300 * this.calculateProgressBarProportion());
+
+ if (this.errorCount > 0 || this.failureCount > 0)
+ this._setProgressBarImage('../images/red.gif');
+ else
+ this._setProgressBarImage('../images/green.gif');
+}
+
+jsUnitTestManager.prototype.showMessageForSelectedProblemTest = function ()
+{
+ var problemTestIndex = this.problemsListField.selectedIndex;
+ if (problemTestIndex != -1)
+ alert(this.problemsListField[problemTestIndex].value);
+}
+
+jsUnitTestManager.prototype.showMessagesForAllProblemTests = function ()
+{
+ if (this.problemsListField.length == 0)
+ return;
+
+ try
+ {
+ if (this._windowForAllProblemMessages && !this._windowForAllProblemMessages.closed)
+ this._windowForAllProblemMessages.close();
+ }
+ catch(e)
+ {
+ }
+
+ this._windowForAllProblemMessages = window.open('','','width=600, height=350,status=no,resizable=yes,scrollbars=yes');
+ var resDoc = this._windowForAllProblemMessages.document;
+ resDoc.write('<html><head><link rel="stylesheet" href="../css/jsUnitStyle.css"><title>Tests with problems - JsUnit<\/title><head><body>');
+ resDoc.write('<p class="jsUnitSubHeading">Tests with problems (' + this.problemsListField.length + ' total) - JsUnit<\/p>');
+ resDoc.write('<p class="jsUnitSubSubHeading"><i>Running on '+navigator.userAgent+'</i></p>');
+ for (var i = 0; i < this.problemsListField.length; i++)
+ {
+ resDoc.write('<p class="jsUnitDefault">');
+ resDoc.write('<b>' + (i + 1) + '. ');
+ resDoc.write(this.problemsListField[i].text);
+ resDoc.write('<\/b><\/p><p><pre>');
+ resDoc.write(this.problemsListField[i].value);
+ resDoc.write('<\/pre><\/p>');
+ }
+
+ resDoc.write('<\/body><\/html>');
+ resDoc.close();
+}
+
+jsUnitTestManager.prototype._clearProblemsList = function ()
+{
+ var listField = this.problemsListField;
+ var initialLength=listField.options.length;
+
+ for (var i = 0; i < initialLength; i++)
+ listField.remove(0);
+}
+
+jsUnitTestManager.prototype.initialize = function ()
+{
+ this.setStatus('Initializing...');
+ this._setRunButtonEnabled(false);
+ this._clearProblemsList();
+ this.updateProgressIndicators();
+ this.setStatus('Done initializing');
+}
+
+jsUnitTestManager.prototype.finalize = function ()
+{
+ this._setRunButtonEnabled(true);
+}
+
+jsUnitTestManager.prototype._setRunButtonEnabled = function (b)
+{
+ this.runButton.disabled = !b;
+}
+
+jsUnitTestManager.prototype.getTestFileName = function ()
+{
+ var rawEnteredFileName = this.testFileName.value;
+ var result = rawEnteredFileName;
+
+ while (result.indexOf('\\') != -1)
+ result = result.replace('\\', '/');
+
+ return result;
+}
+
+jsUnitTestManager.prototype.resolveUserEnteredTestFileName = function (rawText)
+{
+ var userEnteredTestFileName = top.testManager.getTestFileName();
+
+ // only test for file:// since Opera uses a different format
+ if (userEnteredTestFileName.indexOf('http://') == 0 || userEnteredTestFileName.indexOf('https://') == 0 || userEnteredTestFileName.indexOf('file://') == 0)
+ return userEnteredTestFileName;
+
+ return getTestFileProtocol() + this.getTestFileName();
+}
+
+function getTestFileProtocol()
+{
+ return getDocumentProtocol();
+}
+
+function getDocumentProtocol()
+{
+ var protocol = top.document.location.protocol;
+
+ if (protocol == "file:")
+ return "file:///";
+
+ if (protocol == "http:")
+ return "http://";
+
+ if (protocol == 'https:')
+ return 'https://';
+
+ if (protocol == "chrome:")
+ return "chrome://";
+
+ return null;
+}
+
+function isBeingRunOverHTTP() {
+ return getDocumentProtocol()=="http://";
+}
+
+function getWebserver() {
+ if (isBeingRunOverHTTP()) {
+ var myUrl = location.href;
+ var myUrlWithProtocolStripped = myUrl.substring(myUrl.indexOf("/") + 2);
+ return myUrlWithProtocolStripped.substring(0, myUrlWithProtocolStripped.indexOf("/"));
+ }
+ return null;
+}
+
+// the functions push(anArray, anObject) and pop(anArray)
+// exist because the JavaScript Array.push(anObject) and Array.pop()
+// functions are not available in IE 5.0
+
+function push(anArray, anObject)
+{
+ anArray[anArray.length]=anObject;
+}
+
+function pop(anArray)
+{
+ if (anArray.length>=1) {
+ delete anArray[anArray.length - 1];
+ anArray.length--;
+ }
+}
+
+if (xbDEBUG.on)
+{
+ xbDebugTraceObject('window', 'jsUnitTestManager');
+ xbDebugTraceFunction('window', 'getTestFileProtocol');
+ xbDebugTraceFunction('window', 'getDocumentProtocol');
+}
Added: trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/jsUnitTestSuite.js
===================================================================
--- trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/jsUnitTestSuite.js 2006-09-28 01:23:53 UTC (rev 5277)
+++ trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/jsUnitTestSuite.js 2006-09-28 01:31:15 UTC (rev 5278)
@@ -0,0 +1,46 @@
+/* @author Edward Hieatt, edward at jsunit.net */
+
+function jsUnitTestSuite() {
+ this.isjsUnitTestSuite = true;
+ this.testPages = Array();
+ this.pageIndex = 0;
+}
+
+jsUnitTestSuite.prototype.addTestPage = function (pageName)
+{
+ this.testPages[this.testPages.length] = pageName;
+}
+
+jsUnitTestSuite.prototype.addTestSuite = function (suite)
+{
+ for (var i = 0; i < suite.testPages.length; i++)
+ this.addTestPage(suite.testPages[i]);
+}
+
+jsUnitTestSuite.prototype.containsTestPages = function ()
+{
+ return this.testPages.length > 0;
+}
+
+jsUnitTestSuite.prototype.nextPage = function ()
+{
+ return this.testPages[this.pageIndex++];
+}
+
+jsUnitTestSuite.prototype.hasMorePages = function ()
+{
+ return this.pageIndex < this.testPages.length;
+}
+
+jsUnitTestSuite.prototype.clone = function ()
+{
+ var clone = new jsUnitTestSuite();
+ clone.testPages = this.testPages;
+ return clone;
+}
+
+if (xbDEBUG.on)
+{
+ xbDebugTraceObject('window', 'jsUnitTestSuite');
+}
+
Added: trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/jsUnitTracer.js
===================================================================
--- trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/jsUnitTracer.js 2006-09-28 01:23:53 UTC (rev 5277)
+++ trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/jsUnitTracer.js 2006-09-28 01:31:15 UTC (rev 5278)
@@ -0,0 +1,83 @@
+/* @author Edward Hieatt, edward at jsunit.net */
+
+function jsUnitTracer() {
+ this._traceWindow = null;
+ this.TRACE_LEVEL_WARNING = 1;
+ this.TRACE_LEVEL_INFO = 2;
+ this.TRACE_LEVEL_DEBUG = 3;
+ this.popupWindowsBlocked = false;
+}
+
+jsUnitTracer.prototype.initialize = function ()
+{
+ if (this._traceWindow != null && top.testManager.closeTraceWindowOnNewRun.checked)
+ this._traceWindow.close();
+
+ this._traceWindow = null;
+}
+
+jsUnitTracer.prototype.finalize = function ()
+{
+ if (this._traceWindow!=null) {
+ this._traceWindow.document.write('<\/body>\n<\/html>');
+ this._traceWindow.document.close();
+ }
+}
+
+jsUnitTracer.prototype.warn = function ()
+{
+ this._trace(arguments[0], arguments[1], this.TRACE_LEVEL_WARNING);
+}
+
+jsUnitTracer.prototype.inform = function ()
+{
+ this._trace(arguments[0], arguments[1], this.TRACE_LEVEL_INFO);
+}
+
+jsUnitTracer.prototype.debug = function ()
+{
+ this._trace(arguments[0], arguments[1], this.TRACE_LEVEL_DEBUG);
+}
+
+jsUnitTracer.prototype._trace = function (message, value, traceLevel)
+{
+ if (this._getChosenTraceLevel() >= traceLevel) {
+ var traceString = message;
+ if (value)
+ traceString += ': ' + value;
+ this._writeToTraceWindow(traceString, traceLevel);
+ }
+}
+
+jsUnitTracer.prototype._getChosenTraceLevel = function ()
+{
+ return eval(top.testManager.traceLevel.value);
+}
+
+jsUnitTracer.prototype._writeToTraceWindow = function (traceString, traceLevel)
+{
+ var htmlToAppend = '<p class="jsUnitDefault">' + traceString + '<\/p>\n';
+ this._getTraceWindow().document.write(htmlToAppend);
+}
+
+jsUnitTracer.prototype._getTraceWindow = function ()
+{
+ if (this._traceWindow == null && !this.popupWindowsBlocked) {
+ this._traceWindow = window.open('','','width=600, height=350,status=no,resizable=yes,scrollbars=yes');
+ if (!this._traceWindow) {
+ this.popupWindowsBlocked = true;
+ }
+ else {
+ var resDoc = this._traceWindow.document;
+ resDoc.write('<html>\n<head>\n<link rel="stylesheet" href="css/jsUnitStyle.css">\n<title>Tracing - JsUnit<\/title>\n<head>\n<body>');
+ resDoc.write('<h2>Tracing - JsUnit<\/h2>\n');
+ }
+ }
+ return this._traceWindow;
+}
+
+if (xbDEBUG.on)
+{
+ xbDebugTraceObject('window', 'jsUnitTracer');
+}
+
Added: trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/main-counts-errors.html
===================================================================
--- trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/main-counts-errors.html 2006-09-28 01:23:53 UTC (rev 5277)
+++ trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/main-counts-errors.html 2006-09-28 01:31:15 UTC (rev 5278)
@@ -0,0 +1,14 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<!-- @author Edward Hieatt, edward at jsunit.net -->
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title></title>
+ <link rel="stylesheet" type="text/css" href="../css/jsUnitStyle.css">
+ </head>
+
+ <body>
+ <div><b>Errors:</b> 0</div>
+ </body>
+</html>
\ No newline at end of file
Added: trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/main-counts-failures.html
===================================================================
--- trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/main-counts-failures.html 2006-09-28 01:23:53 UTC (rev 5277)
+++ trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/main-counts-failures.html 2006-09-28 01:31:15 UTC (rev 5278)
@@ -0,0 +1,15 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<!-- @author Edward Hieatt, edward at jsunit.net -->
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title></title>
+ <link rel="stylesheet" type="text/css" href="../css/jsUnitStyle.css">
+ </head>
+
+ <body>
+ <div><b>Failures:</b> 0</div>
+ </body>
+</html>
+
Added: trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/main-counts-runs.html
===================================================================
--- trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/main-counts-runs.html 2006-09-28 01:23:53 UTC (rev 5277)
+++ trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/main-counts-runs.html 2006-09-28 01:31:15 UTC (rev 5278)
@@ -0,0 +1,15 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<!-- @author Edward Hieatt, edward at jsunit.net -->
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title></title>
+ <link rel="stylesheet" type="text/css" href="../css/jsUnitStyle.css">
+ </head>
+
+ <body>
+ <div><b>Runs:</b> 0</div>
+ </body>
+</html>
+
Added: trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/main-counts.html
===================================================================
--- trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/main-counts.html 2006-09-28 01:23:53 UTC (rev 5277)
+++ trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/main-counts.html 2006-09-28 01:31:15 UTC (rev 5278)
@@ -0,0 +1,24 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
+ "http://www.w3.org/TR/html4/frameset.dtd">
+<html>
+<!-- @author Edward Hieatt, edward at jsunit.net -->
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title></title>
+ </head>
+
+ <frameset cols="200,190,*">
+ <frame name="mainCountsRuns" src="main-counts-runs.html" scrolling="no" frameborder="0">
+ <frame name="mainCountsErrors" src="main-counts-errors.html" scrolling="no" frameborder="0">
+ <frame name="mainCountsFailures" src="main-counts-failures.html" scrolling="no" frameborder="0">
+
+ <noframes>
+ <body>
+ <p>jsUnit has been modified to use frames in order to remove
+ dependencies upon a browser's implementation of document.getElementById
+ and HTMLElement.innerHTML.</p>
+ </body>
+ </noframes>
+ </frameset>
+</html>
+
Added: trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/main-data.html
===================================================================
--- trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/main-data.html 2006-09-28 01:23:53 UTC (rev 5277)
+++ trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/main-data.html 2006-09-28 01:31:15 UTC (rev 5278)
@@ -0,0 +1,161 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<!-- @author Edward Hieatt, edward at jsunit.net -->
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>JsUnit main-data.html</title>
+ <link rel="stylesheet" type="text/css" href="../css/jsUnitStyle.css">
+ <script language="JavaScript" type="text/javascript" src="jsUnitCore.js"></script>
+ <script language="JavaScript" type="text/javascript">
+
+function kickOffTests() {
+ //
+ // Check if Init was called by onload handler
+ //
+ if (typeof(top.testManager) == 'undefined') {
+ top.init();
+ }
+
+
+ if (isBlank(top.testManager.getTestFileName())) {
+ alert('Please enter a file name.');
+ return;
+ }
+
+ top.testManager.setup();
+
+ top.testManager._currentSuite().addTestPage(top.testManager.resolveUserEnteredTestFileName());
+ top.tracer.initialize();
+
+ var traceLevel = document.forms.testRunnerForm.traceLevel;
+ if (traceLevel.value != '0')
+ {
+ var traceWindow = top.tracer._getTraceWindow();
+ if (traceWindow) {
+ traceWindow.focus();
+ }
+ else {
+ alert('Tracing requires popup windows which are blocked in your browser.\n\nPlease enable popups if you wish to use tracing.');
+ }
+ }
+
+ top.testManager.start();
+}
+ </script>
+ </head>
+
+ <body onload="document.testRunnerForm.testFileName.focus()">
+ <form name="testRunnerForm" action="">
+ <table width="100%" cellpadding="0" cellspacing="0" border="0" summary="jsUnit Information" bgcolor="#DDDDDD">
+ <tr>
+ <td align="left" valign="top"><img src="../images/logo_jsunit.gif" alt="JSUnit Logo"></td>
+ <th nowrap align="left" valign="middle">
+ JsUnit <script language="javascript">document.write(JSUNIT_VERSION);</script> TestRunner<br>
+ <font size="-2"><i>Running on <script language="javascript" type="text/javascript">document.write(navigator.userAgent);</script></i></font>
+ </th>
+
+ <td nowrap align="right" valign="middle">
+ <a href="http://www.jsunit.net/" target="_blank">JsUnit Home</a><br>
+ <a href="mailto:edward at jsunit.net">edward at jsunit.net</a><br>
+ </tr>
+ </table>
+
+ <p>Enter the filename of the Test Page to be run:</p>
+
+ <table cellpadding="0" cellspacing="0" border="0" summary="Form for entering test case location">
+ <tr>
+ <td align="center" valign="middle">
+ <script language="JavaScript" type="text/javascript">
+ document.write(top.getDocumentProtocol());
+ </script>
+ </td>
+
+ <td nowrap align="center" valign="bottom">
+
+ <script language="JavaScript" type="text/javascript">
+ if (top.getDocumentProtocol() == 'file:///' && !jsUnitGetParm('testpage'))
+ {
+ document.write('<input type="file" name="testFileName" size="60">');
+ }
+ else
+ {
+ var inputStr = '<input type="text" name="testFileName" size="60" ';
+ if (jsUnitGetParm('testpage'))
+ {
+ inputStr += 'value="';
+ if (
+ (top.getDocumentProtocol() == 'http://' || top.getDocumentProtocol() == 'https://') &&
+ jsUnitGetParm('testpage').indexOf('/') == 0)
+ {
+ inputStr += top.location.host;
+ }
+ inputStr += jsUnitGetParm('testpage');
+ var testParms = top.jsUnitConstructTestParms();
+ if (testParms!='') {
+ inputStr += '?';
+ inputStr += testParms;
+ }
+ inputStr += '"';
+ }
+ inputStr += '>';
+ document.write(inputStr);
+ }
+
+ </script>
+ <input type="button" name="runButton" value="Run" onclick="kickOffTests()">
+ </td>
+ </tr>
+ </table>
+ <hr>
+
+ <table cellpadding="0" cellspacing="0" border="0" summary="Choose Trace Level">
+ <tr>
+ <td nowrap>Trace level:</td>
+
+ <td><select name="traceLevel">
+ <option value="0" selected>
+ no tracing
+ </option>
+
+ <option value="1">
+ warning (lowest)
+ </option>
+
+ <option value="2">
+ info
+ </option>
+
+ <option value="3">
+ debug (highest)
+ </option>
+ </select> </td>
+
+ <td> </td>
+
+ <td><input type="checkbox" name="closeTraceWindowOnNewRun" checked></td>
+ <td nowrap>Close old trace window on new run</td>
+
+ <td> </td>
+
+ <td nowrap>Page load timeout:</td>
+ <td>
+ <script language="javascript" type="text/javascript">
+ document.write('<input type="text" size="2" name="timeout" value="'+top.jsUnitTestManager.TESTPAGE_WAIT_SEC+'">');
+ </script>
+ </td>
+
+ <td> </td>
+
+ <td nowrap>Setup page timeout:</td>
+ <td>
+ <script language="javascript" type="text/javascript">
+ document.write('<input type="text" size="2" name="setUpPageTimeout" value="'+top.jsUnitTestManager.SETUPPAGE_TIMEOUT+'">');
+ </script>
+ </td>
+ </tr>
+ </table>
+ <hr>
+ </form>
+ </body>
+</html>
Added: trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/main-errors.html
===================================================================
--- trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/main-errors.html 2006-09-28 01:23:53 UTC (rev 5277)
+++ trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/main-errors.html 2006-09-28 01:31:15 UTC (rev 5278)
@@ -0,0 +1,24 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<!-- @author Edward Hieatt, edward at jsunit.net -->
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>JsUnit main-errors.html</title>
+ <link rel="stylesheet" type="text/css" href="../css/jsUnitStyle.css">
+ </head>
+ <body>
+ <hr>
+ <form name="testRunnerForm" action="javascript:top.testManager.showMessageForSelectedProblemTest()">
+ <p>Errors and failures: </p>
+ <select size="5" ondblclick="top.testManager.showMessageForSelectedProblemTest()" name="problemsList">
+ <option> </option>
+ </select>
+ <br>
+ <input type="button" value="Show selected" onclick="top.testManager.showMessageForSelectedProblemTest()">
+
+ <input type="button" value="Show all" onclick="top.testManager.showMessagesForAllProblemTests()">
+ </form>
+ </body>
+</html>
+
Added: trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/main-frame.html
===================================================================
--- trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/main-frame.html 2006-09-28 01:23:53 UTC (rev 5277)
+++ trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/main-frame.html 2006-09-28 01:31:15 UTC (rev 5278)
@@ -0,0 +1,22 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
+ "http://www.w3.org/TR/html4/frameset.dtd">
+<html>
+<!-- @author Edward Hieatt, edward at jsunit.net -->
+ <head>
+ <title>jsUnit Main Frame</title>
+ </head>
+ <frameset rows="200,30,30,30,0,*">
+ <frame name="mainData" src="main-data.html" scrolling="no" frameborder="0">
+ <frame name="mainStatus" src="main-status.html" scrolling="no" frameborder="0">
+ <frame name="mainProgress" src="main-progress.html" scrolling="no" frameborder="0">
+ <frame name="mainCounts" src="main-counts.html" scrolling="no" frameborder="0">
+ <frame name="mainResults" src="main-results.html" scrolling="no" frameborder="0">
+ <frame name="mainErrors" src="main-errors.html" scrolling="no" frameborder="0">
+ <noframes>
+ <body>
+ <p>Sorry, JsUnit requires frames.</p>
+ </body>
+ </noframes>
+ </frameset>
+</html>
+
Added: trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/main-loader.html
===================================================================
--- trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/main-loader.html 2006-09-28 01:23:53 UTC (rev 5277)
+++ trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/main-loader.html 2006-09-28 01:31:15 UTC (rev 5278)
@@ -0,0 +1,50 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<!-- @author Edward Hieatt, edward at jsunit.net -->
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>jsUnit External Data Document loader</title>
+<script language="JavaScript" type="text/javascript">
+
+ var loadStatus;
+ var callback = function () {};
+
+ function buffer()
+ {
+ return window.frames.documentBuffer;
+ }
+
+ function load(uri)
+ {
+ loadStatus = 'loading';
+ buffer().document.location.href = uri;
+ }
+
+ function loadComplete()
+ {
+ top.xbDEBUG.dump('main-loader.html:loadComplete(): loadStatus = ' + loadStatus + ' href=' + buffer().document.location.href);
+ if (loadStatus == 'loading')
+ {
+ loadStatus = 'complete';
+ callback();
+ callback = function () {};
+ }
+ }
+
+ if (top.xbDEBUG.on)
+ {
+ var scopeName = 'main_loader_' + (new Date()).getTime();
+ top[scopeName] = window;
+ top.xbDebugTraceFunction(scopeName, 'buffer');
+ top.xbDebugTraceFunction(scopeName, 'load');
+ top.xbDebugTraceFunction(scopeName, 'loadComplete');
+ }
+
+</script>
+</head>
+<body>
+<iframe name="documentBuffer" onload="loadComplete()"></iframe>
+</body>
+</html>
+
Added: trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/main-progress.html
===================================================================
--- trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/main-progress.html 2006-09-28 01:23:53 UTC (rev 5277)
+++ trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/main-progress.html 2006-09-28 01:31:15 UTC (rev 5278)
@@ -0,0 +1,26 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<!-- @author Edward Hieatt, edward at jsunit.net -->
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>JsUnit main-progress.html</title>
+ <link rel="stylesheet" type="text/css" href="../css/jsUnitStyle.css">
+ </head>
+ <body>
+ <table width="375" cellpadding="0" cellspacing="0" border="0" summary="Test progress indicator">
+ <tr>
+ <td width="65" valign="top"><b>Progress:</b></td>
+
+ <td width="300" height="14" valign="middle">
+ <table width="300" cellpadding="0" cellspacing="0" border="1" summary="Progress image">
+ <tr>
+ <td width="300" height="14" valign="top"><img name="progress" height="14" width="0" alt="progress image" src="../images/green.gif"></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </body>
+</html>
+
Added: trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/main-results.html
===================================================================
--- trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/main-results.html 2006-09-28 01:23:53 UTC (rev 5277)
+++ trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/main-results.html 2006-09-28 01:31:15 UTC (rev 5278)
@@ -0,0 +1,52 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<!-- @author Edward Hieatt, edward at jsunit.net -->
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>JsUnit main-results.html</title>
+ <link rel="stylesheet" type="text/css" href="../css/jsUnitStyle.css">
+ </head>
+ <body>
+ <script language="javascript" type="text/javascript">
+ var url="http://";
+ if (top.wasResultUrlSpecified()) {
+ url += top.getSpecifiedResultUrl();
+ } else {
+ var webserver=top.getWebserver();
+ if (webserver==null)
+ webserver="localhost";
+ url+=webserver;
+ if (webserver.indexOf(":")==-1)
+ url+=":8080";
+ url+="/jsunit/acceptor";
+ }
+ var formString = "<form name=\"resultsForm\" action=\""+url+"\" method=\"post\" target=\"_top\">";
+ document.write(formString);
+ </script>
+ <input type="hidden" name="id">
+ <input type="hidden" name="userAgent">
+ <input type="hidden" name="JsUnitVersion">
+ <input type="hidden" name="time">
+ <input type="hidden" name="baseURL">
+ <select size="5" name="testCases" multiple></select>
+ </form>
+ <script language="javascript" type="text/javascript">
+ function populateHeaderFields(id, userAgent, jsUnitVersion, baseURL) {
+ document.resultsForm.id.value=id;
+ document.resultsForm.userAgent.value=userAgent;
+ document.resultsForm.JsUnitVersion.value=jsUnitVersion;
+ document.resultsForm.baseURL.value = baseURL;
+ }
+ function submitResults() {
+ var testCasesField = document.resultsForm.testCases;
+ for (var i=0; i<testCasesField.length; i++) {
+ testCasesField[i].selected=true;
+ }
+ document.resultsForm.submit();
+
+ }
+ </script>
+ </body>
+</html>
+
Added: trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/main-status.html
===================================================================
--- trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/main-status.html 2006-09-28 01:23:53 UTC (rev 5277)
+++ trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/main-status.html 2006-09-28 01:31:15 UTC (rev 5278)
@@ -0,0 +1,14 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<!-- @author Edward Hieatt, edward at jsunit.net -->
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>JsUnit main-status.html</title>
+ <link rel="stylesheet" type="text/css" href="../css/jsUnitStyle.css">
+ </head>
+ <body>
+ <div><b>Status:</b> (Idle)</div>
+ </body>
+</html>
+
Added: trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/testContainer.html
===================================================================
--- trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/testContainer.html 2006-09-28 01:23:53 UTC (rev 5277)
+++ trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/testContainer.html 2006-09-28 01:31:15 UTC (rev 5278)
@@ -0,0 +1,18 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
+ "http://www.w3.org/TR/html4/frameset.dtd">
+<html>
+<!-- @author Edward Hieatt, edward at jsunit.net -->
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>JsUnit Test Container</title>
+ </head>
+ <frameset rows="0, *">
+ <frame name="testContainerController" src="testContainerController.html">
+ <frame name="testFrame" src="emptyPage.html">
+ <noframes>
+ <body>
+ <p>Sorry, JsUnit requires frames.</p>
+ </body>
+ </noframes>
+ </frameset>
+</html>
\ No newline at end of file
Added: trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/testContainerController.html
===================================================================
--- trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/testContainerController.html 2006-09-28 01:23:53 UTC (rev 5277)
+++ trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/testContainerController.html 2006-09-28 01:31:15 UTC (rev 5278)
@@ -0,0 +1,74 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<!-- @author Edward Hieatt, edward at jsunit.net -->
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>JsUnit Test Container Controller</title>
+<script language="javascript" type="text/javascript">
+var containerReady=false;
+
+function init()
+{
+ containerReady = true;
+}
+
+function isPageLoaded()
+{
+ if (!containerReady)
+ return false;
+
+ var isTestPageLoaded=false;
+
+ try
+ {
+ // attempt to access the var isTestPageLoaded in the testFrame
+ if (typeof(top.testManager.containerTestFrame.isTestPageLoaded) != 'undefined')
+ {
+ isTestPageLoaded=top.testManager.containerTestFrame.isTestPageLoaded;
+ }
+
+ // ok, if the above did not throw an exception, then the
+ // variable is defined. If the onload has not fired in the
+ // testFrame then isTestPageLoaded is still false. Otherwise
+ // the testFrame has set it to true
+ }
+ catch (e)
+ {
+ // an error occured while attempting to access the isTestPageLoaded
+ // in the testFrame, therefore the testFrame has not loaded yet
+ isTestPageLoaded=false;
+ }
+ return isTestPageLoaded;
+}
+
+function isContainerReady()
+{
+ return containerReady;
+}
+
+function setNotReady()
+{
+ try
+ {
+ // attempt to set the isTestPageLoaded variable
+ // in the test frame to false.
+ top.testManager.containerTestFrame.isTestPageLoaded=false;
+ }
+ catch (e)
+ {
+ // testFrame.isTestPageLoaded not available... ignore
+ }
+}
+function setTestPage(fileName) {
+ setNotReady();
+ top.jsUnitParseParms(fileName);
+ top.testManager.containerTestFrame.location.href=fileName;
+}
+</script>
+ </head>
+
+ <body onload="init()">
+ Test Container Controller
+ </body>
+</html>
\ No newline at end of file
Added: trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/xbDebug.js
===================================================================
--- trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/xbDebug.js 2006-09-28 01:23:53 UTC (rev 5277)
+++ trunk/theme/src/bin/test-portal-ajax-war/jsunit/app/xbDebug.js 2006-09-28 01:31:15 UTC (rev 5278)
@@ -0,0 +1,305 @@
+// xbDebug.js revision: 0.003 2002-02-26
+
+/* ***** BEGIN LICENSE BLOCK *****
+ * Licensed under Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ * Full Terms at /xbProjects-srce/license/mpl-tri-license.txt
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Netscape code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 2001
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Bob Clary <bclary at netscape.com>
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ChangeLog:
+
+2002-02-25: bclary - modified xbDebugTraceOject to make sure
+ that original versions of wrapped functions were not
+ rewrapped. This had caused an infinite loop in IE.
+
+2002-02-07: bclary - modified xbDebug.prototype.close to not null
+ the debug window reference. This can cause problems with
+ Internet Explorer if the page is refreshed. These issues will
+ be addressed at a later date.
+*/
+
+function xbDebug()
+{
+ this.on = false;
+ this.stack = new Array();
+ this.debugwindow = null;
+ this.execprofile = new Object();
+}
+
+xbDebug.prototype.push = function ()
+{
+ this.stack[this.stack.length] = this.on;
+ this.on = true;
+}
+
+xbDebug.prototype.pop = function ()
+{
+ this.on = this.stack[this.stack.length - 1];
+ --this.stack.length;
+}
+
+xbDebug.prototype.open = function ()
+{
+ if (this.debugwindow && !this.debugwindow.closed)
+ this.close();
+
+ this.debugwindow = window.open('about:blank', 'DEBUGWINDOW', 'height=400,width=600,resizable=yes,scrollbars=yes');
+
+ this.debugwindow.title = 'xbDebug Window';
+ this.debugwindow.document.write('<html><head><title>xbDebug Window</title></head><body><h3>Javascript Debug Window</h3></body></html>');
+ this.debugwindow.focus();
+}
+
+xbDebug.prototype.close = function ()
+{
+ if (!this.debugwindow)
+ return;
+
+ if (!this.debugwindow.closed)
+ this.debugwindow.close();
+
+ // bc 2002-02-07, other windows may still hold a reference to this: this.debugwindow = null;
+}
+
+xbDebug.prototype.dump = function (msg)
+{
+ if (!this.on)
+ return;
+
+ if (!this.debugwindow || this.debugwindow.closed)
+ this.open();
+
+ this.debugwindow.document.write(msg + '<br>');
+
+ return;
+}
+
+var xbDEBUG = new xbDebug();
+
+window.onunload = function () { xbDEBUG.close(); }
+
+function xbDebugGetFunctionName(funcref)
+{
+
+ if (!funcref)
+ {
+ return '';
+ }
+
+ if (funcref.name)
+ return funcref.name;
+
+ var name = funcref + '';
+ name = name.substring(name.indexOf(' ') + 1, name.indexOf('('));
+ funcref.name = name;
+
+ if (!name) alert('name not defined');
+ return name;
+}
+
+
+// emulate functionref.apply for IE mac and IE win < 5.5
+function xbDebugApplyFunction(funcname, funcref, thisref, argumentsref)
+{
+ var rv;
+
+ if (!funcref)
+ {
+ alert('xbDebugApplyFunction: funcref is null');
+ }
+
+ if (typeof(funcref.apply) != 'undefined')
+ return funcref.apply(thisref, argumentsref);
+
+ var applyexpr = 'thisref.xbDebug_orig_' + funcname + '(';
+ var i;
+
+ for (i = 0; i < argumentsref.length; i++)
+ {
+ applyexpr += 'argumentsref[' + i + '],';
+ }
+
+ if (argumentsref.length > 0)
+ {
+ applyexpr = applyexpr.substring(0, applyexpr.length - 1);
+ }
+
+ applyexpr += ')';
+
+ return eval(applyexpr);
+}
+
+function xbDebugCreateFunctionWrapper(scopename, funcname, precall, postcall)
+{
+ var wrappedfunc;
+ var scopeobject = eval(scopename);
+ var funcref = scopeobject[funcname];
+
+ scopeobject['xbDebug_orig_' + funcname] = funcref;
+
+ wrappedfunc = function ()
+ {
+ var rv;
+
+ precall(scopename, funcname, arguments);
+ rv = xbDebugApplyFunction(funcname, funcref, scopeobject, arguments);
+ postcall(scopename, funcname, arguments, rv);
+ return rv;
+ };
+
+ if (typeof(funcref.constructor) != 'undefined')
+ wrappedfunc.constructor = funcref.constuctor;
+
+ if (typeof(funcref.prototype) != 'undefined')
+ wrappedfunc.prototype = funcref.prototype;
+
+ scopeobject[funcname] = wrappedfunc;
+}
+
+function xbDebugCreateMethodWrapper(contextname, classname, methodname, precall, postcall)
+{
+ var context = eval(contextname);
+ var methodref = context[classname].prototype[methodname];
+
+ context[classname].prototype['xbDebug_orig_' + methodname] = methodref;
+
+ var wrappedmethod = function ()
+ {
+ var rv;
+ // eval 'this' at method run time to pick up reference to the object's instance
+ var thisref = eval('this');
+ // eval 'arguments' at method run time to pick up method's arguments
+ var argsref = arguments;
+
+ precall(contextname + '.' + classname, methodname, argsref);
+ rv = xbDebugApplyFunction(methodname, methodref, thisref, argsref);
+ postcall(contextname + '.' + classname, methodname, argsref, rv);
+ return rv;
+ };
+
+ return wrappedmethod;
+}
+
+function xbDebugPersistToString(obj)
+{
+ var s = '';
+ var p;
+
+ if (obj == null)
+ return 'null';
+
+ switch(typeof(obj))
+ {
+ case 'number':
+ return obj;
+ case 'string':
+ return '"' + obj + '"';
+ case 'undefined':
+ return 'undefined';
+ case 'boolean':
+ return obj + '';
+ }
+
+ if (obj.constructor)
+ return '[' + xbDebugGetFunctionName(obj.constructor) + ']';
+
+ return null;
+}
+
+function xbDebugTraceBefore(scopename, funcname, funcarguments)
+{
+ var i;
+ var s = '';
+ var execprofile = xbDEBUG.execprofile[scopename + '.' + funcname];
+ if (!execprofile)
+ execprofile = xbDEBUG.execprofile[scopename + '.' + funcname] = { started: 0, time: 0, count: 0 };
+
+ for (i = 0; i < funcarguments.length; i++)
+ {
+ s += xbDebugPersistToString(funcarguments[i]);
+ if (i < funcarguments.length - 1)
+ s += ', ';
+ }
+
+ xbDEBUG.dump('enter ' + scopename + '.' + funcname + '(' + s + ')');
+ execprofile.started = (new Date()).getTime();
+}
+
+function xbDebugTraceAfter(scopename, funcname, funcarguments, rv)
+{
+ var i;
+ var s = '';
+ var execprofile = xbDEBUG.execprofile[scopename + '.' + funcname];
+ if (!execprofile)
+ xbDEBUG.dump('xbDebugTraceAfter: execprofile not created for ' + scopename + '.' + funcname);
+ else if (execprofile.started == 0)
+ xbDEBUG.dump('xbDebugTraceAfter: execprofile.started == 0 for ' + scopename + '.' + funcname);
+ else
+ {
+ execprofile.time += (new Date()).getTime() - execprofile.started;
+ execprofile.count++;
+ execprofile.started = 0;
+ }
+
+ for (i = 0; i < funcarguments.length; i++)
+ {
+ s += xbDebugPersistToString(funcarguments[i]);
+ if (i < funcarguments.length - 1)
+ s += ', ';
+ }
+
+ xbDEBUG.dump('exit ' + scopename + '.' + funcname + '(' + s + ')==' + xbDebugPersistToString(rv));
+}
+
+function xbDebugTraceFunction(scopename, funcname)
+{
+ xbDebugCreateFunctionWrapper(scopename, funcname, xbDebugTraceBefore, xbDebugTraceAfter);
+}
+
+function xbDebugTraceObject(contextname, classname)
+{
+ var classref = eval(contextname + '.' + classname);
+ var p;
+ var sp;
+
+ if (!classref || !classref.prototype)
+ return;
+
+ for (p in classref.prototype)
+ {
+ sp = p + '';
+ if (typeof(classref.prototype[sp]) == 'function' && (sp).indexOf('xbDebug_orig') == -1)
+ {
+ classref.prototype[sp] = xbDebugCreateMethodWrapper(contextname, classname, sp, xbDebugTraceBefore, xbDebugTraceAfter);
+ }
+ }
+}
+
+function xbDebugDumpProfile()
+{
+ var p;
+ var execprofile;
+ var avg;
+
+ for (p in xbDEBUG.execprofile)
+ {
+ execprofile = xbDEBUG.execprofile[p];
+ avg = Math.round ( 100 * execprofile.time/execprofile.count) /100;
+ xbDEBUG.dump('Execution profile ' + p + ' called ' + execprofile.count + ' times. Total time=' + execprofile.time + 'ms. Avg Time=' + avg + 'ms.');
+ }
+}
Added: trunk/theme/src/bin/test-portal-ajax-war/jsunit/css/jsUnitStyle.css
===================================================================
--- trunk/theme/src/bin/test-portal-ajax-war/jsunit/css/jsUnitStyle.css 2006-09-28 01:23:53 UTC (rev 5277)
+++ trunk/theme/src/bin/test-portal-ajax-war/jsunit/css/jsUnitStyle.css 2006-09-28 01:31:15 UTC (rev 5278)
@@ -0,0 +1,83 @@
+/* @author Edward Hieatt, edward at jsunit.net */
+
+body
+{
+ margin-top: 0;
+ margin-bottom: 0;
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ color: #000;
+ font-size: 0.8em;
+ background-color: #fff;
+}
+
+td
+{
+ padding: 0;
+ margin: 0;
+}
+
+td img
+{
+ padding: 0;
+ margin: 0;
+ vertical-align: baseline;
+ display: block;
+}
+
+input
+{
+}
+
+select
+{
+}
+
+a:link, a:visited
+{
+ color : #00F;
+}
+
+a:hover
+{
+ color : #F00;
+}
+
+.jsUnitDefault
+{
+}
+
+h1, th
+{
+ font-size: 1.3em;
+ font-weight: bold;
+ color: #039;
+}
+
+h2
+{
+ font-weight: bold;
+ color: #039;
+}
+
+h3
+{
+ font-weight: bold;
+ color: #039;
+ text-decoration: underline;
+}
+
+h4
+{
+ font-weight: bold;
+ color: #039;
+}
+
+.jsUnitTestResultSuccess
+{
+ color: #000;
+}
+
+.jsUnitTestResultNotSuccess
+{
+ color: #F00;
+}
\ No newline at end of file
Added: trunk/theme/src/bin/test-portal-ajax-war/jsunit/images/green.gif
===================================================================
(Binary files differ)
Property changes on: trunk/theme/src/bin/test-portal-ajax-war/jsunit/images/green.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/theme/src/bin/test-portal-ajax-war/jsunit/images/logo_jsunit.gif
===================================================================
(Binary files differ)
Property changes on: trunk/theme/src/bin/test-portal-ajax-war/jsunit/images/logo_jsunit.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/theme/src/bin/test-portal-ajax-war/jsunit/images/red.gif
===================================================================
(Binary files differ)
Property changes on: trunk/theme/src/bin/test-portal-ajax-war/jsunit/images/red.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/theme/src/bin/test-portal-ajax-war/jsunit/testRunner.html
===================================================================
--- trunk/theme/src/bin/test-portal-ajax-war/jsunit/testRunner.html 2006-09-28 01:23:53 UTC (rev 5277)
+++ trunk/theme/src/bin/test-portal-ajax-war/jsunit/testRunner.html 2006-09-28 01:31:15 UTC (rev 5278)
@@ -0,0 +1,195 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
+ "http://www.w3.org/TR/html4/frameset.dtd">
+<html>
+
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>JsUnit</title>
+ <script language="JavaScript" type="text/javascript" src="app/xbDebug.js"></script>
+ <script language="JavaScript" type="text/javascript" src="app/jsUnitCore.js"></script>
+ <script language="JavaScript" type="text/javascript">
+ var DEFAULT_TEST_FRAME_HEIGHT=250;
+
+ // safe, strict access to jsUnitParmHash
+ function jsUnitGetParm(name)
+ {
+ if (typeof(top.jsUnitParmHash[name]) != 'undefined')
+ {
+ return top.jsUnitParmHash[name];
+ }
+ return null;
+ }
+
+ function jsUnitParseParms(string)
+ {
+ var i;
+ var searchString = unescape(string);
+ var jsUnitParmHash = new Object();
+
+ if (!searchString)
+ {
+ return jsUnitParmHash;
+ }
+
+ i = searchString.indexOf('?');
+ if (i != -1)
+ {
+ searchString = searchString.substring(i+1);
+ }
+
+ var parmList = searchString.split('&');
+ var a;
+ for (i = 0; i < parmList.length; i++)
+ {
+ a = parmList[i].split('=');
+ a[0] = a[0].toLowerCase();
+ if (a.length > 1)
+ {
+ jsUnitParmHash[a[0]] = a[1];
+ }
+ else
+ {
+ jsUnitParmHash[a[0]] = true;
+ }
+ }
+ return jsUnitParmHash;
+ }
+
+ function jsUnitConstructTestParms()
+ {
+ var p;
+ var parms = '';
+
+ for (p in jsUnitParmHash)
+ {
+ var value = jsUnitParmHash[p];
+
+ if (!value ||
+ p == 'testpage' ||
+ p == 'autorun' ||
+ p == 'submitresults' ||
+ p == 'showtestframe' ||
+ p == 'resultid')
+ {
+ continue;
+ }
+
+ if (parms)
+ {
+ parms += '&';
+ }
+
+ parms += p;
+
+ if (typeof(value) != 'boolean')
+ {
+ parms += '=' + value;
+ }
+ }
+ return escape(parms);
+ }
+
+ var jsUnitParmHash = jsUnitParseParms(document.location.search);
+
+ // set to true to turn debugging code on, false to turn it off.
+ xbDEBUG.on = jsUnitGetParm('debug') ? true : false;
+</script>
+
+<script language="JavaScript" type="text/javascript" src="app/jsUnitTestManager.js"></script>
+<script language="JavaScript" type="text/javascript" src="app/jsUnitTracer.js"></script>
+<script language="JavaScript" type="text/javascript" src="app/jsUnitTestSuite.js"></script>
+<script language="JavaScript" type="text/javascript">
+
+ var testManager;
+ var utility;
+ var tracer;
+
+
+ var JSUNIT_UNDEFINED_VALUE;
+
+ if (!Array.prototype.push)
+ {
+ Array.prototype.push = function (anObject)
+ {
+ this[this.length] = anObject;
+ }
+ }
+
+ if (!Array.prototype.pop)
+ {
+ Array.prototype.pop = function ()
+ {
+ if (this.length > 0)
+ {
+ delete this[this.length - 1];
+ this.length--;
+ }
+ }
+ }
+
+ function shouldKickOffTestsAutomatically() {
+ return jsUnitGetParm('autorun')=="true";
+ }
+
+ function shouldShowTestFrame() {
+ return jsUnitGetParm('showtestframe');
+ }
+
+ function shouldSubmitResults() {
+ return jsUnitGetParm('submitresults');
+ }
+
+ function getResultId() {
+ if (jsUnitGetParm('resultid'))
+ return jsUnitGetParm('resultid');
+ return "";
+ }
+
+ function submitResults() {
+ window.mainFrame.mainData.document.testRunnerForm.runButton.disabled=true;
+ window.mainFrame.mainResults.populateHeaderFields(getResultId(), navigator.userAgent, JSUNIT_VERSION, testManager.resolveUserEnteredTestFileName());
+ window.mainFrame.mainResults.submitResults();
+ }
+
+ function wasResultUrlSpecified() {
+ return shouldSubmitResults() && jsUnitGetParm('submitresults')!='true';
+ }
+
+ function getSpecifiedResultUrl() {
+ return jsUnitGetParm('submitresults');
+ }
+
+ function init()
+ {
+ if (shouldShowTestFrame() && window.testRunnerFrameset) {
+ var testFrameHeight;
+ if (jsUnitGetParm('showtestframe')=="true")
+ testFrameHeight=DEFAULT_TEST_FRAME_HEIGHT;
+ else
+ testFrameHeight=jsUnitGetParm('showtestframe');
+ window.testRunnerFrameset.rows="*,0," + testFrameHeight;
+ }
+ testManager = new jsUnitTestManager();
+ tracer = new jsUnitTracer();
+ if (shouldKickOffTestsAutomatically()) {
+ window.mainFrame.mainData.kickOffTests();
+ }
+ }
+
+</script>
+ </head>
+
+ <frameset id="testRunnerFrameset" rows="*,0,0" onload="init()">
+
+ <frame frameborder="0" name="mainFrame" src="./app/main-frame.html">
+ <frame frameborder="0" name="documentLoader" src="./app/main-loader.html">
+ <frame frameborder="0" name="testContainer" src="./app/testContainer.html">
+
+ <noframes>
+ <body>
+ <p>Sorry, JsUnit requires support for frames.</p>
+ </body>
+ </noframes>
+ </frameset>
+
+</html>
\ No newline at end of file
Added: trunk/theme/src/bin/test-portal-ajax-war/testDragandDrop.html
===================================================================
--- trunk/theme/src/bin/test-portal-ajax-war/testDragandDrop.html 2006-09-28 01:23:53 UTC (rev 5277)
+++ trunk/theme/src/bin/test-portal-ajax-war/testDragandDrop.html 2006-09-28 01:31:15 UTC (rev 5278)
@@ -0,0 +1,123 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <title>JBoss Portal Drag and Drop JS Tests</title>
+ <meta http-equiv="Content-Type" content="text/html;"/>
+
+ <!-- Script.aculo.us libraries -->
+ <script type='text/javascript' src='js/prototype.js'></script>
+ <script type='text/javascript' src='js/scriptaculous.js'></script>
+ <script type='text/javascript' src='js/dragdrop.js'></script>
+
+ <!-- JSUnit library -->
+ <script language="JavaScript" type="text/javascript" src="jsunit/app/jsUnitCore.js"></script>
+
+<script language="JavaScript" type="text/javascript">
+ function setUp() {
+ inform("setup");
+ Sortable.create("regionA",{dropOnEmpty:true,tag:'div',containment:["regionA","regionB"],constraint:false, ghosting: false});
+ Sortable.create("regionB",{dropOnEmpty:true,tag:'div',containment:["regionA","regionB"],constraint:false, ghosting: false});
+ }
+ function tearDown() {
+ inform("teardown");
+ Sortable.destroy("regionA");
+ Sortable.destroy("regionB");
+ }
+ function testAJAXCall()
+ {
+ inform("testAJAXCall");
+ windowID='WindowA_2';
+ fromPos='2';
+ fromRegion='regionA';
+ toPos='1';
+ toRegion='regionB';
+
+ var options = {
+ method: 'post',
+ postBody: 'action=windowmove&windowID=' + windowID + '&fromPos=' + fromPos + '&fromRegion=' + fromRegion + '&toPos=' + toPos + '&toRegion=' + toRegion,
+ onSuccess: function(t) {
+ },
+ onComplete: function(t) {
+ assertEquals("AJAX Servlet response is incorrect", 'windowmove', document.getElementById("resp"));
+ },
+ on404: function(t) {
+ fail("Unable to contact server for testing, 404");
+ },
+ onFailure: function(t) {
+ fail("Unable to complete transaction.");
+ },
+ onLoading: function(t) {
+ }
+ }
+
+ var url = "http://localhost:8080/test/testajax";
+ //var url = "http://localhost/dd/ajax.php";
+ new Ajax.Updater('resp',url, options);
+ }
+ function testSortableSwapRegions()
+ {
+ inform("testSortableSwapRegions");
+
+ // TODO: need to hook in to scriptaculous APIs to test region-to-region window placement.
+ }
+ function testSortableSequence() {
+ inform("testSortableSequence");
+
+ var a = Sortable.sequence("regionA");
+ var b = Sortable.sequence("regionB");
+
+ Sortable.setSequence('regionA', ['1','2','3']);
+ Sortable.setSequence('regionB', ['7','8','9']);
+
+ // Test regionA sequence
+ assertEquals("RegionA sequence incorrect",a[0], Sortable.sequence("regionA")[0]);
+ assertEquals("RegionA sequence incorrect",a[1], Sortable.sequence("regionA")[1]);
+ assertEquals("RegionA sequence incorrect",a[2], Sortable.sequence("regionA")[2]);
+
+ // Test regionB sequence
+ assertEquals("RegionB sequence incorrect",b[0], Sortable.sequence("regionB")[0]);
+ assertEquals("RegionB sequence incorrect",b[1], Sortable.sequence("regionB")[1]);
+ assertEquals("RegionB sequence incorrect",b[2], Sortable.sequence("regionB")[2]);
+
+ // Shuffle and test regionA sequence
+ Sortable.setSequence('regionA', ['3','2','1']);
+
+ assertEquals("RegionA sequence (post-shuffle) incorrect",a[2], Sortable.sequence("regionA")[0]);
+ assertEquals("RegionA sequence (post-shuffle) incorrect",a[1], Sortable.sequence("regionA")[1]);
+ assertEquals("RegionA sequence (post-shuffle) incorrect",a[0], Sortable.sequence("regionA")[2]);
+
+ // Shuffle and test regionB sequence
+ Sortable.setSequence('regionB', ['8','7','9']);
+ assertEquals("RegionB sequence (post-shuffle) incorrect",b[1], Sortable.sequence("regionB")[0]);
+ assertEquals("RegionB sequence (post-shuffle) incorrect",b[0], Sortable.sequence("regionB")[1]);
+ assertEquals("RegionB sequence (post-shuffle) incorrect",b[2], Sortable.sequence("regionB")[2]);
+ }
+</script>
+</head>
+
+<body id="body">
+
+<table width="100%">
+ <tr>
+ <td>
+ <div id="regionA">
+ <div id="WindowA_1">1</div>
+ <div id="WindowA_2">2</div>
+ <div id="WindowA_3">3</div>
+ </div>
+ </td>
+ <td>
+ <div id="regionB">
+ <div id="WindowB_7">7</div>
+ <div id="WindowB_8">8</div>
+ <div id="WindowB_9">9</div>
+ </div>
+ </tr>
+</table>
+<!-- <a href="#" onClick='testAJAXCall();'>AJAX CALL</a> -->
+<br/><br/>
+<div id="resp"></div>
+
+</body>
+</html>
More information about the jboss-svn-commits
mailing list