├── README.md ├── lib ├── jsunit │ ├── bin │ │ ├── unix │ │ │ ├── stop-firefox.sh │ │ │ └── start-firefox.sh │ │ └── mac │ │ │ ├── stop-safari.sh │ │ │ ├── stop-firefox.sh │ │ │ ├── readme.txt │ │ │ ├── start-safari.sh │ │ │ └── start-firefox.sh │ ├── images │ │ ├── red.gif │ │ ├── green.gif │ │ ├── logo_jsunit.gif │ │ └── powerby-transparent.gif │ ├── app │ │ ├── emptyPage.html │ │ ├── main-counts-errors.html │ │ ├── main-counts-runs.html │ │ ├── main-counts-failures.html │ │ ├── main-status.html │ │ ├── testContainer.html │ │ ├── css │ │ │ ├── readme │ │ │ └── jsUnitStyle.css │ │ ├── main-counts.html │ │ ├── main-frame.html │ │ ├── main-progress.html │ │ ├── jsUnitTestSuite.js │ │ ├── main-errors.html │ │ ├── main-loader.html │ │ ├── jsUnitVersionCheck.js │ │ ├── main-results.html │ │ ├── testContainerController.html │ │ ├── jsUnitMockTimeout.js │ │ ├── jsUnitTracer.js │ │ ├── main-data.html │ │ ├── xbDebug.js │ │ └── jsUnitCore.js │ ├── tests │ │ ├── data │ │ │ ├── staff.dtd │ │ │ ├── staff.css │ │ │ ├── staff.xml │ │ │ └── data.html │ │ ├── jsUnitOnLoadTests.html │ │ ├── jsUnitTestSetUpPagesSuite.html │ │ ├── jsUnitTestSetUpPages.html │ │ ├── jsUnitSetUpTearDownTests.html │ │ ├── jsUnitTestLoadData.html │ │ ├── jsUnitRestoredHTMLDivTests.html │ │ ├── jsUnitTestSuite.html │ │ ├── jsUnitTestLoadStaff.html │ │ ├── jsUnitFrameworkUtilityTests.html │ │ ├── jsUnitUtilityTests.html │ │ ├── jsUnitVersionCheckTests.html │ │ ├── jsUnitMockTimeoutTest.html │ │ └── jsUnitAssertionTests.html │ ├── readme.txt │ ├── licenses │ │ ├── mpl-tri-license-c.txt │ │ ├── mpl-tri-license-html.txt │ │ ├── JDOM_license.txt │ │ ├── index.html │ │ ├── Jetty_license.html │ │ └── gpl-2.txt │ ├── css │ │ └── jsUnitStyle.css │ ├── jsunit.properties.sample │ ├── changelog.txt │ ├── testRunner.html │ └── index.jsp ├── string.js ├── dom.js └── DomCreate.js ├── creators ├── hreview.js ├── xfn-ru.html └── hcard.html └── tests └── hreview.html /README.md: -------------------------------------------------------------------------------- 1 | generators 2 | ========== -------------------------------------------------------------------------------- /lib/jsunit/bin/unix/stop-firefox.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | killall -9 -w firefox-bin 3 | -------------------------------------------------------------------------------- /lib/jsunit/bin/unix/start-firefox.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | killall -9 -w firefox-bin 3 | firefox $1 & 4 | -------------------------------------------------------------------------------- /lib/jsunit/images/red.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microformats/generators/master/lib/jsunit/images/red.gif -------------------------------------------------------------------------------- /lib/jsunit/images/green.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microformats/generators/master/lib/jsunit/images/green.gif -------------------------------------------------------------------------------- /lib/jsunit/images/logo_jsunit.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microformats/generators/master/lib/jsunit/images/logo_jsunit.gif -------------------------------------------------------------------------------- /lib/jsunit/images/powerby-transparent.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microformats/generators/master/lib/jsunit/images/powerby-transparent.gif -------------------------------------------------------------------------------- /lib/jsunit/bin/mac/stop-safari.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Stops Safari. Use this instead of calling the AppleScripts directly. 4 | 5 | osascript bin/mac/stop-safari.scpt 6 | 7 | -------------------------------------------------------------------------------- /lib/jsunit/bin/mac/stop-firefox.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Stops Firefox. Use this instead of calling the AppleScripts directly. 4 | 5 | osascript bin/mac/stop-firefox.scpt 6 | 7 | -------------------------------------------------------------------------------- /lib/jsunit/bin/mac/readme.txt: -------------------------------------------------------------------------------- 1 | This directory contains shell scripts (*.sh) and AppleScripts (*.scpt) to start and stop browsers. 2 | 3 | The shell scripts invoke the AppleScripts, so use the shell scripts. -------------------------------------------------------------------------------- /lib/jsunit/bin/mac/start-safari.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Starts Safari. Use this instead of calling the AppleScripts directly. 4 | 5 | osascript bin/mac/stop-safari.scpt 6 | osascript bin/mac/start-safari.scpt $1 7 | 8 | -------------------------------------------------------------------------------- /lib/jsunit/bin/mac/start-firefox.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Starts Firefox. Use this instead of calling the AppleScripts directly. 4 | 5 | osascript bin/mac/stop-firefox.scpt 6 | osascript bin/mac/start-firefox.scpt $1 7 | 8 | -------------------------------------------------------------------------------- /lib/jsunit/app/emptyPage.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | emptyPage 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /lib/string.js: -------------------------------------------------------------------------------- 1 | // Removes leading whitespaces 2 | function ltrim(value) { 3 | var re = /\s*((\S+\s*)*)/; 4 | return value.replace(re, "$1"); 5 | } 6 | 7 | // Removes ending whitespaces 8 | function rtrim(value) { 9 | var re = /((\s*\S+)*)\s*/; 10 | return value.replace(re, "$1"); 11 | } 12 | 13 | // Removes leading and ending whitespaces 14 | function trim(value) { 15 | return ltrim(rtrim(value)); 16 | } 17 | -------------------------------------------------------------------------------- /lib/jsunit/app/main-counts-errors.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
Errors: 0
11 | 12 | -------------------------------------------------------------------------------- /lib/jsunit/app/main-counts-runs.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
Runs: 0
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /lib/jsunit/app/main-counts-failures.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
Failures: 0
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /lib/jsunit/app/main-status.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JsUnit main-status.html 6 | 7 | 8 | 9 | 10 |
Status: (Idle)
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /lib/jsunit/tests/data/staff.dtd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 12 | 15 | 17 | 18 | -------------------------------------------------------------------------------- /lib/jsunit/app/testContainer.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JsUnit Test Container 6 | 7 | 8 | 9 | 10 | 11 | <body> 12 | <p>Sorry, JsUnit requires frames.</p> 13 | </body> 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /lib/jsunit/tests/data/staff.css: -------------------------------------------------------------------------------- 1 | staff { 2 | display: table; 3 | color: black; 4 | background-color: white; 5 | border: solid 1px black; 6 | } 7 | 8 | employee { 9 | display: table-row; 10 | border: solid 1px black; 11 | padding: 1px; 12 | } 13 | 14 | employeeId, name, position, salary, gender, address { 15 | display: table-cell; 16 | border: solid 1px black; 17 | padding: 1px; 18 | } 19 | 20 | address[domestic="Yes"] { 21 | background-color: silver; 22 | } 23 | 24 | address[street="Yes"] { 25 | color: green; 26 | } 27 | 28 | address[street="No"] { 29 | color: red; 30 | } 31 | -------------------------------------------------------------------------------- /lib/jsunit/app/css/readme: -------------------------------------------------------------------------------- 1 | this file is required due to differences in behavior between Mozilla/Opera 2 | and Internet Explorer. 3 | 4 | main-data.html calls kickOffTests() which calls top.testManager.start() 5 | in the top most frame. top.testManager.start() initializes the output 6 | frames using document.write and HTML containing a relative to the 7 | jsUnitStyle.css file. In MSIE, the base href used to find the CSS file is 8 | that of the top level frame however in Mozilla/Opera the base href is 9 | that of main-data.html. This leads to not-found for the jsUnitStyle.css 10 | in Mozilla/Opera. Creating app/css/jsUnitStyle.css works around this problem. 11 | -------------------------------------------------------------------------------- /creators/hreview.js: -------------------------------------------------------------------------------- 1 | function pad(input) { 2 | if (input && input.toString().length < 2) return '0' + input.toString(); 3 | else if (!input) return null; 4 | else return input.toString(); 5 | } 6 | 7 | function format_dt(year, month, day, hour, minute, timezone) { 8 | var dt = $.map([year, month, day], function(i){return pad(i)}).join('-') 9 | if (hour) { 10 | dt = dt + 'T' + $.map([hour, minute], function(i){return pad(i || 0)}).join(':'); 11 | } 12 | if (timezone) dt = dt + timezone; 13 | return dt; 14 | } 15 | 16 | function rating_stars(rating){ 17 | var stars = []; 18 | for(i = 0; i < 5; i++){ 19 | if(i < rating) { 20 | stars += String.fromCharCode(parseInt('2605', 16)); 21 | } else { 22 | stars += String.fromCharCode(parseInt('2606', 16)); 23 | } 24 | } 25 | return stars 26 | } -------------------------------------------------------------------------------- /lib/jsunit/app/main-counts.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | <body> 15 | <p>jsUnit uses frames in order to remove dependencies upon a browser's implementation of document.getElementById 16 | and HTMLElement.innerHTML.</p> 17 | </body> 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /lib/jsunit/app/main-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | jsUnit Main Frame 5 | 6 | > 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | <body> 15 | <p>Sorry, JsUnit requires frames.</p> 16 | </body> 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /lib/jsunit/readme.txt: -------------------------------------------------------------------------------- 1 | JsUnit 2 | Copyright (C) 2001-6 Edward Hieatt, edward@jsunit.net 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | 18 | Please see http://www.jsunit.net/ for JsUnit documentation and 19 | the "licenses" directory for license information. -------------------------------------------------------------------------------- /lib/jsunit/tests/jsUnitOnLoadTests.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | JsUnit OnLoad Tests 8 | 9 | 10 | 21 | 22 | 23 | 24 |

JsUnit OnLoad Tests

25 | 26 |

This page contains tests for the JsUnit Framework. To see them, take a look at the source.

27 | 28 | 29 | -------------------------------------------------------------------------------- /lib/jsunit/app/css/jsUnitStyle.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin-top: 0; 3 | margin-bottom: 0; 4 | font-family: Verdana, Arial, Helvetica, sans-serif; 5 | color: #000; 6 | font-size: 0.8em; 7 | background-color: #fff; 8 | } 9 | 10 | a:link, a:visited { 11 | color: #00F; 12 | } 13 | 14 | a:hover { 15 | color: #F00; 16 | } 17 | 18 | h1 { 19 | font-size: 1.2em; 20 | font-weight: bold; 21 | color: #039; 22 | font-family: Verdana, Arial, Helvetica, sans-serif; 23 | } 24 | 25 | h2 { 26 | font-weight: bold; 27 | color: #039; 28 | font-family: Verdana, Arial, Helvetica, sans-serif; 29 | } 30 | 31 | h3 { 32 | font-weight: bold; 33 | color: #039; 34 | text-decoration: underline; 35 | font-family: Verdana, Arial, Helvetica, sans-serif; 36 | } 37 | 38 | h4 { 39 | font-weight: bold; 40 | color: #039; 41 | font-family: Verdana, Arial, Helvetica, sans-serif; 42 | } 43 | 44 | .jsUnitTestResultSuccess { 45 | color: #000; 46 | } 47 | 48 | .jsUnitTestResultNotSuccess { 49 | color: #F00; 50 | } -------------------------------------------------------------------------------- /lib/jsunit/app/main-progress.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JsUnit main-progress.html 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 22 | 23 |
Progress: 15 | 16 | 17 | 19 | 20 |
progress image
21 |
24 | 25 | 26 | -------------------------------------------------------------------------------- /lib/jsunit/app/jsUnitTestSuite.js: -------------------------------------------------------------------------------- 1 | function jsUnitTestSuite() { 2 | this.isjsUnitTestSuite = true; 3 | this.testPages = Array(); 4 | this.pageIndex = 0; 5 | } 6 | 7 | jsUnitTestSuite.prototype.addTestPage = function (pageName) 8 | { 9 | this.testPages[this.testPages.length] = pageName; 10 | } 11 | 12 | jsUnitTestSuite.prototype.addTestSuite = function (suite) 13 | { 14 | for (var i = 0; i < suite.testPages.length; i++) 15 | this.addTestPage(suite.testPages[i]); 16 | } 17 | 18 | jsUnitTestSuite.prototype.containsTestPages = function () 19 | { 20 | return this.testPages.length > 0; 21 | } 22 | 23 | jsUnitTestSuite.prototype.nextPage = function () 24 | { 25 | return this.testPages[this.pageIndex++]; 26 | } 27 | 28 | jsUnitTestSuite.prototype.hasMorePages = function () 29 | { 30 | return this.pageIndex < this.testPages.length; 31 | } 32 | 33 | jsUnitTestSuite.prototype.clone = function () 34 | { 35 | var clone = new jsUnitTestSuite(); 36 | clone.testPages = this.testPages; 37 | return clone; 38 | } 39 | 40 | if (xbDEBUG.on) 41 | { 42 | xbDebugTraceObject('window', 'jsUnitTestSuite'); 43 | } 44 | 45 | -------------------------------------------------------------------------------- /lib/jsunit/tests/jsUnitTestSetUpPagesSuite.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | JsUnit Test Suite 7 | 8 | 9 | 23 | 24 | 25 | 26 |

JsUnit Test Suite

27 | 28 |

This page contains a suite of tests for testing JsUnit's setUpPages functionality.

29 | 30 | 31 | -------------------------------------------------------------------------------- /lib/jsunit/tests/jsUnitTestSetUpPages.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Test loading a local HTML Document 7 | 8 | 9 | 29 | 30 | 31 | 32 |

JsUnit Asynchronous setUpPages

33 | 34 |

This page tests asynchronoush pre tests. To see them, take a look at the source.

35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /lib/jsunit/app/main-errors.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JsUnit main-errors.html 6 | 7 | 8 | 9 | 10 |
11 | 12 |
13 |

Errors and failures: 

14 | 17 |
18 | 19 |     20 | 21 |
22 | 23 | 24 | -------------------------------------------------------------------------------- /lib/jsunit/tests/jsUnitSetUpTearDownTests.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | JsUnit Framework tests 7 | 8 | 9 | 41 | 42 | 43 | 44 |

JsUnit Framework tests

45 | 46 |

This page contains tests for the JsUnit setUp and tearDown framework. To see them, take a look at the source.

47 | 48 | 49 | -------------------------------------------------------------------------------- /lib/jsunit/app/main-loader.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | jsUnit External Data Document loader 6 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /lib/jsunit/tests/jsUnitTestLoadData.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Test loading a local HTML Document 6 | 7 | 8 | 32 | 33 | 34 | 35 |

JsUnit Asynchronous Load Tests

36 | 37 |

This page tests loading data documents asynchronously. To see them, take a look at the source.

38 | 39 | 40 | -------------------------------------------------------------------------------- /lib/jsunit/tests/jsUnitRestoredHTMLDivTests.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | JsUnit Framework tests 7 | 8 | 9 | 32 | 33 | 34 | 35 |

JsUnit Framework tests

36 | 37 |

This page contains tests for the JsUnit setUp and tearDown framework. To see them, take a look at the source.

38 | 39 |
foo
40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /lib/jsunit/tests/jsUnitTestSuite.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | JsUnit Test Suite 7 | 8 | 9 | 36 | 37 | 38 | 39 |

JsUnit Test Suite

40 | 41 |

This page contains a suite of tests for testing JsUnit.

42 | 43 | 44 | -------------------------------------------------------------------------------- /lib/jsunit/licenses/mpl-tri-license-c.txt: -------------------------------------------------------------------------------- 1 | /* ***** BEGIN LICENSE BLOCK ***** 2 | * Version: MPL 1.1/GPL 2.0/LGPL 2.1 3 | * 4 | * The contents of this file are subject to the Mozilla Public License Version 5 | * 1.1 (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * http://www.mozilla.org/MPL/ 8 | * 9 | * Software distributed under the License is distributed on an "AS IS" basis, 10 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 11 | * for the specific language governing rights and limitations under the 12 | * License. 13 | * 14 | * The Original Code is __________________________________________. 15 | * 16 | * The Initial Developer of the Original Code is 17 | * ____________________________________________. 18 | * Portions created by the Initial Developer are Copyright (C) 2___ 19 | * the Initial Developer. All Rights Reserved. 20 | * 21 | * Contributor(s): 22 | * 23 | * Alternatively, the contents of this file may be used under the terms of 24 | * either the GNU General Public License Version 2 or later (the "GPL"), or 25 | * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), 26 | * in which case the provisions of the GPL or the LGPL are applicable instead 27 | * of those above. If you wish to allow use of your version of this file only 28 | * under the terms of either the GPL or the LGPL, and not to allow others to 29 | * use your version of this file under the terms of the MPL, indicate your 30 | * decision by deleting the provisions above and replace them with the notice 31 | * and other provisions required by the GPL or the LGPL. If you do not delete 32 | * the provisions above, a recipient may use your version of this file under 33 | * the terms of any one of the MPL, the GPL or the LGPL. 34 | * 35 | * ***** END LICENSE BLOCK ***** */ 36 | -------------------------------------------------------------------------------- /lib/jsunit/css/jsUnitStyle.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin-top: 0; 3 | margin-bottom: 0; 4 | font-family: Verdana, Arial, Helvetica, sans-serif; 5 | color: #000; 6 | font-size: 0.8em; 7 | background-color: #fff; 8 | } 9 | 10 | a:link, a:visited { 11 | color: #00F; 12 | } 13 | 14 | a:hover { 15 | color: #F00; 16 | } 17 | 18 | h1 { 19 | font-size: 1.2em; 20 | font-weight: bold; 21 | color: #039; 22 | font-family: Verdana, Arial, Helvetica, sans-serif; 23 | } 24 | 25 | h2 { 26 | font-weight: bold; 27 | color: #039; 28 | font-family: Verdana, Arial, Helvetica, sans-serif; 29 | } 30 | 31 | h3 { 32 | font-weight: bold; 33 | color: #039; 34 | text-decoration: underline; 35 | font-family: Verdana, Arial, Helvetica, sans-serif; 36 | } 37 | 38 | h4 { 39 | font-weight: bold; 40 | color: #039; 41 | font-family: Verdana, Arial, Helvetica, sans-serif; 42 | } 43 | 44 | .jsUnitTestResultSuccess { 45 | color: #000; 46 | } 47 | 48 | .jsUnitTestResultNotSuccess { 49 | color: #F00; 50 | } 51 | 52 | .unselectedTab { 53 | font-family: Verdana, Arial, Helvetica, sans-serif; 54 | height: 26px; 55 | background: #FFFFFF; 56 | border-style: solid; 57 | border-bottom-width: 1px; 58 | border-top-width: 1px; 59 | border-left-width: 1px; 60 | border-right-width: 1px; 61 | } 62 | 63 | .selectedTab { 64 | font-family: Verdana, Arial, Helvetica, sans-serif; 65 | height: 26px; 66 | background: #DDDDDD; 67 | font-weight: bold; 68 | border-style: solid; 69 | border-bottom-width: 0px; 70 | border-top-width: 1px; 71 | border-left-width: 1px; 72 | border-right-width: 1px; 73 | } 74 | 75 | .tabHeaderSeparator { 76 | height: 26px; 77 | background: #FFFFFF; 78 | border-style: solid; 79 | border-bottom-width: 1px; 80 | border-top-width: 0px; 81 | border-left-width: 0px; 82 | border-right-width: 0px; 83 | } -------------------------------------------------------------------------------- /lib/jsunit/licenses/mpl-tri-license-html.txt: -------------------------------------------------------------------------------- 1 | 36 | -------------------------------------------------------------------------------- /lib/jsunit/app/jsUnitVersionCheck.js: -------------------------------------------------------------------------------- 1 | var versionRequest; 2 | 3 | function isOutOfDate(newVersionNumber) { 4 | return JSUNIT_VERSION < newVersionNumber; 5 | } 6 | 7 | function sendRequestForLatestVersion(url) { 8 | versionRequest = createXmlHttpRequest(); 9 | if (versionRequest) { 10 | versionRequest.onreadystatechange = requestStateChanged; 11 | versionRequest.open("GET", url, true); 12 | versionRequest.send(null); 13 | } 14 | } 15 | 16 | function createXmlHttpRequest() { 17 | if (window.XMLHttpRequest) 18 | return new XMLHttpRequest(); 19 | else if (window.ActiveXObject) 20 | return new ActiveXObject("Microsoft.XMLHTTP"); 21 | } 22 | 23 | function requestStateChanged() { 24 | if (versionRequest && versionRequest.readyState == 4) { 25 | if (versionRequest.status == 200) { 26 | var latestVersion = versionRequest.responseText; 27 | if (isOutOfDate(latestVersion)) 28 | versionNotLatest(latestVersion); 29 | else 30 | versionLatest(); 31 | } else 32 | versionCheckError(); 33 | } 34 | } 35 | 36 | function checkForLatestVersion(url) { 37 | setLatestVersionDivHTML("Checking for newer version..."); 38 | try { 39 | sendRequestForLatestVersion(url); 40 | } catch (e) { 41 | setLatestVersionDivHTML("An error occurred while checking for a newer version: " + e.message); 42 | } 43 | } 44 | 45 | function versionNotLatest(latestVersion) { 46 | setLatestVersionDivHTML('A newer version of JsUnit, version ' + latestVersion + ', is available.'); 47 | } 48 | 49 | function versionLatest() { 50 | setLatestVersionDivHTML("You are running the latest version of JsUnit."); 51 | } 52 | 53 | function setLatestVersionDivHTML(string) { 54 | document.getElementById("versionCheckDiv").innerHTML = string; 55 | } 56 | 57 | function versionCheckError() { 58 | setLatestVersionDivHTML("An error occurred while checking for a newer version."); 59 | } -------------------------------------------------------------------------------- /lib/jsunit/tests/jsUnitTestLoadStaff.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Test loading a local XML Document 7 | 8 | 9 | 49 | 50 | 51 | 52 |

JsUnit Load XML

53 | 54 |

This page tests loading XML. To see them, take a look at the source.

55 | 56 | 57 | -------------------------------------------------------------------------------- /lib/jsunit/tests/data/staff.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | Element data"> 7 | 8 | 9 | 10 | 11 | ]> 12 | 13 | 14 | 15 | EMP0001 16 | Margaret Martin 17 | Accountant 18 | 56,000 19 | Female 20 |
1230 North Ave. Dallas, Texas 98551
21 |
22 | 23 | EMP0002 24 | Martha Raynolds 25 | 26 | Secretary 27 | 35,000 28 | Female 29 |
&ent2; Dallas, &ent3; 30 | 98554
31 |
32 | 33 | EMP0003 34 | Roger 35 | Jones 36 | Department Manager 37 | 100,000 38 | &ent4; 39 | 40 |
PO Box 27 Irving, texas 98553
41 |
42 | 43 | EMP0004 44 | Jeny Oconnor 45 | Personnel Director 46 | 95,000 47 | Female 48 |
27 South Road. Dallas, Texas 98556
49 |
50 | 51 | EMP0005 52 | Robert Myers 53 | Computer Specialist 54 | 90,000 55 | male 56 |
1821 Nordic. Road, Irving Texas 98558
57 |
58 |
59 | -------------------------------------------------------------------------------- /tests/hreview.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /lib/jsunit/app/main-results.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JsUnit main-results.html 6 | 7 | 8 | 9 | 10 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /lib/jsunit/tests/data/data.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | test 7 | 8 | 9 | 10 |

foo

11 | 12 |

foo

13 | 14 |

foo

15 | 16 |

foo

17 | 18 |

foo

19 | 20 |

foo

21 | 22 |

foo

23 | 24 |

foo

25 | 26 |

foo

27 | 28 |

foo

29 | 30 |

foo

31 | 32 |

foo

33 | 34 |

foo

35 | 36 |

foo

37 | 38 |

foo

39 | 40 |

foo

41 | 42 |

foo

43 | 44 |

foo

45 | 46 |

foo

47 | 48 |

foo

49 | 50 |

foo

51 | 52 |

foo

53 | 54 |

foo

55 | 56 |

foo

57 | 58 |

foo

59 | 60 |

foo

61 | 62 |

foo

63 | 64 |

foo

65 | 66 |

foo

67 | 68 |

foo

69 | 70 |

foo

71 | 72 |

foo

73 | 74 |

foo

75 | 76 |

foo

77 | 78 |

foo

79 | 80 |

foo

81 | 82 |

foo

83 | 84 |

foo

85 | 86 |

foo

87 | 88 |

foo

89 | 90 |

foo

91 | 92 |

foo

93 | 94 |

foo

95 | 96 |

foo

97 | 98 |

foo

99 | 100 |

foo

101 | 102 |

foo

103 | 104 |

foo

105 | 106 |

foo

107 | 108 |

foo

109 | 110 |

foo

111 | 112 |

foo

113 | 114 |

foo

115 | 116 |

foo

117 | 118 |

foo

119 | 120 |

foo

121 | 122 |

foo

123 | 124 |

foo

125 | 126 |

foo

127 | 128 |

foo

129 | 130 |

foo

131 | 132 |

foo

133 | 134 |

foo

135 | 136 |

foo

137 | 138 |

foo

139 | 140 |

foo

141 | 142 |

foo

143 | 144 |

foo

145 | 146 |

foo

147 | 148 |

foo

149 | 150 |

foo

151 | 152 |

foo

153 | 154 |

foo

155 | 156 |

foo

157 | 158 |

foo

159 | 160 |

foo

161 | 162 |

foo

163 | 164 |

foo

165 | 166 |

foo

167 | 168 |

foo

169 | 170 |

foo

171 | 172 |

foo

173 | 174 |

foo

175 | 176 |

foo

177 | 178 |

foo

179 | 180 |

foo

181 | 182 |

foo

183 | 184 |

foo

185 | 186 |

foo

187 | 188 |

foo

189 | 190 |

foo

191 | 192 |

foo

193 | 194 |

foo

195 | 196 |

foo

197 | 198 |

foo

199 | 200 |

foo

201 | 202 |

foo

203 | 204 |

foo

205 | 206 |

foo

207 | 208 |

foo

209 | 210 |

foo

211 | 212 |

foo

213 | 214 |

foo

215 | 216 |

foo

217 | 218 | 219 | -------------------------------------------------------------------------------- /lib/jsunit/licenses/JDOM_license.txt: -------------------------------------------------------------------------------- 1 | /*-- 2 | 3 | $Id: JDOM_license.txt 81 2003-07-24 04:44:54Z edwardhieatt $ 4 | 5 | Copyright (C) 2000-2003 Jason Hunter & Brett McLaughlin. 6 | All rights reserved. 7 | 8 | Redistribution and use in source and binary forms, with or without 9 | modification, are permitted provided that the following conditions 10 | are met: 11 | 12 | 1. Redistributions of source code must retain the above copyright 13 | notice, this list of conditions, and the following disclaimer. 14 | 15 | 2. Redistributions in binary form must reproduce the above copyright 16 | notice, this list of conditions, and the disclaimer that follows 17 | these conditions in the documentation and/or other materials 18 | provided with the distribution. 19 | 20 | 3. The name "JDOM" must not be used to endorse or promote products 21 | derived from this software without prior written permission. For 22 | written permission, please contact . 23 | 24 | 4. Products derived from this software may not be called "JDOM", nor 25 | may "JDOM" appear in their name, without prior written permission 26 | from the JDOM Project Management . 27 | 28 | In addition, we request (but do not require) that you include in the 29 | end-user documentation provided with the redistribution and/or in the 30 | software itself an acknowledgement equivalent to the following: 31 | "This product includes software developed by the 32 | JDOM Project (http://www.jdom.org/)." 33 | Alternatively, the acknowledgment may be graphical using the logos 34 | available at http://www.jdom.org/images/logos. 35 | 36 | THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 37 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 38 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 39 | DISCLAIMED. IN NO EVENT SHALL THE JDOM AUTHORS OR THE PROJECT 40 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 41 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 42 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 43 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 44 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 45 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 46 | OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 47 | SUCH DAMAGE. 48 | 49 | This software consists of voluntary contributions made by many 50 | individuals on behalf of the JDOM Project and was originally 51 | created by Jason Hunter and 52 | Brett McLaughlin . For more information on 53 | the JDOM Project, please see . 54 | 55 | */ 56 | 57 | -------------------------------------------------------------------------------- /lib/jsunit/app/testContainerController.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JsUnit Test Container Controller 6 | 72 | 73 | 74 | 75 | Test Container Controller 76 | 77 | -------------------------------------------------------------------------------- /lib/jsunit/app/jsUnitMockTimeout.js: -------------------------------------------------------------------------------- 1 | // Mock setTimeout, clearTimeout 2 | // Contributed by Pivotal Computer Systems, www.pivotalsf.com 3 | 4 | var Clock = { 5 | timeoutsMade: 0, 6 | scheduledFunctions: {}, 7 | nowMillis: 0, 8 | reset: function() { 9 | this.scheduledFunctions = {}; 10 | this.nowMillis = 0; 11 | this.timeoutsMade = 0; 12 | }, 13 | tick: function(millis) { 14 | var oldMillis = this.nowMillis; 15 | var newMillis = oldMillis + millis; 16 | this.runFunctionsWithinRange(oldMillis, newMillis); 17 | this.nowMillis = newMillis; 18 | }, 19 | runFunctionsWithinRange: function(oldMillis, nowMillis) { 20 | var scheduledFunc; 21 | var funcsToRun = []; 22 | for (var timeoutKey in this.scheduledFunctions) { 23 | scheduledFunc = this.scheduledFunctions[timeoutKey]; 24 | if (scheduledFunc != undefined && 25 | scheduledFunc.runAtMillis >= oldMillis && 26 | scheduledFunc.runAtMillis <= nowMillis) { 27 | funcsToRun.push(scheduledFunc); 28 | this.scheduledFunctions[timeoutKey] = undefined; 29 | } 30 | } 31 | 32 | if (funcsToRun.length > 0) { 33 | funcsToRun.sort(function(a, b) { 34 | return a.runAtMillis - b.runAtMillis; 35 | }); 36 | for (var i = 0; i < funcsToRun.length; ++i) { 37 | try { 38 | this.nowMillis = funcsToRun[i].runAtMillis; 39 | funcsToRun[i].funcToCall(); 40 | if (funcsToRun[i].recurring) { 41 | Clock.scheduleFunction(funcsToRun[i].timeoutKey, 42 | funcsToRun[i].funcToCall, 43 | funcsToRun[i].millis, 44 | true); 45 | } 46 | } catch(e) { 47 | } 48 | } 49 | this.runFunctionsWithinRange(oldMillis, nowMillis); 50 | } 51 | }, 52 | scheduleFunction: function(timeoutKey, funcToCall, millis, recurring) { 53 | Clock.scheduledFunctions[timeoutKey] = { 54 | runAtMillis: Clock.nowMillis + millis, 55 | funcToCall: funcToCall, 56 | recurring: recurring, 57 | timeoutKey: timeoutKey, 58 | millis: millis 59 | }; 60 | } 61 | }; 62 | 63 | function setTimeout(funcToCall, millis) { 64 | Clock.timeoutsMade = Clock.timeoutsMade + 1; 65 | Clock.scheduleFunction(Clock.timeoutsMade, funcToCall, millis, false); 66 | return Clock.timeoutsMade; 67 | } 68 | 69 | function setInterval(funcToCall, millis) { 70 | Clock.timeoutsMade = Clock.timeoutsMade + 1; 71 | Clock.scheduleFunction(Clock.timeoutsMade, funcToCall, millis, true); 72 | return Clock.timeoutsMade; 73 | } 74 | 75 | function clearTimeout(timeoutKey) { 76 | Clock.scheduledFunctions[timeoutKey] = undefined; 77 | } 78 | 79 | function clearInterval(timeoutKey) { 80 | Clock.scheduledFunctions[timeoutKey] = undefined; 81 | } 82 | -------------------------------------------------------------------------------- /lib/jsunit/jsunit.properties.sample: -------------------------------------------------------------------------------- 1 | 2 | 3 | #Using jsunit.properties is one way to specify the various properties used by the JsUnitServer. 4 | #It is deprecated in favor of using ant build files. See build.xml. 5 | #To use this file, rename it to "jsunit.properties". You need to provide values for the mandatory properties. 6 | #See the documentation at http://www.jsunit.net for more information. 7 | 8 | 9 | #closeBrowsersAfterTestRuns determines whether to attempt to close browsers after test runs. This is not a mandatory property. The default is true. For example: 'true' 10 | closeBrowsersAfterTestRuns= 11 | 12 | #description is a human-readable description of a standard or farm server. This is not a mandatory property. The default is blank. For example: 'This is our Mac - it's only running Safari right now' 13 | description= 14 | 15 | #ignoreUnresponsiveRemoteMachines is a property used only by the JsUnit Farm Server and the distributed_test target. Its value is whether to ignore a remove machine that does not respond. If true, test runs will be green even if one or more remove machines fail to respond; if false, an unresponsive remove machine results in a failure. This is not a mandatory property. Its default is false. For example: 'true' 16 | ignoreUnresponsiveRemoteMachines= 17 | 18 | #logsDirectory is the directory in which the JsUnitStandardServer stores the XML logs produced from tests run. It can be specified relative to the working directory. This is not a mandatory property. If not specified, the directory called 'logs' inside resourceBase is assumed. For example: 'c:\jsunit\java\logs' 19 | logsDirectory= 20 | 21 | #port is the port on which the JsUnitStandardServer runs. This is not a mandatory property. If not specified, 8080 is assumed. For exapmle: '8080' 22 | port= 23 | 24 | #remoteMachineURLs is a property used only by the JsUnit Farm Server and the distributed_test target. Its value is the list of URLs of remove machines to which a request to run tests will be sent. For example: 'http://machine1.company.com:8080,http://localhost:8080,http://192.168.1.200:9090' 25 | remoteMachineURLs= 26 | 27 | #resourceBase is the directory that the JsUnitStandardServer considers to be its document root. It can be specified relative to the working directory. This is not a mandatory property. If not specified, the working directory is assumed. For example: 'c:\jsunit' 28 | resourceBase= 29 | 30 | #timeoutSeconds is the number of seconds to wait before timing out a browser during a test run. This is not a mandatory property. If not specified, 60 is assumed. For example: '60' 31 | timeoutSeconds= 32 | 33 | #url is the URL (HTTP or file protocol) to open in the browser. For a JsUnit Server, this is a mandatory property for a test run if the server is not passed the 'url' parameter. For example: 'file:///c:/jsunit/testRunner.html?testPage=c:/jsunit/tests/jsUnitTestSuite.html' 34 | url= 35 | -------------------------------------------------------------------------------- /lib/dom.js: -------------------------------------------------------------------------------- 1 | function DIV(attrs){ 2 | return dom('div', attrs, arguments); 3 | } 4 | 5 | function BLOCKQUOTE(attrs, children){ 6 | return dom('blockquote', attrs, arguments); 7 | } 8 | 9 | function H2(attrs){ 10 | return dom('h2', attrs, arguments); 11 | } 12 | 13 | function ABBR(attrs){ 14 | return dom('abbr', attrs, arguments); 15 | } 16 | 17 | function TIME(attrs){ 18 | return dom('time', attrs, arguments); 19 | } 20 | 21 | function SPAN(attrs){ 22 | return dom('span', attrs, arguments); 23 | } 24 | 25 | function P(attrs){ 26 | return dom('p', attrs, arguments); 27 | } 28 | 29 | function A(attrs){ 30 | return dom('a', attrs, arguments); 31 | } 32 | 33 | function IMG(attrs){ 34 | return dom('img', attrs, arguments); 35 | } 36 | 37 | function isArray(obj) { 38 | if (obj.constructor.toString().indexOf("Array") == -1) 39 | return false; 40 | else 41 | return true; 42 | } 43 | 44 | function dom(name, attrs, args){ 45 | if (typeof(attrs) == 'undefined'){ 46 | attrs = {}; 47 | } 48 | if (args.length > 1){ 49 | attrs.childNodes = [] 50 | for(i = 1; i < args.length; i++) { 51 | if(isArray(args[i])){ // flatten arrays 52 | attrs.childNodes = $.merge(attrs.childNodes, args[i]) 53 | } else { 54 | attrs.childNodes.push(args[i]); 55 | } 56 | } 57 | } 58 | return DOM.Element.Create.createElement(name, attrs); 59 | } 60 | 61 | function appendChildNodes(){ 62 | nodes = []; 63 | for (i = 1; i < arguments.length; i++){ 64 | nodes.push(arguments[i]); 65 | } 66 | return DOM.Element.Create.updateElement(arguments[0], {childNodes: nodes}); 67 | } 68 | 69 | 70 | function prettyHTML(dom, indent_string, indent_step) { 71 | if (typeof(indent_step) == 'undefined' || indent_step === null) { 72 | indent_step = 2; 73 | } 74 | 75 | // if we're just starting out, no indent 76 | if (typeof(indent_string) == 'undefined' || indent_string === null){ 77 | indent_string = "\n"; 78 | } else { 79 | for(var i = 0; i < indent_step; i++) {indent_string += ' ';} 80 | } 81 | 82 | var output = ''; 83 | 84 | if (typeof(dom) == 'string') { 85 | output += indent_string + dom; 86 | } else if (dom.nodeType == 1) { 87 | //type 1 = element 88 | output += indent_string + '<' + dom.nodeName.toLowerCase(); 89 | var attributes = []; 90 | var domAttr = attributeArray(dom); 91 | for (var i = 0; i < domAttr.length; i++) { 92 | var a = domAttr[i]; 93 | output += " " + a.name + '="' + a.value + '"'; 94 | } 95 | if (dom.hasChildNodes()){ 96 | output += '>'; 97 | if(dom.childNodes.length == 1 && dom.childNodes[0].nodeType == 3) { 98 | output += dom.childNodes[0].nodeValue; 99 | output += ''; 100 | } else { 101 | var children = dom.childNodes; 102 | for (i = 0; i < children.length; i++) { 103 | output += prettyHTML(children[i], indent_string); 104 | } 105 | output += indent_string + ''; 106 | } 107 | 108 | } else { 109 | output += ' />'; 110 | } 111 | } else if (dom.nodeType == 3) { 112 | output += dom.nodeValue; 113 | } 114 | if(indent_string == "\n" && output[0] == "\n"){ 115 | output = output.substring(1, output.length); 116 | } 117 | 118 | return output; 119 | } -------------------------------------------------------------------------------- /lib/jsunit/changelog.txt: -------------------------------------------------------------------------------- 1 | TRACING 2 | - Tracing is now color coded by trace level 3 | - Traces are now prefixed with the Test Page and Test Function from which the trace is made 4 | 5 | ASSERTION FUNCTIONS 6 | - assertArrayEquals(array1, array2) introduced 7 | - assertObjectEquals(object1, object2) introduced 8 | - assertHTMLEquals function introduced 9 | - assertEvaluatesToTrue and assertEvaluatesToFalse introduced 10 | - assertHashEquals } 11 | - assertRoughlyEquals } Pivotal functions 12 | - assertContains } 13 | 14 | - changed expected/actual values display strings to use angle brackets, rather than square brackets 15 | 16 | - CLIENT-SIDE 17 | - HTML in result output is now correctly escaped 18 | - page load timeout changed to 120 seconds by default 19 | - setup page timeout change to 120 seconds by default 20 | - cache-buster for testpage retrieval & results submission 21 | - jsUnitRestoredHTMLDiv 22 | - turn off tracing, alerts, confirms when submitting 23 | - testPage parameter should be URL-encoded (only opera cares though) 24 | - Speed-up of Firefox/Mozilla (thanks to Chris Wesseling) 25 | - jsUnitMockTimeout.js (thanks to Pivotal, especially Nathan Wilmes) 26 | 27 | SERVER 28 | - start-browser scripts in bin 29 | - Migration of Java code to require Java 5.0 30 | - JSPs require a JDK 31 | - StandaloneTest and DistributedTest continue on after a failure in a particular browser or remote server respectively 32 | - StandaloneTest has a suite() method that makes the test run have multiple JUnit tests, one per browser 33 | - DistribuedTest has a suite() method that makes the test run have multiple JUnit tests, one per remote machine URL 34 | - Change to XML output format of test runs to include more information and be more hierarchical (machine->browser->test page->test case) 35 | - Logs are now prefixed with "JSTEST-" in order to match JUnit's "TEST-" 36 | - Logs now contain the browser ID (e.g. JSTEST-12345.5.xml means browser with ID 5); displayer servlet now takes an id and a browserId parameter 37 | - added support for launching the default system browser on Windows and UNIX (see the constant on net.jsunit.StandaloneTest) 38 | - StandaloneTest now runs tests in all specified browsers, even after an earlier browser failed 39 | - New "config" servlet that shows the configuration as XML of the server 40 | - Distributed Tests now send back an XML document that includes the XML for browser results as opposed to just a "success"/"failure" node 41 | - runner servlet takes a "url" querystring parameter that overrides the server's url property 42 | - test run requests to the JsUnitServer and the FarmServer are queued up and in serial so that different clients don't step on eachother 43 | - addition of new configuration parameter, "closeBrowsersAfterTestRuns", for whether to attempt to close browsers after test runs 44 | - addition of new configuration property, "timeoutSeconds", for how long to time browsers out 45 | - addition of new configuration property, "ignoreUnresponsiveRemoteMachines", for whether to care that remote machines don't uccessfully run the tests 46 | - addition of new configuration property, "description", which contains a human-readable description of the server 47 | - new index.jsp ("/") page 48 | - jsunit.org registered; redirects to edwardh.com/jsunit 49 | 50 | BUGS 51 | - fix for "retry test run" bug 52 | - bug 1070436 fixed 53 | - bug with multiple browsers and resultId specified fixed 54 | - Bug 1281427 fixed (test submission for Opera) 55 | - Safari fix 56 | - Bug 1431040 fixed 57 | 58 | ECLIPSE PLUGIN 59 | - Eclipse plugin version 1.0 60 | 61 | -------------------------------------------------------------------------------- /lib/jsunit/tests/jsUnitFrameworkUtilityTests.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | JsUnit StackTrace Tests 7 | 8 | 9 | 10 | 92 | 93 | 94 | 95 |

JsUnit Utility Tests

96 | 97 |

This page contains tests for the JsUnit framework uses. To see them, take a look at the source.

98 | 99 | 100 | -------------------------------------------------------------------------------- /lib/jsunit/app/jsUnitTracer.js: -------------------------------------------------------------------------------- 1 | var TRACE_LEVEL_NONE = new JsUnitTraceLevel(0, null); 2 | var TRACE_LEVEL_WARNING = new JsUnitTraceLevel(1, "#FF0000"); 3 | var TRACE_LEVEL_INFO = new JsUnitTraceLevel(2, "#009966"); 4 | var TRACE_LEVEL_DEBUG = new JsUnitTraceLevel(3, "#0000FF"); 5 | 6 | function JsUnitTracer(testManager) { 7 | this._testManager = testManager; 8 | this._traceWindow = null; 9 | this.popupWindowsBlocked = false; 10 | } 11 | 12 | JsUnitTracer.prototype.initialize = function() { 13 | if (this._traceWindow != null && top.testManager.closeTraceWindowOnNewRun.checked) 14 | this._traceWindow.close(); 15 | this._traceWindow = null; 16 | } 17 | 18 | JsUnitTracer.prototype.finalize = function() { 19 | if (this._traceWindow != null) { 20 | this._traceWindow.document.write('<\/body>\n<\/html>'); 21 | this._traceWindow.document.close(); 22 | } 23 | } 24 | 25 | JsUnitTracer.prototype.warn = function() { 26 | this._trace(arguments[0], arguments[1], TRACE_LEVEL_WARNING); 27 | } 28 | 29 | JsUnitTracer.prototype.inform = function() { 30 | this._trace(arguments[0], arguments[1], TRACE_LEVEL_INFO); 31 | } 32 | 33 | JsUnitTracer.prototype.debug = function() { 34 | this._trace(arguments[0], arguments[1], TRACE_LEVEL_DEBUG); 35 | } 36 | 37 | JsUnitTracer.prototype._trace = function(message, value, traceLevel) { 38 | if (!top.shouldSubmitResults() && this._getChosenTraceLevel().matches(traceLevel)) { 39 | var traceString = message; 40 | if (value) 41 | traceString += ': ' + value; 42 | var prefix = this._testManager.getTestFileName() + ":" + 43 | this._testManager.getTestFunctionName() + " - "; 44 | this._writeToTraceWindow(prefix, traceString, traceLevel); 45 | } 46 | } 47 | 48 | JsUnitTracer.prototype._getChosenTraceLevel = function() { 49 | var levelNumber = eval(top.testManager.traceLevel.value); 50 | return traceLevelByLevelNumber(levelNumber); 51 | } 52 | 53 | JsUnitTracer.prototype._writeToTraceWindow = function(prefix, traceString, traceLevel) { 54 | var htmlToAppend = '

' + prefix + '' + traceString + '<\/p>\n'; 55 | this._getTraceWindow().document.write(htmlToAppend); 56 | } 57 | 58 | JsUnitTracer.prototype._getTraceWindow = function() { 59 | if (this._traceWindow == null && !top.shouldSubmitResults() && !this.popupWindowsBlocked) { 60 | this._traceWindow = window.open('', '', 'width=600, height=350,status=no,resizable=yes,scrollbars=yes'); 61 | if (!this._traceWindow) 62 | this.popupWindowsBlocked = true; 63 | else { 64 | var resDoc = this._traceWindow.document; 65 | resDoc.write('\n\n\nTracing - JsUnit<\/title>\n<head>\n<body>'); 66 | resDoc.write('<h2>Tracing - JsUnit<\/h2>\n'); 67 | resDoc.write('<p class="jsUnitDefault"><i>(Traces are color coded: '); 68 | resDoc.write('<font color="' + TRACE_LEVEL_WARNING.getColor() + '">Warning</font> - '); 69 | resDoc.write('<font color="' + TRACE_LEVEL_INFO.getColor() + '">Information</font> - '); 70 | resDoc.write('<font color="' + TRACE_LEVEL_DEBUG.getColor() + '">Debug</font>'); 71 | resDoc.write(')</i></p>'); 72 | } 73 | } 74 | return this._traceWindow; 75 | } 76 | 77 | if (xbDEBUG.on) { 78 | xbDebugTraceObject('window', 'JsUnitTracer'); 79 | } 80 | 81 | function JsUnitTraceLevel(levelNumber, color) { 82 | this._levelNumber = levelNumber; 83 | this._color = color; 84 | } 85 | 86 | JsUnitTraceLevel.prototype.matches = function(anotherTraceLevel) { 87 | return this._levelNumber >= anotherTraceLevel._levelNumber; 88 | } 89 | 90 | JsUnitTraceLevel.prototype.getColor = function() { 91 | return this._color; 92 | } 93 | 94 | function traceLevelByLevelNumber(levelNumber) { 95 | switch (levelNumber) { 96 | case 0: return TRACE_LEVEL_NONE; 97 | case 1: return TRACE_LEVEL_WARNING; 98 | case 2: return TRACE_LEVEL_INFO; 99 | case 3: return TRACE_LEVEL_DEBUG; 100 | } 101 | return null; 102 | } -------------------------------------------------------------------------------- /lib/jsunit/tests/jsUnitUtilityTests.html: -------------------------------------------------------------------------------- 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 2 | 3 | <html> 4 | <head> 5 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 6 | <title>JsUnit Utility Tests 7 | 8 | 9 | 92 | 93 | 94 | 95 |

JsUnit Utility Tests

96 | 97 |

This page contains tests for the utility functions 98 | that JsUnit uses. To see them, take a look at the source.

99 | 100 | 101 | -------------------------------------------------------------------------------- /lib/jsunit/tests/jsUnitVersionCheckTests.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | JsUnit Version Check Tests 7 | 8 | 9 | 10 | 123 | 124 | 125 | 126 |

JsUnit Version Check Tests

127 | 128 |

This page contains tests for the version checking code in JsUnit that looks to see whether a newer version of JsUnit 129 | is available. To see them, take a look at the source.

130 | 131 | 132 | -------------------------------------------------------------------------------- /lib/jsunit/tests/jsUnitMockTimeoutTest.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Tests for jsUnitMockTimeout.js 4 | 5 | 6 | 175 | 176 | 177 | 178 | 179 | 180 | -------------------------------------------------------------------------------- /lib/jsunit/testRunner.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | JsUnit Test Runner 7 | 8 | 9 | 75 | 76 | 77 | 78 | 79 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | <body> 162 | <p>Sorry, JsUnit requires support for frames.</p> 163 | </body> 164 | 165 | 166 | 167 | -------------------------------------------------------------------------------- /lib/DomCreate.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | =head1 NAME 4 | 5 | DOM.Element.Create - Create new DOM elments in a more declarative manner 6 | 7 | =head1 SYNOPSIS 8 | 9 | // BEFORE 10 | var link = document.createElement('a'); 11 | link.href= "http://www.google.com"; 12 | link.title= "Search the Web"; 13 | link.target= "_blank" 14 | link.onclick= function() { alert('here we go'); return true; }; 15 | link.appendChild( document.createTextNode('link to Google') ); 16 | var para = document.createElement('p'); 17 | para.id = 'foo'; 18 | para.style.fontWeight = 'bold'; 19 | para.style.border = '1px solid black'; 20 | para.className = 'body-text'; 21 | para.onmouseover = function(){ this.style.backgroundColor="red"; }; 22 | para.onmouseout = function(){ this.style.backgroundColor="white"; }; 23 | para.appendChild( document.createTextNode('here is a ') ); 24 | para.appendChild( link ); 25 | 26 | // AFTER 27 | var para = createElement( 'p', { 28 | id: 'foo', 29 | className: 'body-text', 30 | style: { 31 | fontWeight: 'bold', 32 | border: '1px solid black' 33 | }, 34 | events: { 35 | mouseover: function(){ this.style.backgroundColor="red"; }, 36 | mouseout: function(){ this.style.backgroundColor="white"; } 37 | }, 38 | childNodes: [ 'here is a ', 39 | 40 | createElement( 'a', { 41 | href: 'http://www.google.com', 42 | className: 'offsite', 43 | title: 'Search the Web', 44 | target: '_blank', 45 | events: { 46 | click: function() { alert('here we go'); return true; } 47 | }, 48 | childNodes: [ 'link to Google' ] 49 | }) 50 | ] 51 | }); 52 | 53 | =head1 DESCRIPTION 54 | 55 | It has been fairly common in code I've had to write to create one or more html elements 56 | and subsequently set many of their attributes, append children and register event listeners. 57 | Rather than write line after line of C and 58 | C, C allows a more declarative approach to 59 | defining new elements. 60 | 61 | C does not export any methods by default, but allows you to export either of the 62 | methods described below. 63 | 64 | =head2 Package Methods 65 | 66 | =cut 67 | 68 | */ 69 | 70 | if ( typeof DOM == "undefined") DOM = {}; 71 | if ( typeof DOM.Element == "undefined") DOM.Element = {}; 72 | 73 | DOM.Element.Create = { 74 | 75 | VERSION: 0.01, 76 | 77 | EXPORT_OK: [ 'createElement','updateElement' ], 78 | 79 | /* 80 | 81 | =head3 C 82 | 83 | Pass a tagName and an associative array of attributes to this method and get back the 84 | correpsonding element. attribute names are not checked for validity, allowing the possibility 85 | of adding custom attributes to an element. There are, however, 3 reserved keys: 86 | 87 | =over 88 | 89 | =item C 33 | 91 | 92 | 93 | 94 |

Создатель XFN 1.1

95 |
96 | 97 | 98 | 99 | 102 | 105 | 106 | 107 | 108 | 111 | 114 | 115 | 116 | 117 | 120 | 124 | 125 | 126 | 129 | 132 | 133 | 134 | 135 | 138 | 141 | 142 | 143 | 144 | 147 | 151 | 152 | 153 | 156 | 161 | 162 | 163 | 166 | 170 | 171 |
100 | Наименование 101 | 103 | 104 |
109 | URL 110 | 112 | 113 |
118 | дружба 119 | 121 | 122 | 123 |
127 | физически 128 | 130 | 131 |
136 | профессионально 137 | 139 | 140 |
145 | географически 146 | 148 | 149 | 150 |
154 | семейно 155 | 157 | 158 | 159 | 160 |
164 | романтично 165 | 167 | 168 | 169 |
172 |

173 | 174 |

175 |
176 |
177 | 178 | <a href="" rel=""></a> 179 |
180 | 181 |

Этот пользовательский интерфейс и его код предоставлен как подспорье XFN разработчикам и как демонстрация красоты соответствия XFN значений и кода для их отображения. 182 | Создатель XFN 1.0, автор Мэт Малэнвег (Matt Mullenweg). 183 | Создатель XFN 1.1 (обновление), автор Тантек Челик (Tantek Çelik). 184 |

185 | 186 |
187 | XFN [GMPG] 188 | 189 |
190 | 191 | 193 | 194 | 195 | 196 | 197 | -------------------------------------------------------------------------------- /lib/jsunit/index.jsp: -------------------------------------------------------------------------------- 1 | <%@ page import="net.jsunit.JsUnitServer" %> 2 | <%@ page import="net.jsunit.ServerRegistry" %> 3 | <%@ page import="net.jsunit.configuration.Configuration" %> 4 | <%@ page import="net.jsunit.configuration.ConfigurationProperty" %> 5 | <%@ page import="net.jsunit.model.Browser" %> 6 | <%@ page import="net.jsunit.utility.SystemUtility" %> 7 | <%@ page import="java.text.SimpleDateFormat" %> 8 | <%JsUnitServer server = ServerRegistry.getServer();%> 9 | <%Configuration configuration = server.getConfiguration();%> 10 | 11 | 12 | 13 | 14 | JsUnit <%if (server.isFarmServer()) {%> Farm<%}%> Server 15 | 16 | 17 | 35 | 36 | 37 | 38 | 39 | 41 | 42 | 45 | 46 | 56 | 67 | 68 | 69 |
43 | JsUnit 44 |   47 |

JsUnit <%=SystemUtility.jsUnitVersion()%><%if (server.isFarmServer()) {%> Farm<%}%> Server

48 | Running on <%=SystemUtility.displayString()%> 49 | since <%=new SimpleDateFormat().format(server.getStartDate())%> 50 | <%if (!server.isFarmServer()) {%> 51 |
52 | <%=server.getTestRunCount()%> test run(s) completed 53 |
54 | <%}%> 55 |
57 | 58 | www.jsunit.net
59 | 60 | 62 |
63 | 64 | Powered By Pivotal 65 | 66 |
70 |

71 | Server configuration 72 |

73 | 74 | 75 | 76 | 77 | 78 | 79 | <% 80 | for (ConfigurationProperty property : configuration.getRequiredAndOptionalConfigurationProperties(server.serverType())) { 81 | %> 82 | 83 | 84 | 85 | 100 | <% 101 | } 102 | %> 103 |
Server type: <%=server.serverType().getDisplayName()%>
<%=property.getDisplayName()%>:  86 | <% 87 | for (String valueString : property.getValueStrings(configuration)) { 88 | %>
<% 89 | if (valueString != null) { 90 | if (property.isURL()) { 91 | %><%=valueString%><% 92 | } else { 93 | %><%=valueString%><% 94 | } 95 | } 96 | %>
<% 97 | } 98 | %> 99 |
104 |
105 |

106 | Available services 107 |

108 | 109 | 110 | 111 | 112 | 115 | 116 | <%if (!server.isFarmServer()) {%> 117 | 120 | 121 | <%}%> 122 | 125 | 126 | 129 | 130 | 131 | 132 | 248 | 249 |
  113 |   runner   114 |   118 |   displayer   119 |   123 |   testRunner.html   124 |   127 |   config   128 |  
134 |
135 |
136 | 137 |
138 | 139 | 140 | 145 | 146 | 147 | 150 | 153 | 154 | 155 | 160 | 161 | 162 | 165 | 177 | 178 | 179 | 182 | 183 |
141 | You can ask the server to run JsUnit tests using the runner servlet. 142 | You can run using the server's default URL for tests by going to runner, 143 | or you can specify a custom URL and/or browser ID using this form: 144 |
148 | URL: 149 | 151 | 152 |
156 | e.g. 157 | http://www.jsunit.net/runner/testRunner.html?testPage=http://www.jsunit.net/runner/tests/jsUnitTestSuite.html 158 | 159 |
163 | Browser: 164 | 166 | <%if (!server.isFarmServer()) {%> 167 | 168 |
175 | <%}%> 176 |
180 | 181 |
184 |
185 |
  186 |
187 | 188 | <%if (!server.isFarmServer()) {%> 189 | 190 | 231 | <%}%> 232 | 233 | 238 | 239 | 240 | 247 |
250 | 251 | 252 | -------------------------------------------------------------------------------- /lib/jsunit/tests/jsUnitAssertionTests.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | JsUnit Assertion Tests 8 | 9 | 10 | 397 | 398 | 399 | 400 |

JsUnit Assertion Tests

401 | 402 |

This page contains tests for the JsUnit Assertion 403 | functions. To see them, take a look at the source.

404 | 405 | 406 | -------------------------------------------------------------------------------- /creators/hcard.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | hCard Creator 6 | 7 | 8 | 43 | 44 | 45 | 46 | 47 | 204 | 205 | 206 | 207 |

hCard Creator

208 | 209 |
210 |
211 |
hCard-o-matic 212 | 213 |
214 | 215 | 216 |
217 |
218 | 219 | 220 |
221 |
222 | 223 | 224 |
225 |
226 | 227 | 228 |
229 | 230 |
231 | 232 | 233 |
234 |
235 | 236 | 237 |
238 |
239 | 240 | 241 |
242 |
243 | 244 | 245 |
246 |
247 | 248 | 249 |
250 |
251 | 252 | 253 | 254 |
255 |
256 | 257 | 258 |
259 |
260 | 261 | 262 |
263 |
264 | 265 | 266 | 267 |
268 |
269 | 270 | 271 |
272 |
273 | 274 | 275 |
276 |
277 | 278 | 279 |
280 |
281 | 282 | 283 |
284 |
285 | 286 | 287 |
288 |
289 |
290 |
291 | 292 |
293 | 294 |
295 |

Warning - publishing your email address, phone number or instant messenger screenname on the web can open it up to abuse.

296 |
297 | 298 |

code

299 | 300 |

preview

301 |
302 | 303 |
304 |
305 | 306 |
307 |

This user interface, and the code behind it, is provided as an example for the benefit of microformat open standards developers, and to demonstrate the clear 308 | one to one correspondence between microformat fields and microformat code. The code generated by this interface may be used for semantic web pages, structured blogging, or any other application that requires markup that is simultaneously human presentable and machine readable. Based on the 309 | hCard creator 310 | by (later updated by Ryan King), which is based on the 311 | XFN Creator (v1.0 by Matt Mullenweg, v1.1 update by Tantek Çelik). 312 |

313 | 314 |

To report any problems or make any suggestions, please send feedback to the #microformats IRC channel on Freenode.

315 | 316 |

Fork me on GitHub

317 | 318 |
319 | 320 | 322 | 323 | 324 | 325 | -------------------------------------------------------------------------------- /lib/jsunit/licenses/gpl-2.txt: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc. 5 | 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Library General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License 307 | along with this program; if not, write to the Free Software 308 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 309 | 310 | 311 | Also add information on how to contact you by electronic and paper mail. 312 | 313 | If the program is interactive, make it output a short notice like this 314 | when it starts in an interactive mode: 315 | 316 | Gnomovision version 69, Copyright (C) year name of author 317 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 318 | This is free software, and you are welcome to redistribute it 319 | under certain conditions; type `show c' for details. 320 | 321 | The hypothetical commands `show w' and `show c' should show the appropriate 322 | parts of the General Public License. Of course, the commands you use may 323 | be called something other than `show w' and `show c'; they could even be 324 | mouse-clicks or menu items--whatever suits your program. 325 | 326 | You should also get your employer (if you work as a programmer) or your 327 | school, if any, to sign a "copyright disclaimer" for the program, if 328 | necessary. Here is a sample; alter the names: 329 | 330 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 331 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 332 | 333 | , 1 April 1989 334 | Ty Coon, President of Vice 335 | 336 | This General Public License does not permit incorporating your program into 337 | proprietary programs. If your program is a subroutine library, you may 338 | consider it more useful to permit linking proprietary applications with the 339 | library. If this is what you want to do, use the GNU Library General 340 | Public License instead of this License. 341 | -------------------------------------------------------------------------------- /lib/jsunit/app/jsUnitCore.js: -------------------------------------------------------------------------------- 1 | var JSUNIT_UNDEFINED_VALUE; 2 | var JSUNIT_VERSION = 2.2; 3 | var isTestPageLoaded = false; 4 | 5 | //hack for NS62 bug 6 | function jsUnitFixTop() { 7 | var tempTop = top; 8 | if (!tempTop) { 9 | tempTop = window; 10 | while (tempTop.parent) { 11 | tempTop = tempTop.parent; 12 | if (tempTop.top && tempTop.top.jsUnitTestSuite) { 13 | tempTop = tempTop.top; 14 | break; 15 | } 16 | } 17 | } 18 | try { 19 | window.top = tempTop; 20 | } catch (e) { 21 | } 22 | } 23 | 24 | jsUnitFixTop(); 25 | 26 | /** 27 | + * A more functional typeof 28 | + * @param Object o 29 | + * @return String 30 | + */ 31 | function _trueTypeOf(something) { 32 | var result = typeof something; 33 | try { 34 | switch (result) { 35 | case 'string': 36 | case 'boolean': 37 | case 'number': 38 | break; 39 | case 'object': 40 | case 'function': 41 | switch (something.constructor) 42 | { 43 | case String: 44 | result = 'String'; 45 | break; 46 | case Boolean: 47 | result = 'Boolean'; 48 | break; 49 | case Number: 50 | result = 'Number'; 51 | break; 52 | case Array: 53 | result = 'Array'; 54 | break; 55 | case RegExp: 56 | result = 'RegExp'; 57 | break; 58 | case Function: 59 | result = 'Function'; 60 | break; 61 | default: 62 | var m = something.constructor.toString().match(/function\s*([^( ]+)\(/); 63 | if (m) 64 | result = m[1]; 65 | else 66 | break; 67 | } 68 | break; 69 | } 70 | } 71 | finally { 72 | result = result.substr(0, 1).toUpperCase() + result.substr(1); 73 | return result; 74 | } 75 | } 76 | 77 | function _displayStringForValue(aVar) { 78 | var result = '<' + aVar + '>'; 79 | if (!(aVar === null || aVar === top.JSUNIT_UNDEFINED_VALUE)) { 80 | result += ' (' + _trueTypeOf(aVar) + ')'; 81 | } 82 | return result; 83 | } 84 | 85 | function fail(failureMessage) { 86 | throw new JsUnitException("Call to fail()", failureMessage); 87 | } 88 | 89 | function error(errorMessage) { 90 | var errorObject = new Object(); 91 | errorObject.description = errorMessage; 92 | errorObject.stackTrace = getStackTrace(); 93 | throw errorObject; 94 | } 95 | 96 | function argumentsIncludeComments(expectedNumberOfNonCommentArgs, args) { 97 | return args.length == expectedNumberOfNonCommentArgs + 1; 98 | } 99 | 100 | function commentArg(expectedNumberOfNonCommentArgs, args) { 101 | if (argumentsIncludeComments(expectedNumberOfNonCommentArgs, args)) 102 | return args[0]; 103 | 104 | return null; 105 | } 106 | 107 | function nonCommentArg(desiredNonCommentArgIndex, expectedNumberOfNonCommentArgs, args) { 108 | return argumentsIncludeComments(expectedNumberOfNonCommentArgs, args) ? 109 | args[desiredNonCommentArgIndex] : 110 | args[desiredNonCommentArgIndex - 1]; 111 | } 112 | 113 | function _validateArguments(expectedNumberOfNonCommentArgs, args) { 114 | if (!( args.length == expectedNumberOfNonCommentArgs || 115 | (args.length == expectedNumberOfNonCommentArgs + 1 && typeof(args[0]) == 'string') )) 116 | error('Incorrect arguments passed to assert function'); 117 | } 118 | 119 | function _assert(comment, booleanValue, failureMessage) { 120 | if (!booleanValue) 121 | throw new JsUnitException(comment, failureMessage); 122 | } 123 | 124 | function assert() { 125 | _validateArguments(1, arguments); 126 | var booleanValue = nonCommentArg(1, 1, arguments); 127 | 128 | if (typeof(booleanValue) != 'boolean') 129 | error('Bad argument to assert(boolean)'); 130 | 131 | _assert(commentArg(1, arguments), booleanValue === true, 'Call to assert(boolean) with false'); 132 | } 133 | 134 | function assertTrue() { 135 | _validateArguments(1, arguments); 136 | var booleanValue = nonCommentArg(1, 1, arguments); 137 | 138 | if (typeof(booleanValue) != 'boolean') 139 | error('Bad argument to assertTrue(boolean)'); 140 | 141 | _assert(commentArg(1, arguments), booleanValue === true, 'Call to assertTrue(boolean) with false'); 142 | } 143 | 144 | function assertFalse() { 145 | _validateArguments(1, arguments); 146 | var booleanValue = nonCommentArg(1, 1, arguments); 147 | 148 | if (typeof(booleanValue) != 'boolean') 149 | error('Bad argument to assertFalse(boolean)'); 150 | 151 | _assert(commentArg(1, arguments), booleanValue === false, 'Call to assertFalse(boolean) with true'); 152 | } 153 | 154 | function assertEquals() { 155 | _validateArguments(2, arguments); 156 | var var1 = nonCommentArg(1, 2, arguments); 157 | var var2 = nonCommentArg(2, 2, arguments); 158 | _assert(commentArg(2, arguments), var1 === var2, 'Expected ' + _displayStringForValue(var1) + ' but was ' + _displayStringForValue(var2)); 159 | } 160 | 161 | function assertNotEquals() { 162 | _validateArguments(2, arguments); 163 | var var1 = nonCommentArg(1, 2, arguments); 164 | var var2 = nonCommentArg(2, 2, arguments); 165 | _assert(commentArg(2, arguments), var1 !== var2, 'Expected not to be ' + _displayStringForValue(var2)); 166 | } 167 | 168 | function assertNull() { 169 | _validateArguments(1, arguments); 170 | var aVar = nonCommentArg(1, 1, arguments); 171 | _assert(commentArg(1, arguments), aVar === null, 'Expected ' + _displayStringForValue(null) + ' but was ' + _displayStringForValue(aVar)); 172 | } 173 | 174 | function assertNotNull() { 175 | _validateArguments(1, arguments); 176 | var aVar = nonCommentArg(1, 1, arguments); 177 | _assert(commentArg(1, arguments), aVar !== null, 'Expected not to be ' + _displayStringForValue(null)); 178 | } 179 | 180 | function assertUndefined() { 181 | _validateArguments(1, arguments); 182 | var aVar = nonCommentArg(1, 1, arguments); 183 | _assert(commentArg(1, arguments), aVar === top.JSUNIT_UNDEFINED_VALUE, 'Expected ' + _displayStringForValue(top.JSUNIT_UNDEFINED_VALUE) + ' but was ' + _displayStringForValue(aVar)); 184 | } 185 | 186 | function assertNotUndefined() { 187 | _validateArguments(1, arguments); 188 | var aVar = nonCommentArg(1, 1, arguments); 189 | _assert(commentArg(1, arguments), aVar !== top.JSUNIT_UNDEFINED_VALUE, 'Expected not to be ' + _displayStringForValue(top.JSUNIT_UNDEFINED_VALUE)); 190 | } 191 | 192 | function assertNaN() { 193 | _validateArguments(1, arguments); 194 | var aVar = nonCommentArg(1, 1, arguments); 195 | _assert(commentArg(1, arguments), isNaN(aVar), 'Expected NaN'); 196 | } 197 | 198 | function assertNotNaN() { 199 | _validateArguments(1, arguments); 200 | var aVar = nonCommentArg(1, 1, arguments); 201 | _assert(commentArg(1, arguments), !isNaN(aVar), 'Expected not NaN'); 202 | } 203 | 204 | function assertObjectEquals() { 205 | _validateArguments(2, arguments); 206 | var var1 = nonCommentArg(1, 2, arguments); 207 | var var2 = nonCommentArg(2, 2, arguments); 208 | var type; 209 | var msg = commentArg(2, arguments)?commentArg(2, arguments):''; 210 | var isSame = (var1 === var2); 211 | //shortpath for references to same object 212 | var isEqual = ( (type = _trueTypeOf(var1)) == _trueTypeOf(var2) ); 213 | if (isEqual && !isSame) { 214 | switch (type) { 215 | case 'String': 216 | case 'Number': 217 | isEqual = (var1 == var2); 218 | break; 219 | case 'Boolean': 220 | case 'Date': 221 | isEqual = (var1 === var2); 222 | break; 223 | case 'RegExp': 224 | case 'Function': 225 | isEqual = (var1.toString() === var2.toString()); 226 | break; 227 | default: //Object | Array 228 | var i; 229 | if (isEqual = (var1.length === var2.length)) 230 | for (i in var1) 231 | assertObjectEquals(msg + ' found nested ' + type + '@' + i + '\n', var1[i], var2[i]); 232 | } 233 | _assert(msg, isEqual, 'Expected ' + _displayStringForValue(var1) + ' but was ' + _displayStringForValue(var2)); 234 | } 235 | } 236 | 237 | assertArrayEquals = assertObjectEquals; 238 | 239 | function assertEvaluatesToTrue() { 240 | _validateArguments(1, arguments); 241 | var value = nonCommentArg(1, 1, arguments); 242 | if (!value) 243 | fail(commentArg(1, arguments)); 244 | } 245 | 246 | function assertEvaluatesToFalse() { 247 | _validateArguments(1, arguments); 248 | var value = nonCommentArg(1, 1, arguments); 249 | if (value) 250 | fail(commentArg(1, arguments)); 251 | } 252 | 253 | function assertHTMLEquals() { 254 | _validateArguments(2, arguments); 255 | var var1 = nonCommentArg(1, 2, arguments); 256 | var var2 = nonCommentArg(2, 2, arguments); 257 | var var1Standardized = standardizeHTML(var1); 258 | var var2Standardized = standardizeHTML(var2); 259 | 260 | _assert(commentArg(2, arguments), var1Standardized === var2Standardized, 'Expected ' + _displayStringForValue(var1Standardized) + ' but was ' + _displayStringForValue(var2Standardized)); 261 | } 262 | 263 | function assertHashEquals() { 264 | _validateArguments(2, arguments); 265 | var var1 = nonCommentArg(1, 2, arguments); 266 | var var2 = nonCommentArg(2, 2, arguments); 267 | for (var key in var1) { 268 | assertNotUndefined("Expected hash had key " + key + " that was not found", var2[key]); 269 | assertEquals( 270 | "Value for key " + key + " mismatch - expected = " + var1[key] + ", actual = " + var2[key], 271 | var1[key], var2[key] 272 | ); 273 | } 274 | for (var key in var2) { 275 | assertNotUndefined("Actual hash had key " + key + " that was not expected", var1[key]); 276 | } 277 | } 278 | 279 | function assertRoughlyEquals() { 280 | _validateArguments(3, arguments); 281 | var expected = nonCommentArg(1, 3, arguments); 282 | var actual = nonCommentArg(2, 3, arguments); 283 | var tolerance = nonCommentArg(3, 3, arguments); 284 | assertTrue( 285 | "Expected " + expected + ", but got " + actual + " which was more than " + tolerance + " away", 286 | Math.abs(expected - actual) < tolerance 287 | ); 288 | } 289 | 290 | function assertContains() { 291 | _validateArguments(2, arguments); 292 | var contained = nonCommentArg(1, 2, arguments); 293 | var container = nonCommentArg(2, 2, arguments); 294 | assertTrue( 295 | "Expected '" + container + "' to contain '" + contained + "'", 296 | container.indexOf(contained) != -1 297 | ); 298 | } 299 | 300 | function standardizeHTML(html) { 301 | var translator = document.createElement("DIV"); 302 | translator.innerHTML = html; 303 | return translator.innerHTML; 304 | } 305 | 306 | function isLoaded() { 307 | return isTestPageLoaded; 308 | } 309 | 310 | function setUp() { 311 | } 312 | 313 | function tearDown() { 314 | } 315 | 316 | function getFunctionName(aFunction) { 317 | var regexpResult = aFunction.toString().match(/function(\s*)(\w*)/); 318 | if (regexpResult && regexpResult.length >= 2 && regexpResult[2]) { 319 | return regexpResult[2]; 320 | } 321 | return 'anonymous'; 322 | } 323 | 324 | function getStackTrace() { 325 | var result = ''; 326 | 327 | if (typeof(arguments.caller) != 'undefined') { // IE, not ECMA 328 | for (var a = arguments.caller; a != null; a = a.caller) { 329 | result += '> ' + getFunctionName(a.callee) + '\n'; 330 | if (a.caller == a) { 331 | result += '*'; 332 | break; 333 | } 334 | } 335 | } 336 | else { // Mozilla, not ECMA 337 | // fake an exception so we can get Mozilla's error stack 338 | var testExcp; 339 | try 340 | { 341 | foo.bar; 342 | } 343 | catch(testExcp) 344 | { 345 | var stack = parseErrorStack(testExcp); 346 | for (var i = 1; i < stack.length; i++) 347 | { 348 | result += '> ' + stack[i] + '\n'; 349 | } 350 | } 351 | } 352 | 353 | return result; 354 | } 355 | 356 | function parseErrorStack(excp) 357 | { 358 | var stack = []; 359 | var name; 360 | 361 | if (!excp || !excp.stack) 362 | { 363 | return stack; 364 | } 365 | 366 | var stacklist = excp.stack.split('\n'); 367 | 368 | for (var i = 0; i < stacklist.length - 1; i++) 369 | { 370 | var framedata = stacklist[i]; 371 | 372 | name = framedata.match(/^(\w*)/)[1]; 373 | if (!name) { 374 | name = 'anonymous'; 375 | } 376 | 377 | stack[stack.length] = name; 378 | } 379 | // remove top level anonymous functions to match IE 380 | 381 | while (stack.length && stack[stack.length - 1] == 'anonymous') 382 | { 383 | stack.length = stack.length - 1; 384 | } 385 | return stack; 386 | } 387 | 388 | function JsUnitException(comment, message) { 389 | this.isJsUnitException = true; 390 | this.comment = comment; 391 | this.jsUnitMessage = message; 392 | this.stackTrace = getStackTrace(); 393 | } 394 | 395 | function warn() { 396 | if (top.tracer != null) 397 | top.tracer.warn(arguments[0], arguments[1]); 398 | } 399 | 400 | function inform() { 401 | if (top.tracer != null) 402 | top.tracer.inform(arguments[0], arguments[1]); 403 | } 404 | 405 | function info() { 406 | inform(arguments[0], arguments[1]); 407 | } 408 | 409 | function debug() { 410 | if (top.tracer != null) 411 | top.tracer.debug(arguments[0], arguments[1]); 412 | } 413 | 414 | function setJsUnitTracer(aJsUnitTracer) { 415 | top.tracer = aJsUnitTracer; 416 | } 417 | 418 | function trim(str) { 419 | if (str == null) 420 | return null; 421 | 422 | var startingIndex = 0; 423 | var endingIndex = str.length - 1; 424 | 425 | while (str.substring(startingIndex, startingIndex + 1) == ' ') 426 | startingIndex++; 427 | 428 | while (str.substring(endingIndex, endingIndex + 1) == ' ') 429 | endingIndex--; 430 | 431 | if (endingIndex < startingIndex) 432 | return ''; 433 | 434 | return str.substring(startingIndex, endingIndex + 1); 435 | } 436 | 437 | function isBlank(str) { 438 | return trim(str) == ''; 439 | } 440 | 441 | // the functions push(anArray, anObject) and pop(anArray) 442 | // exist because the JavaScript Array.push(anObject) and Array.pop() 443 | // functions are not available in IE 5.0 444 | 445 | function push(anArray, anObject) { 446 | anArray[anArray.length] = anObject; 447 | } 448 | function pop(anArray) { 449 | if (anArray.length >= 1) { 450 | delete anArray[anArray.length - 1]; 451 | anArray.length--; 452 | } 453 | } 454 | 455 | function jsUnitGetParm(name) 456 | { 457 | if (typeof(top.jsUnitParmHash[name]) != 'undefined') 458 | { 459 | return top.jsUnitParmHash[name]; 460 | } 461 | return null; 462 | } 463 | 464 | if (top && typeof(top.xbDEBUG) != 'undefined' && top.xbDEBUG.on && top.testManager) 465 | { 466 | top.xbDebugTraceObject('top.testManager.containerTestFrame', 'JSUnitException'); 467 | // asserts 468 | top.xbDebugTraceFunction('top.testManager.containerTestFrame', '_displayStringForValue'); 469 | top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'error'); 470 | top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'argumentsIncludeComments'); 471 | top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'commentArg'); 472 | top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'nonCommentArg'); 473 | top.xbDebugTraceFunction('top.testManager.containerTestFrame', '_validateArguments'); 474 | top.xbDebugTraceFunction('top.testManager.containerTestFrame', '_assert'); 475 | top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'assert'); 476 | top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'assertTrue'); 477 | top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'assertEquals'); 478 | top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'assertNotEquals'); 479 | top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'assertNull'); 480 | top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'assertNotNull'); 481 | top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'assertUndefined'); 482 | top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'assertNotUndefined'); 483 | top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'assertNaN'); 484 | top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'assertNotNaN'); 485 | top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'isLoaded'); 486 | top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'setUp'); 487 | top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'tearDown'); 488 | top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'getFunctionName'); 489 | top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'getStackTrace'); 490 | top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'warn'); 491 | top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'inform'); 492 | top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'debug'); 493 | top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'setJsUnitTracer'); 494 | top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'trim'); 495 | top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'isBlank'); 496 | top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'newOnLoadEvent'); 497 | top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'push'); 498 | top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'pop'); 499 | } 500 | 501 | function newOnLoadEvent() { 502 | isTestPageLoaded = true; 503 | } 504 | 505 | function jsUnitSetOnLoad(windowRef, onloadHandler) 506 | { 507 | var isKonqueror = navigator.userAgent.indexOf('Konqueror/') != -1 || 508 | navigator.userAgent.indexOf('Safari/') != -1; 509 | 510 | if (typeof(windowRef.attachEvent) != 'undefined') { 511 | // Internet Explorer, Opera 512 | windowRef.attachEvent("onload", onloadHandler); 513 | } else if (typeof(windowRef.addEventListener) != 'undefined' && !isKonqueror) { 514 | // Mozilla, Konqueror 515 | // exclude Konqueror due to load issues 516 | windowRef.addEventListener("load", onloadHandler, false); 517 | } else if (typeof(windowRef.document.addEventListener) != 'undefined' && !isKonqueror) { 518 | // DOM 2 Events 519 | // exclude Mozilla, Konqueror due to load issues 520 | windowRef.document.addEventListener("load", onloadHandler, false); 521 | } else if (typeof(windowRef.onload) != 'undefined' && windowRef.onload) { 522 | windowRef.jsunit_original_onload = windowRef.onload; 523 | windowRef.onload = function() { 524 | windowRef.jsunit_original_onload(); 525 | onloadHandler(); 526 | }; 527 | } else { 528 | // browsers that do not support windowRef.attachEvent or 529 | // windowRef.addEventListener will override a page's own onload event 530 | windowRef.onload = onloadHandler; 531 | } 532 | } 533 | 534 | jsUnitSetOnLoad(window, newOnLoadEvent); --------------------------------------------------------------------------------