Sha256: 66e6d8dc62a67743ed652f71125e93096e7035f6c2fd69850cd7effe624586b2

Contents?: true

Size: 1.62 KB

Versions: 26

Compression:

Stored size: 1.62 KB

Contents

(function(){
    //we want this at global scope so outside callers can find it. In a more realistic implementation we
    //should probably put it in a namespace.
    window.getCoverageByLine = function(silent) {
        var key = null;
        var lines = null;
        var source = null;
        //look for code coverage data
        if (typeof window._$jscoverage === 'object') {
            for (key in _$jscoverage) {}
            lines = _$jscoverage[key];
        }

        if (!lines && !silent) {
           console.log('code coverage data is NOT available');
        }

        return { 'key': key, 'lines': lines };
    };

    QUnit.done = function(t) {
        var cvgInfo = getCoverageByLine(true);
        if (!!cvgInfo.key) {
            var testableLines = 0;
            var testedLines = 0;
            var untestableLines = 0;
            for (lineIdx in cvgInfo.lines) {
                var cvg = cvgInfo.lines[lineIdx];
                if (typeof cvg === 'number') {
                    testableLines += 1;
                    if (cvg > 0) {
                        testedLines += 1;
                    }
                } else {
                    untestableLines += 1;
                }
            }
            var coverage = '' + Math.floor(100 * testedLines / testableLines) + '%';

            var result = document.getElementById('qunit-testresult');
            if (result != null) {
                result.innerHTML = result.innerHTML + ' ' + coverage + ' test coverage of ' + cvgInfo.key;
            } else {
                console.log('can\'t find test-result element to update');
            }
        }
    };
}());

Version data entries

26 entries across 26 versions & 3 rubygems

Version Path
jinda_lte-0.0.1 lib/generators/jinda_lte/templates/app/assets/jinda_assets/bower_components/bootstrap-datepicker/tests/assets/coverage.js
rearview-1.2.3-jruby public/rearview-src/vendor/bootstrap/plugins/bootstrap-datepicker/tests/assets/coverage.js
rearview-1.2.2.rc.2-jruby public/rearview-src/vendor/bootstrap/plugins/bootstrap-datepicker/tests/assets/coverage.js
rearview-1.2.2.rc.1-jruby public/rearview-src/vendor/bootstrap/plugins/bootstrap-datepicker/tests/assets/coverage.js
rearview-1.2.1-jruby public/rearview-src/vendor/bootstrap/plugins/bootstrap-datepicker/tests/assets/coverage.js
rearview-1.2.0-jruby public/rearview-src/vendor/bootstrap/plugins/bootstrap-datepicker/tests/assets/coverage.js
rearview-1.1.2-jruby public/rearview-src/vendor/bootstrap/plugins/bootstrap-datepicker/tests/assets/coverage.js
rearview-1.1.1-jruby public/rearview-src/vendor/bootstrap/plugins/bootstrap-datepicker/tests/assets/coverage.js
rearview-1.1.0-jruby public/rearview-src/vendor/bootstrap/plugins/bootstrap-datepicker/tests/assets/coverage.js
rearview-1.0.3.rc.4-jruby public/rearview-src/vendor/bootstrap/plugins/bootstrap-datepicker/tests/assets/coverage.js
rearview-1.0.3.rc.3-jruby public/rearview-src/vendor/bootstrap/plugins/bootstrap-datepicker/tests/assets/coverage.js
rearview-1.0.3.rc.2-jruby public/rearview-src/vendor/bootstrap/plugins/bootstrap-datepicker/tests/assets/coverage.js
rearview-1.0.3.rc.1-jruby public/rearview-src/vendor/bootstrap/plugins/bootstrap-datepicker/tests/assets/coverage.js
rearview-1.0.2-jruby public/rearview-src/vendor/bootstrap/plugins/bootstrap-datepicker/tests/assets/coverage.js
rearview-1.0.2.rc.4-jruby public/rearview-src/vendor/bootstrap/plugins/bootstrap-datepicker/tests/assets/coverage.js
rearview-1.0.2.rc.3-jruby public/rearview-src/vendor/bootstrap/plugins/bootstrap-datepicker/tests/assets/coverage.js
rearview-1.0.2.rc.2-jruby public/rearview-src/vendor/bootstrap/plugins/bootstrap-datepicker/tests/assets/coverage.js
rearview-1.0.2.rc.1-jruby public/rearview-src/vendor/bootstrap/plugins/bootstrap-datepicker/tests/assets/coverage.js
rearview-1.0.1-jruby public/rearview-src/vendor/bootstrap/plugins/bootstrap-datepicker/tests/assets/coverage.js
rearview-1.0.0-jruby public/rearview-src/vendor/bootstrap/plugins/bootstrap-datepicker/tests/assets/coverage.js