siesta-lite
Version:
Stress-free JavaScript unit testing and functional testing tool, works in NodeJS and browsers
75 lines (63 loc) • 2.44 kB
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
*/
<span id='Siesta-Test-Date'>/**
</span>@class Siesta.Test.Date
A mixin with the additinal assertions for dates. Being consumed by {@link Siesta.Test}
*/
Role('Siesta.Test.Date', {
methods : {
isDateEq: function (got, expectedDate, description) {
this.isDateEqual.apply(this, arguments);
},
<span id='Siesta-Test-Date-method-isDateEqual'> /**
</span> * This assertion passes when the 2 provided dates are equal and fails otherwise.
*
* It has a synonym: `isDateEq`
*
* @param {Date} got The 1st date to compare
* @param {Date} expectedDate The 2nd date to compare
* @param {String} [description] The description of the assertion
*/
isDateEqual: function (got, expectedDate, description) {
var R = Siesta.Resource('Siesta.Test.Date');
if (got - expectedDate === 0) {
this.pass(description, {
descTpl : '{got} ' + R.get('isEqualTo') + ' {expectedDate}',
got : got,
expectedDate : expectedDate
});
} else {
this.fail(description, {
assertionName : 'isDateEqual',
got : got ? got.toString() : '',
gotDesc : R.get('Got'),
need : expectedDate.toString()
});
}
}
}
});
</pre>
</body>
</html>