[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/libraries/bootstrap/js/eternicode-bootstrap-datepicker/tests/assets/ -> coverage.js (source)

   1  (function(){
   2      //we want this at global scope so outside callers can find it. In a more realistic implementation we
   3      //should probably put it in a namespace.
   4      window.getCoverageByLine = function(silent) {
   5          var key = null;
   6          var lines = null;
   7          var source = null;
   8          //look for code coverage data
   9          if (typeof window._$jscoverage === 'object') {
  10              for (key in _$jscoverage) {}
  11              lines = _$jscoverage[key];
  12          }
  13  
  14          if (!lines && !silent) {
  15             console.log('code coverage data is NOT available');
  16          }
  17  
  18          return { 'key': key, 'lines': lines };
  19      };
  20  
  21      QUnit.done = function(t) {
  22          var cvgInfo = getCoverageByLine(true);
  23          if (!!cvgInfo.key) {
  24              var testableLines = 0;
  25              var testedLines = 0;
  26              var untestableLines = 0;
  27              for (lineIdx in cvgInfo.lines) {
  28                  var cvg = cvgInfo.lines[lineIdx];
  29                  if (typeof cvg === 'number') {
  30                      testableLines += 1;
  31                      if (cvg > 0) {
  32                          testedLines += 1;
  33                      }
  34                  } else {
  35                      untestableLines += 1;
  36                  }
  37              }
  38              var coverage = '' + Math.floor(100 * testedLines / testableLines) + '%';
  39  
  40              var result = document.getElementById('qunit-testresult');
  41              if (result != null) {
  42                  result.innerHTML = result.innerHTML + ' ' + coverage + ' test coverage of ' + cvgInfo.key;
  43              } else {
  44                  console.log('can\'t find test-result element to update');
  45              }
  46          }
  47      };
  48  }());


Generated: Fri Nov 28 20:08:37 2014 Cross-referenced by PHPXref 0.7.1