qunit-boilerplate.js 691 B

12345678910111213141516171819202122232425262728293031
  1. (function () {
  2. 'use strict';
  3. // Boilerplate QUnit acceptance test
  4. QUnit.acceptance = function(name, conf) {
  5. var title = document.title;
  6. var wrappedBeforeEach = conf.beforeEach;
  7. conf.beforeEach = function() {
  8. resetTestPromise();
  9. m.deps(window.mock());
  10. if (wrappedBeforeEach) {
  11. wrappedBeforeEach();
  12. }
  13. };
  14. var wrappedAfterEach = conf.afterEach;
  15. conf.afterEach = function(assert) {
  16. var cleaned = assert.async();
  17. wrappedAfterEach();
  18. document.title = title;
  19. $.mockjax.clear();
  20. window.onCleanUp(function() {
  21. cleaned();
  22. });
  23. };
  24. QUnit.module('Acceptance: ' + name, conf);
  25. };
  26. }());