Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overriden fake ajax should return a jQuery Deferred object #7

Open
craigspaeth opened this issue Dec 12, 2011 · 2 comments
Open

Overriden fake ajax should return a jQuery Deferred object #7

craigspaeth opened this issue Dec 12, 2011 · 2 comments

Comments

@craigspaeth
Copy link

I need to assert something after a fail handler that depends on $.ajax returning a jQuery Deferred (or jqXHR) object.

e.g. Running a test like this:

it 'will stay the same after an error', ->
  $.getJSON('foo/bar').fail ->
    expect(foo.id).toEqual 'foo'

Will throw Cannot call method 'fail' of undefined

Mocking a jqXHR object would allow these callbacks to still work.

(Great project btw)

@mileskin
Copy link
Owner

Hi Craig and sorry for the late answer. Deferreds should definitely be supported, but I probably don't have time to add it myself in the near future. I would be more than happy to merge pull requests if: 1. no existing stuff is borken 2. regression tests are in place 3. current style is used (4. solution is as low-maintenance / long-term usable as possible). You want to give it a try? Anyways it's the top item in the backlog currently.

Btw nice CoffeeScript :-)

@craigspaeth
Copy link
Author

Cool. I'll try to send you a pull request when I get the chance :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants