Skip to content

Instantly share code, notes, and snippets.

@cjolly
Created December 16, 2011 19:55
Show Gist options
  • Save cjolly/1487668 to your computer and use it in GitHub Desktop.
Save cjolly/1487668 to your computer and use it in GitHub Desktop.
Toolin around with try-jasmine.heroku.com
$("#edit").live "click", ->
$('.editable').each (i, el) ->
input = $('<input/>',
id: $(el).attr('id') + '_field'
value: $(el).text()
)
$(el).append(input)
describe "pressing the edit button", ->
container = undefined
button = undefined
beforeEach ->
@$container = inject('my-form')
@$editable_div = @$container.inject(
el: 'div'
class: 'editable',
id: 'full_name'
text: 'Rick Pulaski'
)
@$button = inject(
el: 'button'
id: "edit"
)
it "switches editable fields to inputs with value in field", ->
$("#edit").click()
expect($("#full_name_field").val()).toEqual "Rick Pulaski"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment