0
@@ -76,7 +76,7 @@ class AssociatedFormHelperTest < Test::Unit::TestCase
0
should "infer the name of the current @object in fields_for" do
0
- assert_match "$(this).
up(".comment").remove()", @erbout
0
+ assert_match "$(this).
parent(".comment").remove()", @erbout
0
@@ -86,7 +86,7 @@ class AssociatedFormHelperTest < Test::Unit::TestCase
0
should "use the alternate selector" do
0
- assert_match "$(this).
up(".blah").remove()", @erbout
0
+ assert_match "$(this).
parent(".blah").remove()", @erbout
0
@@ -97,7 +97,7 @@ class AssociatedFormHelperTest < Test::Unit::TestCase
0
should "still infer the name of the current @object in fields_for, and create the function as usual" do
0
- assert_match "$(this).
up(".comment").remove()", @erbout
0
+ assert_match "$(this).
parent(".comment").remove()", @erbout
0
should "append the secondary function" do
0
@@ -119,7 +119,7 @@ class AssociatedFormHelperTest < Test::Unit::TestCase
0
should "use placeholders instead of numbers" do
0
- assert_match 'photo[comment_attributes][new][
#{number}]', @erbout
0
+ assert_match 'photo[comment_attributes][new][
${number}]', @erbout
0
@@ -141,12 +141,12 @@ class AssociatedFormHelperTest < Test::Unit::TestCase
0
should "insert into the bottom of the parent container by default" do
0
- assert_match "
Insertion.Bottom('comments'", @erbout
0
+ assert_match "
$('#comments'", @erbout
0
should "wrap the partial in a prototype template" do
0
- assert_match "new Template", @erbout
0
- assert_match "evaluate", @erbout
0
+ assert_match "$.template", @erbout
0
+ assert_match "{ number:", @erbout
0
should "name the variable correctly" do
0
@@ -160,7 +160,7 @@ class AssociatedFormHelperTest < Test::Unit::TestCase
0
should "produce the following link" do
0
# this is a way of testing the whole link
0
- <a class=\"something\" href=\"#\" onclick=\"if (typeof attribute_fu_comment_count == 'undefined') attribute_fu_comment_count = 0;
\nnew Insertion.Bottom('comments', new Template(null).evaluate({'number': --attribute_fu_comment_count})); return false;\">Add Comment</a>
0
+ <a class=\"something\" href=\"#\" onclick=\"if (typeof attribute_fu_comment_count == 'undefined') attribute_fu_comment_count = 0;
\n $('#comments').append($.template(null), { number: --attribute_fu_comment_count});; return false;\">Add Comment</a>
0
@@ -172,7 +172,7 @@ class AssociatedFormHelperTest < Test::Unit::TestCase
0
fields_for(:photo) do |f|
0
f.stubs(:render_associated_form).with(comment, :fields_for => {:javascript => true}, :partial => 'some_other_partial')
0
- _erbout.concat f.add_associated_link("Add Comment", comment, :container => '
something_comments', :partial => 'some_other_partial')
0
+ _erbout.concat f.add_associated_link("Add Comment", comment, :container => '
#something_comments', :partial => 'some_other_partial')
0
@@ -183,12 +183,12 @@ class AssociatedFormHelperTest < Test::Unit::TestCase
0
should "insert into the bottom of the container specified" do
0
- assert_match "
Insertion.Bottom('something_comments'", @erbout
0
+ assert_match "
$('#something_comments'", @erbout
0
should "wrap the partial in a prototype template" do
0
- assert_match "new Template", @erbout
0
- assert_match "evaluate", @erbout
0
+ assert_match "$.template", @erbout
0
+ assert_match "{ number:", @erbout
0
should "name the variable correctly" do
0
@@ -198,48 +198,47 @@ class AssociatedFormHelperTest < Test::Unit::TestCase
0
should "produce the following link" do
0
# this is a way of testing the whole link
0
- <a href=\"#\" onclick=\"if (typeof attribute_fu_comment_count == 'undefined') attribute_fu_comment_count = 0;
\nnew Insertion.Bottom('something_comments', new Template(null).evaluate({'number': --attribute_fu_comment_count})); return false;\">Add Comment</a>
0
+ <a href=\"#\" onclick=\"if (typeof attribute_fu_comment_count == 'undefined') attribute_fu_comment_count = 0;
\n $('#something_comments').append($.template(null), { number: --attribute_fu_comment_count});; return false;\">Add Comment</a>
0
- context "add associated link with expression parameter" do
0
- comment = @photo.comments.build
0
- fields_for(:photo) do |f|
0
- f.stubs(:render_associated_form).with(comment, :fields_for => {:javascript => true}, :partial => 'some_other_partial')
0
- _erbout.concat f.add_associated_link("Add Comment", comment, :expression => '$(this).up(".something_comments")', :partial => 'some_other_partial')
0
- should "create link" do
0
- assert_match ">Add Comment</a>", @erbout
0
- should "use the javascript expression provided instead of passing the ID in" do
0
- assert_match "Insertion.Bottom($(this).up(".something_comments")", @erbout
0
- should "wrap the partial in a prototype template" do
0
- assert_match "new Template", @erbout
0
- assert_match "evaluate", @erbout
0
- should "name the variable correctly" do
0
- assert_match "attribute_fu_comment_count", @erbout
0
- should "produce the following link" do
0
- # this is a way of testing the whole link
0
- <a href=\"#\" onclick=\"if (typeof attribute_fu_comment_count == 'undefined') attribute_fu_comment_count = 0;\nnew Insertion.Bottom($(this).up(".something_comments"), new Template(null).evaluate({'number': --attribute_fu_comment_count})); return false;\">Add Comment</a>
0
+ # context "add associated link with expression parameter" do
0
+ # comment = @photo.comments.build
0
+ # fields_for(:photo) do |f|
0
+ # f.stubs(:render_associated_form).with(comment, :fields_for => {:javascript => true}, :partial => 'some_other_partial')
0
+ # _erbout.concat f.add_associated_link("Add Comment", comment, :expression => '$(this).up(".something_comments")', :partial => 'some_other_partial')
0
+ # should "create link" do
0
+ # assert_match ">Add Comment</a>", @erbout
0
+ # should "use the javascript expression provided instead of passing the ID in" do
0
+ # assert_match "$.template($(this).up(".something_comments")", @erbout
0
+ # should "wrap the partial in a JQ template" do
0
+ # assert_match "$.template", @erbout
0
+ # should "name the variable correctly" do
0
+ # assert_match "attribute_fu_comment_count", @erbout
0
+ # should "produce the following link" do
0
+ # # this is a way of testing the whole link
0
+ # <a href=\"#\" onclick=\"if (typeof attribute_fu_comment_count == 'undefined') attribute_fu_comment_count = 0;\nnew Insertion.Bottom($(this).up(".something_comments"), new Template(null).evaluate({'number': --attribute_fu_comment_count})); return false;\">Add Comment</a>
0
context "render_associated_form" do
Comments
No one has commented yet.