siesta-lite
Version:
Stress-free JavaScript unit testing and functional testing tool, works in NodeJS and browsers
148 lines (134 loc) • 4.65 kB
HTML
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>The source code</title>
<link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="../resources/prettify/prettify.js"></script>
<style type="text/css">
.highlight { display: block; background-color: #ddd; }
</style>
<script type="text/javascript">
function highlight() {
document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
}
</script>
</head>
<body onload="prettyPrint(); highlight();">
<pre class="prettyprint lang-js">/*
Siesta 5.6.1
Copyright(c) 2009-2022 Bryntum AB
https://bryntum.com/contact
https://bryntum.com/products/siesta/license
*/
Ext.define('Siesta.Project.Browser.Model.CoverageUnit', {
extend : 'Ext.data.Model',
idProperty : 'id',
fields : [
'id',
'url',
'text',
'reportNode',
{ name : 'iconCls', defaultValue : 'x-fa fa-cube'}
],
getLineCoverage : function() {
return this.getCoverageInPercent('lines');
},
getStatementCoverage : function() {
return this.getCoverageInPercent('statements');
},
getBranchCoverage : function() {
return this.getCoverageInPercent('branches');
},
getFunctionCoverage : function() {
return this.getCoverageInPercent('functions');
},
getCoverageInPercent : function(type) {
var node = this.data.reportNode;
if (node) {
return node.metrics[type].pct;
}
}
// ,
// init : function () {
// this.internalId = this.getId() || this.internalId
// },
//
// computeFolderStatus : function () {
// if (!this.childNodes.length) return 'yellow'
//
// var isWorking = false
// var hasFailed = false
// var allGreen = true
//
// Joose.A.each(this.childNodes, function (childNode) {
//
// if (childNode.isLeaf()) {
// var test = childNode.get('test')
//
// if (test && test.isFailed()) {
// allGreen = false
// hasFailed = true
//
// // stop iteration
// return false
// }
//
// if (!test && childNode.get('isStarting')) isWorking = true
// if (test && !test.isFinished()) isWorking = true
// if (test && !test.isPassed()) allGreen = false
// if (!test) allGreen = false
//
// } else {
// var status = childNode.computeFolderStatus()
//
// if (status == 'red') {
// allGreen = false
// hasFailed = true
//
// // stop iteration
// return false
// }
//
// if (status == 'working') {
// isWorking = true
//
// // stop iteration
// return false
// }
//
// if (status == 'yellow') allGreen = false
// }
// })
//
// if (isWorking) return 'working'
// if (hasFailed) return 'red'
// if (allGreen) return 'green'
//
// return 'yellow'
// },
//
//
// updateFolderStatus : function () {
// this.set('folderStatus', this.computeFolderStatus())
//
// var parentNode = this.parentNode
//
// if (parentNode && !parentNode.isRoot()) parentNode.updateFolderStatus()
// }
},
// eof Ext.apply
function () {
Ext.data.NodeInterface.decorate(this);
this.override({
expand : function () {
Ext.suspendLayouts();
this.callParent(arguments);
Ext.resumeLayouts();
}
});
}
)
</pre>
</body>
</html>