Home | History | Annotate | Download | only in patches
      1 diff --git third_party/blanketjs/src/qunit_adapter.js third_party/blanketjs/src/qunit_adapter.js
      2 index 3d5b768..a1fb769 100644
      3 --- third_party/blanketjs/src/qunit_adapter.js
      4 +++ third_party/blanketjs/src/qunit_adapter.js
      5 @@ -1,17 +1,23 @@
      6  (function(){
      7  if (typeof QUnit !== 'undefined'){
      8 +    var QUnitAutostart = (QUnit.config.autostart === undefined) ? true : QUnit.config.autostart;
      9 +
     10      //check to make sure requirejs is completed before we start the test runner
     11      var allLoaded = function() {
     12          return window.QUnit.config.queue.length > 0 && blanket.noConflict().requireFilesLoaded();
     13      };
     14  
     15 +    function shouldAutoStart() {
     16 +        return !(blanket.options("existingRequireJS") && !blanket.options("autoStart")) && QUnitAutostart;
     17 +    }
     18 +
     19      if (!QUnit.config.urlConfig[0].tooltip){
     20          //older versions we run coverage automatically
     21          //and we change how events are binded
     22          QUnit.begin=function(){
     23              blanket.noConflict().setupCoverage();
     24          };
     25 -        
     26 +
     27          QUnit.done=function(failures, total) {
     28              blanket.noConflict().onTestsDone();
     29          };
     30 @@ -34,12 +40,13 @@ if (typeof QUnit !== 'undefined'){
     31              label: "Enable coverage",
     32              tooltip: "Enable code coverage."
     33          });
     34 -    
     35 +
     36          if ( QUnit.urlParams.coverage || blanket.options("autoStart") ) {
     37 +            QUnit.config.autostart = false;
     38              QUnit.begin(function(){
     39                  blanket.noConflict().setupCoverage();
     40              });
     41 -            
     42 +
     43              QUnit.done(function(failures, total) {
     44                  blanket.noConflict().onTestsDone();
     45              });
     46 @@ -55,22 +62,11 @@ if (typeof QUnit !== 'undefined'){
     47              blanket.noConflict().beforeStartTestRunner({
     48                  condition: allLoaded,
     49                  callback: function(){
     50 -                    if (!(blanket.options("existingRequireJS") && !blanket.options("autoStart"))){
     51 +                    if (shouldAutoStart()){
     52                          QUnit.start();
     53                      }
     54                  }
     55              });
     56 -        }else{
     57 -            if (blanket.options("existingRequireJS")){ requirejs.load = _blanket.utils.oldloader; }
     58 -            blanket.noConflict().beforeStartTestRunner({
     59 -                condition: allLoaded,
     60 -                callback: function(){
     61 -                    if (!(blanket.options("existingRequireJS") && !blanket.options("autoStart"))){
     62 -                        QUnit.start();
     63 -                    }
     64 -                },
     65 -                coverage:false
     66 -            });
     67          }
     68      }
     69  }
     70