Sha256: e6c04d53bbd65cc3031c4aef8a6dd6da797a89142b5fbea897919024a38ef6bf
Contents?: true
Size: 1.14 KB
Versions: 17
Compression:
Stored size: 1.14 KB
Contents
require File.expand_path("#{File.dirname(__FILE__)}/../spec_helper") describe Erector::JQuery do include Erector::Mixin describe "#jquery" do def expected(event, *args) "<script #{'id="foo" ' if args.include? :id}type=\"text/javascript\">\n" + "// <![CDATA[\n\n" + "jQuery(document).#{event}(function($){\n" + "alert('hello');\n});\n// ]]>\n</script>\n" end it "outputs a 'jquery ready' script block by default" do erector { jquery "alert('hello');" }.should == expected("ready") end it "outputs attributes" do erector { jquery "alert('hello');", :id => 'foo' }.should == expected("ready", :id) end it "outputs a 'jquery ready' script block when passed a symbol for the first arg" do erector { jquery :ready, "alert('hello');" }.should == expected("ready") end it "outputs a 'jquery load' script block" do erector { jquery :load, "alert('hello');" }.should == expected("load") end it "combines event, text, and attributes" do erector { jquery :load, "alert('hello');", :id => "foo" }.should == expected("load", :id) end end end
Version data entries
17 entries across 17 versions & 3 rubygems