smparkes-envjs 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. data/README +101 -0
  2. data/bin/envjsrb +147 -0
  3. data/bin/jquery-1.2.6-test.js +33 -0
  4. data/bin/jquery-1.3.1-test.js +33 -0
  5. data/bin/jquery-1.3.2-test.js +98 -0
  6. data/bin/prototype-1.6.0.3-test.js +82 -0
  7. data/bin/prototype_1.6.0.3_tmpl.txt +27 -0
  8. data/bin/test-jquery.sh +58 -0
  9. data/bin/test-prototype.sh +54 -0
  10. data/bin/tidy +0 -0
  11. data/lib/envjs/env.js +10423 -0
  12. data/lib/envjs/net/file.rb +71 -0
  13. data/lib/envjs/net.rb +3 -0
  14. data/lib/envjs/runtime.rb +132 -0
  15. data/lib/envjs/runtime.rb.smp +133 -0
  16. data/lib/envjs/tempfile.rb +24 -0
  17. data/lib/envjs.rb +23 -0
  18. data/test/call-load-test.js +17 -0
  19. data/test/debug.js +53 -0
  20. data/test/envjs-call-load-test.js +3 -0
  21. data/test/envjs-prototype.js +3 -0
  22. data/test/html/events.html +171 -0
  23. data/test/html/iframe1.html +46 -0
  24. data/test/html/iframe1a.html +46 -0
  25. data/test/html/iframe2.html +45 -0
  26. data/test/html/iframe3.html +30 -0
  27. data/test/html/iframeN.html +57 -0
  28. data/test/html/scope.html +87 -0
  29. data/test/html/trivial.html +19 -0
  30. data/test/html/with_js.html +26 -0
  31. data/test/index.html +304 -0
  32. data/test/java-prototype.js +9 -0
  33. data/test/primaryTests.js +26 -0
  34. data/test/prototype.js +15 -0
  35. data/test/qunit/package.json +21 -0
  36. data/test/qunit/qunit/qunit.css +17 -0
  37. data/test/qunit/qunit/qunit.js +997 -0
  38. data/test/qunit/qunit/qunit.js.smp +1002 -0
  39. data/test/qunit/test/index.html +17 -0
  40. data/test/qunit/test/same.js +1368 -0
  41. data/test/qunit/test/test.js +136 -0
  42. data/test/qunit.js +61 -0
  43. data/test/qunit.smp/package.json +21 -0
  44. data/test/qunit.smp/qunit/qunit.css +17 -0
  45. data/test/qunit.smp/qunit/qunit.js +997 -0
  46. data/test/qunit.smp/test/index.html +17 -0
  47. data/test/qunit.smp/test/same.js +1368 -0
  48. data/test/qunit.smp/test/test.js +136 -0
  49. data/test/rhino-call-load-test.js +5 -0
  50. data/test/test-with-envs-jar.js +8 -0
  51. data/test/test-with-rhino-jar.js +9 -0
  52. data/test/unit/dom.js +43 -0
  53. data/test/unit/elementmembers.js +29 -0
  54. data/test/unit/events.js +195 -0
  55. data/test/unit/fixtures/external_script.js +1 -0
  56. data/test/unit/iframe.js +234 -0
  57. data/test/unit/multi-window.js +212 -0
  58. data/test/unit/onload.js +82 -0
  59. data/test/unit/parser.js +113 -0
  60. data/test/unit/prototypecompat.js +22 -0
  61. data/test/unit/proxy.js +6 -0
  62. data/test/unit/scope.js +209 -0
  63. data/test/unit/timer.js +115 -0
  64. data/test/unit/window.js +41 -0
  65. data/test/vendor/jQuery/README +2 -0
  66. data/test/vendor/prototype-1.6.0.3.js +4320 -0
  67. metadata +130 -0
data/README ADDED
@@ -0,0 +1,101 @@
1
+ env.js : A pure JavaScript browser environment.
2
+ Developed by John Resig (http://ejohn.org)
3
+
4
+ Major Contributers:
5
+ Chris Thatcher (http://github.com/thatcher)
6
+
7
+ GitHub repositories:
8
+ http://github.com/jeresig/env-js/
9
+ http://github.com/thatcher/env-js/
10
+
11
+ Mailing List:
12
+ http://groups.google.com/group/envjs
13
+
14
+ Lighthouse (Bug Tracking):
15
+ http://envjs.lighthouseapp.com/projects/21590-envjs/
16
+
17
+ Build Status:
18
+ http://runcoderun.com/thatcher/env-js
19
+
20
+ Original blog post:
21
+ http://ejohn.org/projects/bringing-the-browser-to-the-server/
22
+
23
+ Rhino (Java-based JavaScript engine)
24
+ http://www.mozilla.org/rhino/
25
+
26
+ Getting the code:
27
+
28
+ * Check the code out from git: git clone git://github.com/thatcher/env-js.git
29
+
30
+ Building:
31
+ * run "ant concat"
32
+ * Creates a platform-agnostic "dist/env.js" file and a Rhino-specific "dist/env.rhino.js" file.
33
+
34
+ Testing:
35
+ * Checkout qunit: "git submodule update --init"
36
+ * run "ant test"
37
+
38
+ Java command line:
39
+
40
+ env.rhino.js can be run either with a "generic" version of the Rhino
41
+ library (js.jar), or with the repackaged/extended version of Rhino
42
+ supplied with env.js (env-js.jar). If your application uses multiple
43
+ windows, frames, or iframes, or if it depends on precise adherence to
44
+ JavaScript object scoping in event handlers, you will have to use
45
+ env-js.jar. Simple applications may be able to run with the generic
46
+ version of Rhino.
47
+
48
+ The command line used for testing env.js can be found in build.xml,
49
+ although the general form is:
50
+ java -jar [jar file] [javascript file]
51
+ Where "jar file" is either "dist/env-js.jar", "rhino/js.jar", or your
52
+ local path to a different version of the Rhino js.jar file. The
53
+ "javascript file" is the path to the JavaScript you wish to execute.
54
+
55
+ Installing:
56
+ 1) Include the proper env.js file for your platform.
57
+ load('env.rhino.js'); //if in a Rhino script
58
+
59
+ 2) Tell env.js to load an HTML file from your file system that it should model:
60
+ window.location = "some/file.html";
61
+ Envjs("some/file.html");
62
+
63
+ Optionally you can turn on/off settings by passing an options object:
64
+ Envjs("some/file.html", {log: function(msg){ console.debug(msg) }});
65
+
66
+ 3) Optionally trigger "document ready" events in one of these ways:
67
+
68
+ a) standard window.load method:
69
+ load('env.rhino.js');
70
+ window.location = "some/file.html";
71
+ Envjs("some/file.html");
72
+
73
+ b) jQuery ready method:
74
+ load('env.rhino.js');
75
+ load('jquery-1.3.2.js');
76
+ Envjs("some/file.html");
77
+ load('some-code-that-sets-up-jquery-onready-behaviors.js')
78
+ jQuery.ready();
79
+
80
+ c) Other JavaScript frameworks have their own methods of setup, but the general pattern is:
81
+ // load env.js
82
+ // load your framework
83
+ // tell env.js the base DOM to model
84
+ // run any setup code for your framework
85
+ // tell the framework that the document is loaded
86
+
87
+ 4) Invoke the Envjs event loop at the end of your script:
88
+ Envjs.wait();
89
+
90
+ Testing jQuery Compatibility:
91
+ * run ./bin/test-jquery.sh 1.3.2
92
+ * run ./bin/test-jquery.sh 1.3.1
93
+ * run ./bin/test-jquery.sh 1.2.6
94
+ * Checks out the given jQuery tag from Subversion into test/vendor/jQuery/[version],
95
+ moves dist/env.rhino.js into the correct location in their tree, and runs the test suites.
96
+
97
+ Changes with new timer code:
98
+
99
+ Previously with envjs, you could call Java's thread sleep() method to delay execution. This was mostly used in test suites. This may no
100
+ longer work the same since it will inhibit all events from firing. You can now use the Envjs.wait(milliseconds) call to achieve an
101
+ effect similar to calling sleep().
data/bin/envjsrb ADDED
@@ -0,0 +1,147 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+
5
+ begin
6
+ require 'johnson/tracemonkey'
7
+ require 'johnson/cli'
8
+ require 'envjs/runtime'
9
+ rescue Exception => e
10
+ # (temporarily) run out of local if gem not installed
11
+ $: << File.expand_path( File.join( File.dirname(__FILE__), "..", "lib" ) )
12
+ $: << File.expand_path( File.join( File.dirname(__FILE__), "..", "vendor", "johnson", "lib" ) )
13
+ require 'johnson/tracemonkey'
14
+ require 'johnson/cli'
15
+ require 'envjs/runtime'
16
+ end
17
+
18
+ RUNTIME = js = Johnson::Runtime.new
19
+ RUNTIME.extend Envjs::Runtime
20
+
21
+ RUNTIME.load Envjs::ENVJS
22
+
23
+ if ARGV.length > 0
24
+
25
+ begin
26
+ ARGV.each do |file|
27
+ if file =~ /\.x?html?$/
28
+ RUNTIME.evaluate("window.location = '#{file}'", file, 1)
29
+ else
30
+ RUNTIME.load file
31
+ end
32
+ end
33
+ rescue Johnson::Error => je
34
+ if je.message.match /<SystemExit: exit>/
35
+ exit
36
+ end
37
+ raise je
38
+ end
39
+
40
+ RUNTIME.wait
41
+
42
+ else
43
+
44
+ require "readline"
45
+ require "johnson/cli"
46
+
47
+ RUNTIME.evaluate(Johnson::CLI::JS)
48
+
49
+ EXIT_VERBS = [nil] + %w(exit quit)
50
+
51
+ local_binding = binding
52
+ ruby_readline = []
53
+
54
+ def copy_history
55
+ new_history = []
56
+ until Readline::HISTORY.empty?
57
+ new_history.push(Readline::HISTORY.pop)
58
+ end
59
+ new_history
60
+ end
61
+
62
+ def paste_history(old_history)
63
+ until old_history.empty?
64
+ Readline::HISTORY << old_history.pop
65
+ end
66
+ end
67
+
68
+ def handle_exit(input)
69
+ if EXIT_VERBS.include?(input)
70
+ puts if input.nil?
71
+ exit
72
+ end
73
+ end
74
+
75
+ def rescued(&block)
76
+ yield
77
+ rescue Exception => e
78
+ exit if SystemExit === e
79
+
80
+ puts e.message
81
+ puts e.backtrace.reject { |l| l =~ /bin\/johnson/ }
82
+ end
83
+
84
+ def eval_in_js(expression)
85
+ rescued { puts "=> " + RUNTIME.evaluate(expression, "(console)").inspect }
86
+ end
87
+
88
+ def eval_in_ruby(expression, bind_to)
89
+ rescued { puts "=> " + eval(expression, bind_to).inspect }
90
+ end
91
+
92
+ options = Johnson::CLI::Options.parse!(ARGV)
93
+
94
+ options.load_paths.each { |d| $LOAD_PATH << d }
95
+ options.paths_to_require.each { |p| RUNTIME.evaluate("Johnson.require('#{p}')") }
96
+ options.files_to_preload.each { |f| RUNTIME.load(f) }
97
+
98
+ unless options.expressions.empty?
99
+ options.expressions.each { |e| RUNTIME.evaluate(e, '-e') }
100
+ exit if options.files_to_evaluate.empty?
101
+ end
102
+
103
+ unless options.files_to_evaluate.empty?
104
+ RUNTIME[:arguments] = options.arguments
105
+
106
+ options.files_to_evaluate.each do |file|
107
+ RUNTIME.load(file)
108
+ end
109
+
110
+ exit
111
+ end
112
+
113
+ loop do
114
+ input = Readline.readline("js> ", true)
115
+ handle_exit(input)
116
+
117
+ if input =~ /^rb\s+(.+)$/
118
+ eval_in_ruby($1, local_binding)
119
+ next
120
+ end
121
+
122
+ if input == "rb"
123
+ js_readline = copy_history
124
+ paste_history(ruby_readline)
125
+
126
+ loop do
127
+ input = Readline.readline("rb> ", true)
128
+ handle_exit(input)
129
+
130
+ break if input == "js"
131
+
132
+ if input =~ /^js\s+(.+)$/
133
+ eval_in_js($1)
134
+ next
135
+ end
136
+
137
+ eval_in_ruby(input, local_binding)
138
+ end
139
+
140
+ ruby_readline = copy_history
141
+ paste_history(js_readline)
142
+ next
143
+ end
144
+
145
+ eval_in_js(input)
146
+ end
147
+ end
@@ -0,0 +1,33 @@
1
+ // Init
2
+ load("build/runtest/env.js");
3
+
4
+ var isLocal;
5
+ window.onload = function(){
6
+ isLocal = !!(window.location.protocol == 'file:');
7
+
8
+ // Load the test runner
9
+ load("dist/jquery.js",
10
+ "build/runtest/testrunner.js");
11
+
12
+ // Load the tests
13
+ load(
14
+ "test/unit/core.js",
15
+ "test/unit/selector.js",
16
+ "test/unit/event.js",
17
+ "test/unit/fx.js",
18
+ "test/unit/dimensions.js",
19
+
20
+ // offset relies on window.open, which is currently unimplemented in env.js
21
+ //"test/unit/offset.js",
22
+
23
+ // these tests require hitting a server, so we will need some clever env.js
24
+ // way of testing them
25
+ // by defining isLocal we can still load the test
26
+ "test/unit/ajax.js"
27
+ );
28
+
29
+ // Display the results
30
+ results();
31
+ };
32
+
33
+ window.location = "test/index.html";
@@ -0,0 +1,33 @@
1
+ // Init
2
+ load("build/runtest/env.js");
3
+
4
+ var isLocal;
5
+ window.onload = function(){
6
+ isLocal = !!(window.location.protocol == 'file:');
7
+
8
+ // Load the test runner
9
+ load("dist/jquery.js",
10
+ "build/runtest/testrunner.js");
11
+
12
+ // Load the tests
13
+ load(
14
+ "test/unit/core.js",
15
+ "test/unit/selector.js",
16
+ "test/unit/event.js",
17
+ "test/unit/fx.js",
18
+ "test/unit/dimensions.js",
19
+ "test/unit/data.js",
20
+
21
+ // offset relies on window.open, which is currently unimplemented in env.js
22
+ //"test/unit/offset.js",
23
+
24
+ // these tests require hitting a server, so we will need some clever env.js
25
+ // way of testing them
26
+ "test/unit/ajax.js"
27
+ );
28
+
29
+ // Display the results
30
+ results();
31
+ };
32
+
33
+ window.location = "test/index.html";
@@ -0,0 +1,98 @@
1
+ //debugger;
2
+ load("build/runtest/env.js");
3
+
4
+ (function(Envjs){
5
+ var $env = Envjs.$env;
6
+
7
+ Envjs("test/index.html", {
8
+ //let it load the script from the html
9
+ logLevel: $env.INFO,
10
+ scriptTypes: {
11
+ "text/javascript" :true
12
+ },
13
+ afterScriptLoad:{
14
+ 'qunit/testrunner.js': function(){
15
+ //hook into qunit.log
16
+ var count = 0;
17
+ QUnit.log = function(result, message){
18
+ $env.log('(' + (count++) + ')[' +
19
+ ((!!result) ? 'PASS' : 'FAIL') + '] ' + message);
20
+ };
21
+ //hook into qunit.done
22
+ QUnit.done = function(pass, fail){
23
+ $env.warn('Writing Results to File');
24
+ jQuery('script').each(function(){
25
+ this.type = 'text/envjs';
26
+ });
27
+ $env.writeToFile(
28
+ document.documentElement.xml,
29
+ $env.location('jqenv-'+Date.now()+'.html')
30
+ );
31
+ };
32
+
33
+ //allow jquery to run ajax
34
+ isLocal = false;
35
+
36
+
37
+ var unsafeStop = stop,
38
+ unsafeStart = start,
39
+ isStopped = null;
40
+
41
+ var config_timeout;
42
+ stop = function(timeout){
43
+ if(isStopped === null || isStopped === false){
44
+ $env.log('PAUSING QUNIT');
45
+ isStopped = true;
46
+ unsafeStop.call(this);
47
+ timeout = ( timeout && timeout > 0 ) ? timeout : 10000;
48
+ if (timeout)
49
+ config_timeout = setTimeout(function() {
50
+ QUnit.ok( false, "Test timed out" );
51
+ start();
52
+ }, timeout);
53
+ }
54
+ };
55
+ start = function(){
56
+ if(isStopped === null || isStopped === true ){
57
+ $env.log('RESTARTING QUNIT');
58
+ isStopped = false;
59
+ if(config_timeout) {
60
+ clearTimeout(config_timeout);
61
+ config_timeout = undefined;
62
+ }
63
+ unsafeStart.call(this);
64
+ }
65
+ };
66
+ //we know some ajax calls will fail becuase
67
+ //we are not running against a running server
68
+ //for php files
69
+ var handleError = jQuery.handleError;
70
+ jQuery.handleError = function(){
71
+ ok(false, 'Ajax may have failed while running locally');
72
+ try{
73
+ handleError(arguments);
74
+ }catch(e){}
75
+ //allow tests to gracefully continue
76
+ start();
77
+ };
78
+ //allow unanticipated xhr error with no ajax.handleError
79
+ //callback (eg jQuery.getScript) to exit gracefully
80
+ $env.onInterrupt = function(){
81
+ $env.info('thread interupt: gracefully continuing test');
82
+ start();
83
+ };
84
+
85
+
86
+ $env.onScriptLoadError = function(script){
87
+ Envjs.error("failed to load script \n"+script.text);
88
+ ok(false, 'Ajax may have failed to load correct script while running locally');
89
+ //allow tests to gracefully continue
90
+ start();
91
+ };
92
+ }
93
+ }
94
+ });
95
+
96
+ })(Envjs);
97
+
98
+ Envjs.wait();
@@ -0,0 +1,82 @@
1
+ //debugger;
2
+ load("env.js");
3
+
4
+ (function($env){
5
+
6
+
7
+ $env("array_test.html", {
8
+ //let it load the script from the html
9
+ scriptTypes: {
10
+ "text/javascript" :true
11
+ },
12
+ afterload:{
13
+ 'lib_assets/unittest.js': function(){
14
+ //hook into some messaging
15
+ var assertBlock = Test.Unit.Assertions.assertBlock;
16
+ Test.Unit.Assertions.assertBlock = function(){
17
+ $env.log(arguments[0]);
18
+ return assertBlock(arguments);
19
+ };
20
+ Test.Unit.Logger.prototype.initialize = function(id) {
21
+ this.id = id;
22
+ $env.debug(' ['+this.id+'] initialized');
23
+ };
24
+
25
+ Test.Unit.Logger.prototype.start = function(testName) {
26
+ this.currentTest = testName;
27
+ $env.debug(' ['+this.id+'] starting test ('+this.currentTest+')');
28
+ };
29
+
30
+
31
+ Test.Unit.Logger.prototype.setStatus = function(status) {
32
+ $env.log(' ['+this.id+'] ('+this.currentTest+') '+status);
33
+ };
34
+
35
+ Test.Unit.Logger.prototype.finish = function(status, summary) {
36
+ $env.log(' ['+this.id+'] ('+this.currentTest+
37
+ ') '+status+' '+summary.replace(/\n/g,"\t"));
38
+ };
39
+
40
+ }
41
+ }
42
+ });
43
+ $env.writeToFile(
44
+ document.documentElement.xml,
45
+ $env.location('jqenv-array_test-'+Date.now()+'.html')
46
+ );
47
+
48
+ $env("base_test.html", {
49
+ //let it load the script from the html
50
+ scriptTypes: {
51
+ "text/javascript" :true
52
+ }
53
+ });
54
+ $env.writeToFile(
55
+ document.documentElement.xml,
56
+ $env.location('jqenv-base_test-'+Date.now()+'.html')
57
+ );
58
+
59
+
60
+ $env("class_test.html", {
61
+ //let it load the script from the html
62
+ scriptTypes: {
63
+ "text/javascript" :true
64
+ }
65
+ });
66
+ $env.writeToFile(
67
+ document.documentElement.xml,
68
+ $env.location('jqenv-class_test-'+Date.now()+'.html')
69
+ );
70
+
71
+ $env("date_test.html", {
72
+ //let it load the script from the html
73
+ scriptTypes: {
74
+ "text/javascript" :true
75
+ }
76
+ });
77
+ $env.writeToFile(
78
+ document.documentElement.xml,
79
+ $env.location('jqenv-date_test-'+Date.now()+'.html')
80
+ );
81
+
82
+ })(Envjs);
@@ -0,0 +1,27 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <title>Unit test file | <%= title %> | <%= template_name %> template | <%= timestamp %></title>
6
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
7
+ <script type="text/javascript" charset="utf-8">
8
+ var eventResults = {};
9
+ var originalElement = window.Element;
10
+ </script>
11
+ <%= script_tag('assets/prototype.js') %>
12
+ <%= script_tag('lib_assets/unittest.js') %>
13
+ <%= link_tag('lib_assets/unittest.css') %>
14
+ <%= css_fixtures %>
15
+ <%= js_fixtures %>
16
+ <%= test_file %>
17
+ </head>
18
+ <body>
19
+
20
+ <div id="testlog"></div>
21
+
22
+ <%= html_fixtures %>
23
+ <script type="text/javascript" charset="utf-8">
24
+ eventResults.endOfDocument = true;
25
+ </script>
26
+ </body>
27
+ </html>
@@ -0,0 +1,58 @@
1
+ #!/bin/sh
2
+
3
+ # Usage: test-jquery.sh [version]
4
+ # Currently supported versions: 1.3.2, 1.3.1, and 1.2.6
5
+ #
6
+ # This script will check out the jQuery development tree from Subversion if necessary,
7
+ # massage the testing scripts as necessary, copy our latest version of env.js into place,
8
+ # and then run the test scripts.
9
+
10
+
11
+ if [ -n "$2" ]; then
12
+ echo 'debug'
13
+ if [ -n "$2" ]; then VERSION="$2"; else VERSION="1.3.2"; fi
14
+ DEBUG=1
15
+ else
16
+ echo 'jquery'
17
+ if [ -n "$1" ]; then VERSION="$1"; else VERSION="1.3.2"; fi
18
+ DEBUG=0
19
+ fi
20
+
21
+ JQUERY_DIR="test/vendor/jQuery/$VERSION";
22
+
23
+ ant concat
24
+
25
+ if [ ! -d "$JQUERY_DIR" ]; then
26
+ svn export http://jqueryjs.googlecode.com/svn/tags/$VERSION/ $JQUERY_DIR
27
+ case "$VERSION" in
28
+ "1.3.2")
29
+ rm -rf "$JQUERY_DIR/test/qunit"
30
+ svn export -r6173 http://jqueryjs.googlecode.com/svn/trunk/qunit $JQUERY_DIR/test/qunit
31
+ ;;
32
+ "1.3.1")
33
+ rm -rf "$JQUERY_DIR/test/qunit"
34
+ svn export -r6133 http://jqueryjs.googlecode.com/svn/trunk/qunit $JQUERY_DIR/test/qunit
35
+ ;;
36
+ esac
37
+ fi
38
+
39
+ cp dist/env.rhino.js $JQUERY_DIR/build/runtest/env.js
40
+ cp dist/env-js.jar $JQUERY_DIR/build/js.jar
41
+ cp bin/jquery-$VERSION-test.js $JQUERY_DIR/build/runtest/test.js
42
+
43
+ if [ $DEBUG -eq 1 ]; then
44
+ echo 'enabling rhino debugger'
45
+ perl -pi~ -e "s/^JAR(.*)(-jar.*|-cp.*)/JAR\1 -cp \\$\{BUILD_DIR}\/js.jar org.mozilla.javascript.tools.debugger.Main/" $JQUERY_DIR/Makefile;
46
+ else
47
+ if [ "x$JOHNSON" == "x " ]; then
48
+ echo 'running with rhino'
49
+ perl -pi~ -e "s/^JAR(.*)(-jar.*|-cp.*)/JAR\1 -cp \\$\{BUILD_DIR}\/js.jar org.mozilla.javascript.tools.envjs.Main/" $JQUERY_DIR/Makefile;
50
+ else
51
+ echo 'running with johnson'
52
+ echo > $JQUERY_DIR/build/runtest/env.js
53
+ perl -pi~ -e "s/^JAR(.*)(-jar.*|-cp.*)/JAR = envjsrb/" $JQUERY_DIR/Makefile;
54
+ fi
55
+ fi
56
+
57
+ cd $JQUERY_DIR
58
+ make runtest
@@ -0,0 +1,54 @@
1
+ #!/bin/sh
2
+
3
+ # Usage: test-prototype.sh [version]
4
+ # Currently supported versions: 1.6.0.3
5
+ #
6
+ # This script will check out the Prototype development tree from Github if necessary,
7
+ # massage the testing scripts as necessary, copy our latest version of env.js into place,
8
+ # and then run the test scripts.
9
+
10
+
11
+ if [ -n "$2" ]; then
12
+ echo 'debug'
13
+ if [ -n "$2" ]; then VERSION="$2"; else VERSION="1.6.0.3"; fi
14
+ DEBUG=1
15
+ else
16
+ echo 'jquery'
17
+ if [ -n "$1" ]; then VERSION="$1"; else VERSION="1.6.0.3"; fi
18
+ DEBUG=0
19
+ fi
20
+
21
+ PROTOTYPE_DIR="test/vendor/Prototype/$VERSION";
22
+
23
+ ant concat
24
+
25
+ if [ ! -d "$PROTOTYPE_DIR" ]; then
26
+ git clone git://github.com/sstephenson/prototype.git $PROTOTYPE_DIR
27
+ # - prepares tests - #
28
+ cd $PROTOTYPE_DIR
29
+ git submodule init #allow prototype to discover test framework dependencies
30
+ git submodule update #load the dicovered dependencies
31
+ cd -
32
+ fi
33
+
34
+ #replace thier test html template erb (malformed html on purpose..really???)
35
+ cat bin/prototype_1.6.0.3_tmpl.txt > $PROTOTYPE_DIR/test/unit/templates/default.erb
36
+ sed 's/runner\.run/ /g' $PROTOTYPE_DIR/Rakefile > $PROTOTYPE_DIR/Rakefile
37
+ cd $PROTOTYPE_DIR
38
+ rake test
39
+ cd -
40
+
41
+ cp dist/env.rhino.js $PROTOTYPE_DIR/test/unit/tmp/env.js
42
+ cp dist/env-js.jar $PROTOTYPE_DIR/test/unit/tmp/env-js.jar
43
+ cp bin/prototype-$VERSION-test.js $PROTOTYPE_DIR/test/unit/tmp/test.js
44
+
45
+
46
+ cd $PROTOTYPE_DIR/test/unit/tmp
47
+ if [ $DEBUG -eq 1 ]; then
48
+ echo 'running with rhino debugger'
49
+ java -cp env-js.jar org.mozilla.javascript.tools.envjs.Main test.js;
50
+ else
51
+ echo 'running with rhino'
52
+ java -cp env-js.jar org.mozilla.javascript.tools.envjs.Main test.js;
53
+ fi
54
+
data/bin/tidy ADDED
Binary file