edit this page - page history - about editing

Integration Testing with EmberJS and JQuery

EmberJS / JQuery

We use mocha and chai and sinon and sinon-chai for testing our EmberJS applications.

If you have functionality that needs to be tested by changing form elements directly (e.g. $(".class").val('hello')) but requires asynchronous behaviour, such as updating the underlying Ember model, you can use andThen(function) to chain these asynchronous events:

describe 'interface', ->

  it 'can change the underlying model', (done) ->
    @timeout 5e3    # set timeout to 5s

    # visit the application root
    visit '/'
    Ember.run ->

      # defaults

      # now change
      $(".time-type").change()  # trigger on('change'), this will update model.date-input

      andThen ->
        # should now have changed


Categories: Javascript | Testing | EmberJS
edit this page - what links to here? - page history - top
Last edited by jevon jevon 60 months ago