envjs 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. data/README +113 -0
  2. data/bin/envjsrb +239 -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 +106 -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 +21549 -0
  12. data/lib/envjs/net/cgi.rb +94 -0
  13. data/lib/envjs/net/file.rb +75 -0
  14. data/lib/envjs/net.rb +3 -0
  15. data/lib/envjs/options.rb +11 -0
  16. data/lib/envjs/runtime.rb +280 -0
  17. data/lib/envjs/tempfile.rb +24 -0
  18. data/lib/envjs.rb +23 -0
  19. data/test/call-load-test.js +15 -0
  20. data/test/debug.js +53 -0
  21. data/test/firebug/errorIcon.png +0 -0
  22. data/test/firebug/firebug.css +209 -0
  23. data/test/firebug/firebug.html +23 -0
  24. data/test/firebug/firebug.js +672 -0
  25. data/test/firebug/firebugx.js +10 -0
  26. data/test/firebug/infoIcon.png +0 -0
  27. data/test/firebug/warningIcon.png +0 -0
  28. data/test/fixtures/html/events.html +171 -0
  29. data/test/fixtures/html/iframe1.html +46 -0
  30. data/test/fixtures/html/iframe1a.html +46 -0
  31. data/test/fixtures/html/iframe2.html +45 -0
  32. data/test/fixtures/html/iframe3.html +28 -0
  33. data/test/fixtures/html/iframeN.html +57 -0
  34. data/test/fixtures/html/malformed.html +181 -0
  35. data/test/fixtures/html/scope.html +81 -0
  36. data/test/fixtures/html/trivial.html +19 -0
  37. data/test/fixtures/html/with_js.html +26 -0
  38. data/test/fixtures/images/icon-blue.png +0 -0
  39. data/test/fixtures/js/external_script.js +1 -0
  40. data/test/fixtures/js/script.js +1 -0
  41. data/test/fixtures/js/script_error.js +2 -0
  42. data/test/html/events.html +171 -0
  43. data/test/html/iframe1.html +46 -0
  44. data/test/html/iframe1a.html +46 -0
  45. data/test/html/iframe2.html +45 -0
  46. data/test/html/iframe3.html +30 -0
  47. data/test/html/iframeN.html +57 -0
  48. data/test/html/malformed.html +181 -0
  49. data/test/html/scope.html +87 -0
  50. data/test/html/script.js +1 -0
  51. data/test/html/trivial.html +19 -0
  52. data/test/html/with_js.html +26 -0
  53. data/test/index.html +328 -0
  54. data/test/java-prototype.js +9 -0
  55. data/test/primary-tests.js +24 -0
  56. data/test/prototype-test.js +13 -0
  57. data/test/qunit/qunit/qunit.css +17 -0
  58. data/test/qunit/qunit/qunit.js +997 -0
  59. data/test/qunit.js +61 -0
  60. data/test/specs/dist/env.spec.js +1534 -0
  61. data/test/specs/envjs.spec.css +46 -0
  62. data/test/specs/parser/html.js +31 -0
  63. data/test/specs/parser/spec.html +40 -0
  64. data/test/specs/parser/xml.js +31 -0
  65. data/test/specs/qunit.bdd.js +210 -0
  66. data/test/specs/qunit.css +17 -0
  67. data/test/specs/qunit.js +997 -0
  68. data/test/specs/template/spec-0.js +31 -0
  69. data/test/specs/template/spec-1.js +31 -0
  70. data/test/specs/template/spec.html +40 -0
  71. data/test/specs/window/css.js +23 -0
  72. data/test/specs/window/dialog.js +25 -0
  73. data/test/specs/window/document.js +23 -0
  74. data/test/specs/window/event.js +25 -0
  75. data/test/specs/window/history.js +34 -0
  76. data/test/specs/window/location.js +34 -0
  77. data/test/specs/window/navigator.js +71 -0
  78. data/test/specs/window/screen.js +42 -0
  79. data/test/specs/window/spec.html +48 -0
  80. data/test/specs/window/timer.js +26 -0
  81. data/test/specs/window/window.js +53 -0
  82. data/test/specs/xhr/spec.html +47 -0
  83. data/test/specs/xhr/xhr.js +31 -0
  84. data/test/test.js +10 -0
  85. data/test/unit/dom.js +44 -0
  86. data/test/unit/elementmembers.js +60 -0
  87. data/test/unit/events.js +195 -0
  88. data/test/unit/fixtures/external_script.js +1 -0
  89. data/test/unit/iframe.js +234 -0
  90. data/test/unit/multi-window.js +212 -0
  91. data/test/unit/nu.validator.js +34 -0
  92. data/test/unit/onload.js +90 -0
  93. data/test/unit/parser.js +121 -0
  94. data/test/unit/prototypecompat.js +22 -0
  95. data/test/unit/proxy.js +6 -0
  96. data/test/unit/scope.js +209 -0
  97. data/test/unit/timer.js +115 -0
  98. data/test/unit/window.js +41 -0
  99. data/test/vendor/jQuery/README +2 -0
  100. data/test/vendor/prototype-1.6.0.3.js +4320 -0
  101. metadata +164 -0
data/README ADDED
@@ -0,0 +1,113 @@
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
+ Envjs("some/file.html");
61
+ or
62
+ var someWindow = window.open("some/file.html");
63
+ or
64
+ window.location = "some/file.html";
65
+
66
+ Optionally you can turn on/off settings by passing an options object:
67
+ Envjs("some/file.html", {log: function(msg){ console.debug(msg) }});
68
+
69
+ 3) Optionally trigger "document ready" events in one of these ways:
70
+
71
+ 4) Start processing of window(s)' event queue:
72
+ Envjs.wait();
73
+
74
+ All together, the steps could be:
75
+
76
+ a) simplest method:
77
+ load('env.rhino.js');
78
+ Envjs("some/file.html");
79
+ Envjs.wait();
80
+
81
+ b) jQuery ready method:
82
+ load('env.rhino.js');
83
+ load('jquery-1.3.2.js');
84
+ Envjs("some/file.html");
85
+ load('some-code-that-sets-up-jquery-onready-behaviors.js')
86
+ jQuery.ready();
87
+ Envjs.wait();
88
+
89
+ c) Other JavaScript frameworks have their own methods of setup, but the general pattern is:
90
+ // step 1: load env.js
91
+ // optionally: load your framework(s)
92
+ // step 2: tell env.js the base DOM to model
93
+ // optionally: run any setup code for your framework(s0
94
+ // step 3: tell the framework that the document is loaded
95
+ // step 4: Envjs.wait();
96
+
97
+ Note that env.js is currently limited to loading a single HTML page
98
+ from the original window. If you are going to load multiple pages in
99
+ succession into the same window, load the first into a new window
100
+ object using window.open().
101
+
102
+ Testing jQuery Compatibility:
103
+ * run ./bin/test-jquery.sh 1.3.2
104
+ * run ./bin/test-jquery.sh 1.3.1
105
+ * run ./bin/test-jquery.sh 1.2.6
106
+ * Checks out the given jQuery tag from Subversion into test/vendor/jQuery/[version],
107
+ moves dist/env.rhino.js into the correct location in their tree, and runs the test suites.
108
+
109
+ Changes with new timer code:
110
+
111
+ Previously with envjs, you could call Java's thread sleep() method to delay execution. This was mostly used in test suites. This may no
112
+ longer work the same since it will inhibit all events from firing. You can now use the Envjs.wait(milliseconds) call to achieve an
113
+ effect similar to calling sleep().
data/bin/envjsrb ADDED
@@ -0,0 +1,239 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'pathname'
5
+
6
+ require 'envjs/options'
7
+
8
+ require 'johnson/tracemonkey'
9
+ require 'johnson/cli'
10
+ require 'envjs/runtime'
11
+
12
+ RUNTIME = js = Johnson::Runtime.new
13
+ RUNTIME.extend Envjs::Runtime
14
+
15
+ RUNTIME.load Envjs::ENVJS
16
+
17
+ EXIT_VERBS = [nil] + %w(exit quit)
18
+
19
+ prepped = false
20
+ ruby_readline = []
21
+ js_readline = []
22
+ local_binding = binding
23
+ mode = nil
24
+
25
+ (class<<self; self; end).send :define_method, :prep do
26
+
27
+ return if prepped
28
+ prepped = true
29
+
30
+ require "readline"
31
+ require "johnson/cli"
32
+
33
+ RUNTIME.evaluate(Johnson::CLI::JS)
34
+
35
+ def copy_history
36
+ new_history = []
37
+ until Readline::HISTORY.empty?
38
+ new_history.push(Readline::HISTORY.pop)
39
+ end
40
+ new_history
41
+ end
42
+
43
+ def paste_history(old_history)
44
+ until old_history.empty?
45
+ Readline::HISTORY << old_history.pop
46
+ end
47
+ end
48
+
49
+ def handle_exit(input)
50
+ return EXIT_VERBS.include?(input)
51
+ end
52
+
53
+ def rescued(&block)
54
+ yield
55
+ rescue Exception => e
56
+ exit if SystemExit === e
57
+
58
+ puts e.message
59
+ puts e.backtrace.reject { |l| l =~ /bin\/johnson/ }
60
+ end
61
+
62
+ def eval_in_js(expression,stream)
63
+ rescued do
64
+ v = RUNTIME.evaluate(expression, "(console)")
65
+ stream.result { "=> " + v.inspect }
66
+ end
67
+ end
68
+
69
+ def eval_in_ruby(expression, bind_to, stream)
70
+ rescued do
71
+ v = eval(expression, bind_to)
72
+ stream.result { "=> " + v.inspect }
73
+ end
74
+ end
75
+
76
+ (class<<self; self; end).send :define_method, :do_loop do |stream|
77
+ # def foo
78
+
79
+ catch "Breakout" do
80
+ loop do
81
+ mode = :js
82
+ input = stream.next("js> ")
83
+ input and input.chomp!
84
+ begin stream.exit(input); throw "Breakout" end if handle_exit(input)
85
+
86
+ if input =~ /^rb\s+(.+)$/
87
+ eval_in_ruby($1, local_binding, stream)
88
+ next
89
+ end
90
+
91
+ if input == "rb"
92
+ js_readline = copy_history
93
+ paste_history(ruby_readline)
94
+
95
+ loop do
96
+ mode = :rb
97
+ # input = Readline.readline("rb> ", true)
98
+ input = stream.next("rb> ")
99
+ begin stream.exit(input); throw "Breakout" end if handle_exit(input)
100
+
101
+ break if input == "js"
102
+
103
+ if input =~ /^js\s+(.+)$/
104
+ eval_in_js($1)
105
+ next
106
+ end
107
+
108
+ eval_in_ruby(input, local_binding, stream)
109
+ end
110
+
111
+ ruby_readline = copy_history
112
+ paste_history(js_readline)
113
+ next
114
+ end
115
+
116
+ eval_in_js(input, stream)
117
+ end
118
+ end
119
+ end
120
+ end
121
+
122
+ if ARGV.length > 0
123
+
124
+ begin
125
+ about_blank = true
126
+ ARGV.each do |file|
127
+ if file == "about:blank"
128
+ RUNTIME.wait
129
+ RUNTIME.evaluate("window.location = 'about:blank'", "(comand line)", 1)
130
+ about_blank = true
131
+ elsif file =~ /\.x?html?$/ || file =~ %r(^https?://)
132
+ # this might want to go alway; jazrb does it manually now, which I think was the use case
133
+ # that wanted this
134
+ if !about_blank
135
+ RUNTIME.wait
136
+ RUNTIME.evaluate("window.location = 'about:blank'", "(comand line)", 1)
137
+ end
138
+ RUNTIME.wait
139
+ RUNTIME.evaluate("window.location = 'file://#{Pathname.new(file).realpath}'", file, 1)
140
+ about_blank = false
141
+ else
142
+ RUNTIME.become_first_script_window
143
+ RUNTIME.top_level_load file
144
+ RUNTIME.load file
145
+ end
146
+ end
147
+ rescue Johnson::Error => je
148
+ if je.message.match /<SystemExit: exit>/
149
+ exit
150
+ end
151
+ raise je
152
+ end
153
+
154
+ RUNTIME.wait
155
+
156
+ else
157
+
158
+ prep
159
+
160
+ if !(files = Dir[".envjsrbrc",File.join(ENV["HOME"],".envjsrbrc")]).empty?
161
+ file = Class.new do
162
+ def initialize f
163
+ @file = open f
164
+ end
165
+ def next prompt
166
+ @file.gets
167
+ end
168
+ def result &block
169
+ end
170
+ def exit v; end
171
+ end.new files[0]
172
+
173
+ do_loop file
174
+ end
175
+
176
+ options = Johnson::CLI::Options.parse!(ARGV)
177
+
178
+ options.load_paths.each { |d| $LOAD_PATH << d }
179
+ options.paths_to_require.each { |p| RUNTIME.evaluate("Johnson.require('#{p}')") }
180
+ options.files_to_preload.each { |f| RUNTIME.load(f) }
181
+
182
+ unless options.expressions.empty?
183
+ options.expressions.each { |e| RUNTIME.evaluate(e, '-e') }
184
+ exit if options.files_to_evaluate.empty?
185
+ end
186
+
187
+ unless options.files_to_evaluate.empty?
188
+ RUNTIME[:arguments] = options.arguments
189
+
190
+ options.files_to_evaluate.each do |file|
191
+ RUNTIME.load(file)
192
+ end
193
+
194
+ exit
195
+ end
196
+
197
+ reader = Class.new do
198
+ def next prompt
199
+ Readline.readline(prompt, true)
200
+ end
201
+ def result
202
+ puts yield
203
+ end
204
+ def exit v; puts if v.nil?; end
205
+ end.new
206
+
207
+ begin
208
+ open(File.join(ENV["HOME"],".envjsrb.js")) do |f|
209
+ js_readline = f.read.split("\n")
210
+ end
211
+ rescue; end
212
+
213
+ begin
214
+ open(File.join(ENV["HOME"],".envjsrb.ruby")) do |f|
215
+ ruby_readline = f.read.split("\n")
216
+ end
217
+ rescue; end
218
+
219
+ case mode
220
+ when :js; paste_history js_readline
221
+ when :rb; paste_history ruby_readline
222
+ end
223
+
224
+ do_loop reader
225
+
226
+ case mode
227
+ when :js; js_readline = copy_history
228
+ when :rb; ruby_readline = copy_history
229
+ end
230
+
231
+ open(File.join(ENV["HOME"],".envjsrb.js"),"w") do |f|
232
+ f.write js_readline[0..100].join("\n")+"\n"
233
+ end
234
+
235
+ open(File.join(ENV["HOME"],".envjsrb.ruby"),"w") do |f|
236
+ f.write ruby_readline[0..100].join("\n")+"\n"
237
+ end
238
+
239
+ 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,106 @@
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
+ /* $env.wait() */
54
+ }
55
+ };
56
+ start = function(){
57
+ if(isStopped === null || isStopped === true ){
58
+ $env.log('RESTARTING QUNIT');
59
+ isStopped = false;
60
+ if(config_timeout) {
61
+ clearTimeout(config_timeout);
62
+ config_timeout = undefined;
63
+ }
64
+ unsafeStart.call(this);
65
+ }
66
+ };
67
+ //we know some ajax calls will fail becuase
68
+ //we are not running against a running server
69
+ //for php files
70
+ var handleError = jQuery.handleError;
71
+ jQuery.handleError = function(){
72
+ ok(false, 'Ajax may have failed while running locally');
73
+ try{
74
+ handleError(arguments);
75
+ }catch(e){}
76
+ //allow tests to gracefully continue
77
+ start();
78
+ };
79
+ //allow unanticipated xhr error with no ajax.handleError
80
+ //callback (eg jQuery.getScript) to exit gracefully
81
+ $env.onInterrupt = function(){
82
+ $env.info('thread interupt: gracefully continuing test');
83
+ start();
84
+ };
85
+
86
+
87
+ $env.onScriptLoadError = function(script){
88
+ Envjs.error("failed to load script \n"+script.text);
89
+ ok(false, 'Ajax may have failed to load correct script while running locally');
90
+ //allow tests to gracefully continue
91
+ start();
92
+ };
93
+ }
94
+ }
95
+ });
96
+
97
+ })(Envjs);
98
+
99
+ Envjs.wait();
100
+
101
+ // Local Variables:
102
+ // espresso-indent-level:4
103
+ // c-basic-offset:4
104
+ // tab-width:4
105
+ // mode:auto-revert
106
+ // End:
@@ -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 -opt -1/" $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 -opt -1/" $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