Skip to content

Commit

Permalink
bug fix for case when update return an error
Browse files Browse the repository at this point in the history
  • Loading branch information
sandeepr-sourcebits committed May 16, 2012
1 parent c7f47c7 commit ffdecba
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/assets/javascripts/best_in_place.js
Expand Up @@ -42,7 +42,7 @@ BestInPlaceEditor.prototype = {
to_display = this.element.html();
}

var elem = this.isNil ? "" : this.element.html();
var elem = this.isNil ? "-" : this.element.html();
this.oldValue = elem;
this.display_value = to_display;
jQuery(this.activator).unbind("click", this.clickHandler);
Expand Down
12 changes: 12 additions & 0 deletions spec/integration/js_spec.rb
Expand Up @@ -41,6 +41,18 @@
end
end

it "should render the default '-' string when there is an error and if the intial string is '-'" do
@user.money = nil
@user.save!
visit user_path(@user)

bip_text @user, :money, "abcd"

within("#money") do
page.should have_content("-")
end
end

it "should render the passed nil value if the field is empty" do
@user.last_name = ""
@user.save :validate => false
Expand Down

0 comments on commit ffdecba

Please sign in to comment.