This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
| name | age | message | |
|---|---|---|---|
| |
.gitignore | Thu Apr 17 06:16:36 -0700 2008 | [osteele] |
| |
MIT-LICENSE | Mon Apr 07 05:57:16 -0700 2008 | [osteele] |
| |
README | Thu Apr 17 19:13:08 -0700 2008 | [osteele] |
| |
Rakefile | Thu Apr 17 04:48:13 -0700 2008 | [osteele] |
| |
TODO | Mon Apr 14 07:07:03 -0700 2008 | [osteele] |
| |
init.rb | Mon Apr 14 18:08:47 -0700 2008 | [osteele] |
| |
lib/ | Mon Apr 14 18:54:11 -0700 2008 | [osteele] |
| |
spec/ | Thu Apr 17 06:16:36 -0700 2008 | [osteele] |
| |
tasks/ | Mon Apr 07 05:57:16 -0700 2008 | [osteele] |
README
= JavaScript Fu Rails Plugin
This plugin adds helpers, rake tasks, and rspec matchers for JavaScript
development.
== Installation
git clone git://github.com/osteele/javascript_fu.git vendor/plugins/javascript_fu
== Extended Rake Tasks
The existing +notes+ and +statistics+ tasks are extended to compass
the public/javascript directory:
rake statistics
rake notes
== New View Helper
The new +onload+ generator method generates code that executes the content
of the block upon the completion of page load.
page.onload do
page.call alert', 'page loaded!'
end
generates
Event.observe("window", "load", function() { alert("page loaded!"); });
or
$(document).ready(function() { alert("page loaded!"); });
== New RSpec Matcher
Use these in your specs to verify that a view is calling a JavaScript
function:
response.should call_js('fn')
response.should call_js('fn(true)')
response.should call_js('gApp.setup')
If there is a body, the arguments to the call are parsed (as JSON) and
passed to it:
# response includes <script>...fn('string', 2)...</script>
response.should call_js(fn') do |args|
args.should == ['string', 2]
end
If the "JCON"[http://jcon.rubyforge.org/] gem is installed, you can
use this to test arguments values against ECMAScript 4.0 types:
'<script>fn("id", {x:1, y:2}, true)</script>'.should call_js('fn') do |args|
args[0].should conform_to_js('string')
args[1].should conform_to_js('{x:int, y:int}')
args[2].should conform_to_js('boolean')
# or:
args.should conform_to_js('[string, {x:int, y:int}, boolean]')
end
= License
Copyright 2008 by {Oliver Steele}[http://workingwithrails.com/person/12359-oliver-steele]. All rights reserved.
Released under the MIT License.




