qunit-boilerplate.js 624 B

12345678910111213141516171819202122232425262728
  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. m.deps(window.mock());
  9. wrappedBeforeEach();
  10. };
  11. var wrappedAfterEach = conf.afterEach;
  12. conf.afterEach = function(assert) {
  13. var cleaned = assert.async();
  14. wrappedAfterEach();
  15. document.title = title;
  16. $.mockjax.clear();
  17. window.onCleanUp(function() {
  18. cleaned();
  19. });
  20. };
  21. QUnit.module('Acceptance: ' + name, conf);
  22. };
  23. }());