The test output is:
1)
ArgumentError in 'Field Requirements should populate options by onload'
wrong number of arguments (1 for 0)
/Library/Ruby/Gems/1.8/gems/johnson-1.1.2/lib/johnson/spidermonkey/runtime.rb:36:in
`method'
/Library/Ruby/Gems/1.8/gems/johnson-1.1.2/lib/johnson/spidermonkey/runtime.rb:36:in
`evaluate_compiled_script_without_clearing_traps'
/Library/Ruby/Gems/1.8/gems/johnson-1.1.2/lib/johnson/spidermonkey/runtime.rb:36:in
`evaluate_compiled_script'
/Library/Ruby/Gems/1.8/gems/johnson-1.1.2/lib/johnson/runtime.rb:73:in
`evaluate'
/Users/edh/Sites/nce/spec/js_spec.rb:25:
/Users/edh/Sites/nce/spec/js_spec.rb:8:in `open'
/Users/edh/Sites/nce/spec/js_spec.rb:8:
This is in a setup method that loads jquery.js.
specifically:
js = ''
File.open('jquery.js') do |app|
js = app.read
end
@rt.evaluate(js)
Without this code, the rest of my tests pass.
Thanks,
Ed
--
Ed Howland
http://greenprogrammer.wordpress.com
http://twitter.com/ed_howland
jQuery is going to need browser-environment support for things like the DOM, events, and timers. Pure javascript, and Johnson by extension, doesn't provide that. Aaron and others were working on Taka to provide at least some of that. I use env.js, a (mostly) pure JS implementation of the browser environment, originally written by John Resig. My env.js fork (default envjsrb branch) has env.js ported to my fork of Johnson. Env.js uses jQuery and the jQuery test suite as one of its test suites. It passes around 1400 of the jQuery 1.3.2 tests, failing about 100 of them (if I remember correctly).
Thanks. I am using Taka. But my limited test just di an evaluate of
the loaded jquery.js file. No functions were called in it. So it made
me wonder if there was a frozen version you were using.
re: Env.js: ....
On Wed, Dec 30, 2009 at 2:48 PM, Steven Parkes <smpa...@smparkes.net> wrote:
> jQuery is going to need browser-environment support for things like the DOM, events, and timers. Pure javascript, and Johnson by extension, doesn't provide that. Aaron and others were working on Taka to provide at least some of that. I use env.js, a (mostly) pure JS implementation of the browser environment, originally written by John Resig. My env.js fork (default envjsrb branch) has env.js ported to my fork of Johnson. Env.js uses jQuery and the jQuery test suite as one of its test suites. It passes around 1400 of the jQuery 1.3.2 tests, failing about 100 of them (if I remember correctly).
... so possibly loading 'env.js' before 'jquery.js' might do the trick
on my limited test?
Also, wrt to your fork of johnson, "require('smparkes-johnson')" fails
to find it after the gem has been instslled. Do I need to uninstall
rejular Johnson?
Ed
I leave that to Aaron et al. Don't know much about it.
> But my limited test just di an evaluate of
> the loaded jquery.js file. No functions were called in it. So it made
> me wonder if there was a frozen version you were using.
My stuff is based off current jbarnette/johnson:master. I haven't tried to load jQuery with anything except env.js, so I don't exactly know what to expect. All depends on how the jQuery code is written to detect the DOM, since it's doing feature detection, etc., and the results will depend on how much of the DOM/browser-environment Taka etc. provide.
> ... so possibly loading 'env.js' before 'jquery.js' might do the trick
> on my limited test?
You need to load my env.js, then at the end of the script, you need to do an Envjs.wait() to pass control to the event loop. But you also have to make sure you get the tracemonkey runtime, not the spidermonkey runtime.
The envjsrb command that comes with my env.js fork does all this. Then you can just say "envjsrb foo.js" or "envjsrb foo.html" and it should do "the right thing". Or you can use it interactively as a replacement for johnson but with env.js preloaded and defaulting to tracemonkey.
I do a lot of testing with johnson/env.js. You might want to look at smparkes-jazrb, which pulls together my testing stuff. It was originally based on the Jasmine JS BDD package but I added support for qunit, too, so it's not Jasmine-specific. It knows how to put together envjsrb commands with the necessary JS before and after to run tests and pull out results. Among other things, it knows how to run multiple HTML fixtures in one command, reseting things in-between.
> Also, wrt to your fork of johnson, "require('smparkes-johnson')" fails
> to find it after the gem has been instslled. Do I need to uninstall
> rejular Johnson?
Yeah, as I understand it, with the new gemcutter stuff, gem namespacing doesn't' work like it did on github. In other words, you require johnson, not smparkes-johnson, and if you have multiple versions, they'll conflict. Kinda a pain. I heard they were thinking about how to handle this, but I don't know if it was ever resolved. So for now, you'd have to uninstall the main johnson gem. My fork is supposed to be 100% backwards compatible with jbarnette, including getting the classic spidermonkey runtime by default.
> Also, Steven, your fork "(default envjsrb branch)" seems to be a
> conflict list of the original. I used your dist/env.js and there were
> lot's <<<<< HEAD/===== lines in it.
I'm not maintaining that file in my branch. It's only used in the Java version and my fork is only used for the the Ruby version. (Getting the two forks merged back together is in progress.) The env.js file that envjsrb uses is created in lib/envjs/env.js by the gem install process.
I'd recommend using the envjsrb command instead of the johnson command if you want to use Johnson with env.js.