ext_qunit.js 804 B

1234567891011121314151617181920212223242526272829303132333435
  1. /**
  2. * 重载QUnit部分接口实现批量执行控制功能
  3. */
  4. (function() {
  5. if (!QUnit)
  6. return;
  7. var ms = QUnit.moduleStart, d = QUnit.done;
  8. function _d(args /* failures, total */) {
  9. //默认展开失败用例
  10. $('li.fail ol').toggle();
  11. if (parent && parent.brtest) {
  12. parent.$(parent.brtest).trigger('done', [ new Date().getTime(), {
  13. failed : args[0],
  14. passed : args[1],
  15. detail:args[2]
  16. }, window._$jscoverage || null ]);
  17. }
  18. }
  19. QUnit.moduleStart = function() {
  20. stop();
  21. /* 为批量执行等待import.php正确返回 */
  22. var h = setInterval(function() {
  23. if (window && window['baidu']) {
  24. clearInterval(h);
  25. ms.apply(this, arguments);
  26. start();
  27. }
  28. }, 20);
  29. };
  30. QUnit.done = function() {
  31. _d(arguments);
  32. d.apply(this, arguments);
  33. };
  34. })();