Skip to content

Instantly share code, notes, and snippets.

@kyeh
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kyeh/c929a9e08ec3e8125897 to your computer and use it in GitHub Desktop.
Save kyeh/c929a9e08ec3e8125897 to your computer and use it in GitHub Desktop.
test("Using the deferred to trigger done for success status", function() {
// ...
submitCancel();
QUnit.equal($('#cancel-status').text(), '');
// resolving the deferred with an object with the status
deferred.resolve({status: "success"});
QUnit.equal($('#cancel-status').text(), 'cancel status: cancel finished');
});
test("Using the deferred to trigger done for not-found status", function() {
// ...
submitCancel();
QUnit.equal($('#cancel-status').text(), '');
// resolving the deferred again with a different status
deferred.resolve({status: "cancel postponed"});
QUnit.equal($('#cancel-status').text(), 'cancel status: cancel postponed');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment