siesta-lite
Version:
Stress-free JavaScript unit testing and functional testing tool, works in NodeJS and browsers
107 lines (76 loc) • 3.09 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
*/
Class('Siesta.Result.Assertion', {
isa : Siesta.Result,
has : {
name : null,
passed : null,
annotation : null,
index : null,
// stored as string
sourceLine : null,
isTodo : false,
isException : false,
exceptionType : null,
isWaitFor : false,
completed : false // for waitFor assertions
},
methods : {
isPassed : function (raw) {
if (raw) return this.passed
if (this.isTodo) return true
if (this.isWaitFor && !this.completed) return true
return this.passed
},
toString : function () {
var R = Siesta.Resource('Siesta.Result.Assertion');
var text = (this.isTodo ? R.get('todoText') : '') +
(this.passed ? R.get('passText') : R.get('failText')) + ' ' + this.index + ' - ' + this.description
if (this.annotation) text += '\n' + this.annotation
return text
},
toJSON : function () {
var me = this
var info = {
parentId : this.parent.id,
type : this.meta.name,
passed : this.passed,
index : this.index,
description : String(this.description) || 'No description'
}
if (this.annotation) info.annotation = String(this.annotation)
// copy if true
Joose.A.each([ 'isTodo', 'isWaitFor', 'isException', 'sourceLine', 'name' ], function (name) {
if (me[ name ]) info[ name ] = me[ name ]
})
if (this.isException) {
info.exceptionType = this.exceptionType
}
return info
}
}
})
</pre>
</body>
</html>