Skip to content

Commit

Permalink
Merge pull request #15065 from emberjs/guard-jquery-access
Browse files Browse the repository at this point in the history
[BUGFIX beta] Guard jQuery access in `setupForTesting`.
  • Loading branch information
rwjblue authored Mar 24, 2017
2 parents ef6cb33 + 88c5bab commit 5506aba
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/ember-testing/lib/setup_for_testing.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,13 @@ export default function setupForTesting() {
setAdapter((typeof self.QUnit === 'undefined') ? new Adapter() : new QUnitAdapter());
}

jQuery(document).off('ajaxSend', incrementPendingRequests);
jQuery(document).off('ajaxComplete', decrementPendingRequests);
if (jQuery) {
jQuery(document).off('ajaxSend', incrementPendingRequests);
jQuery(document).off('ajaxComplete', decrementPendingRequests);

clearPendingRequests();
clearPendingRequests();

jQuery(document).on('ajaxSend', incrementPendingRequests);
jQuery(document).on('ajaxComplete', decrementPendingRequests);
jQuery(document).on('ajaxSend', incrementPendingRequests);
jQuery(document).on('ajaxComplete', decrementPendingRequests);
}
}

0 comments on commit 5506aba

Please sign in to comment.