siesta-lite
Version:
Stress-free JavaScript unit testing and functional testing tool, works in NodeJS and browsers
120 lines (84 loc) • 2.91 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
*/
;(function () {
var ID = 0
Class('Siesta.Result', {
has : {
description : null,
children : Joose.I.Array,
length : 0,
id : function () {
return ++ID
},
parent : null
},
methods : {
itemAt : function (i) {
return this.children[ i ]
},
push : function (result) {
this.children.push(result)
result.parent = this
this.length = this.children.length
},
each : function (func, scope) {
var children = this.children
if (func.call(scope || this, this) === false) return false
for (var i = 0; i < children.length; i++)
if (children[ i ].each(func, scope) === false) return false
},
eachChild : function (func, scope) {
var children = this.children
for (var i = 0; i < children.length; i++)
if (func.call(scope, children[ i ]) === false) return false
},
toString : function () {
return this.description
},
toJSON : function () {
return {
type : this.meta.name,
description : this.description
}
},
findChildById : function (id) {
var child
this.each(function (node) {
if (node.id == id) { child = node; return false }
})
return child
}
},
// used for self-testing when we need different ids for outer context and context being tested
my : {
methods : {
seedID : function (value) {
ID = value
}
}
}
})
})()</pre>
</body>
</html>