Skip to content

Commit

Permalink
Test checkbox with images
Browse files Browse the repository at this point in the history
  • Loading branch information
guigs committed Dec 31, 2012
1 parent aeba662 commit c668e6d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
16 changes: 16 additions & 0 deletions spec/integration/js_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,22 @@
end
end

it "should be able to use bip_bool to change a boolean value using an image" do
@user.save!
visit user_path(@user)

within("#receive_email_image") do
page.should have_xpath("//img[contains(@src,'no.png')]")
end

bip_bool @user, :receive_email

visit user_path(@user)
within("#receive_email_image") do
page.should have_xpath("//img[contains(@src,'yes.png')]")
end
end

it "should correctly use an OK submit button when so configured for an input" do
@user.save!
visit user_path(@user)
Expand Down
Binary file added test_app/app/assets/images/no.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test_app/app/assets/images/yes.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions test_app/app/views/users/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@
<%= best_in_place @user, :receive_email, :type => :checkbox, :collection => ["No thanks", "Yes of course"] %>
</td>
</tr>
<tr>
<td>Receive newsletter (image)?</td>
<td id="receive_email_image">
<%= best_in_place @user, :receive_email, :type => :checkbox, :collection => [image_tag('no.png'), image_tag('yes.png')] %>
</td>
</tr>
<tr>
<td>Favorite color</td>
<td id="favorite_color">
Expand Down

0 comments on commit c668e6d

Please sign in to comment.