Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

another fix for in-place edit

  • Loading branch information...
commit edb0863717a25e382f8a5679a64402c60ee00357 1 parent 6bc45e2
@dnagir dnagir authored
View
4 lib/assets/javascripts/knockout/bindings/inplace.js.coffee
@@ -36,7 +36,9 @@ ko.bindingHandlers.inplace =
e.preventDefault()
if editing element
updateValue element, valueAccessor
- toggle element, valueAccessor
+ showInput element, false, valueAccessor
+ else
+ toggle element, valueAccessor
update: (element, valueAccessor) ->
View
10 spec/javascripts/knockout/bindings/inplace_spec.js.coffee
@@ -41,6 +41,16 @@ describe "In-Place edit", ->
el.parent().find('.inline-button').click() # Done
expect( val() ).toBe 'updated'
+ it "should switch from Edit mode when the value has been changed", ->
+ val = ko.observable 'hiii'
+ el = inplacify val
+ button = el.parent().find('.inline-button')
+ button.click() # Editing (Done label)
+ el.val('bye')
+ button.click() # Showing -> (Edit label)
+ expect(button).toHaveText('Edit')
+ expect(el.parent().find('.editable-content')).toBeVisible()
+
it "should switch from Edit mode when nothing has been changed", ->
val = ko.observable 'hiii'
el = inplacify val
Please sign in to comment.
Something went wrong with that request. Please try again.