UNPKG

siesta-lite

Version:

Stress-free JavaScript unit testing and functional testing tool, works in NodeJS and browsers

132 lines (100 loc) 4.2 kB
<!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(&#39;Siesta.Project.Browser.Model.TestFile&#39;, { extend : &#39;Ext.data.Model&#39;, idProperty : &#39;id&#39;, fields : [ &#39;id&#39;, &#39;url&#39;, &#39;title&#39;, &#39;tooltip&#39;, { name : &#39;passCount&#39;, type : &#39;int&#39;, defaultValue : 0 }, { name : &#39;failCount&#39;, type : &#39;int&#39;, defaultValue : 0 }, { name : &#39;todoPassCount&#39;, type : &#39;int&#39;, defaultValue : 0 }, { name : &#39;todoFailCount&#39;, type : &#39;int&#39;, defaultValue : 0 }, { name : &#39;time&#39;, type : &#39;int&#39;, defaultValue : 0 }, { name : &#39;checked&#39;, defaultValue : false }, { name : &#39;folderStatus&#39;, defaultValue : &#39;yellow&#39; }, // will be set to true for all tests, once the users clicks &quot;run&quot; &#39;isStarting&#39;, // will be set to true, after preload ends and tests launch { name : &#39;isRunning&#39;, type : &#39;boolean&#39;, defaultValue : false }, { name : &#39;isMissing&#39;, type : &#39;boolean&#39;, defaultValue : false }, { name : &#39;isFailed&#39;, type : &#39;boolean&#39;, defaultValue : false }, // composite objects &#39;assertionsStore&#39;, &#39;test&#39;, &#39;descriptor&#39; ], //init : function () { //this.internalId = this.getId() || this.internalId //debugger; //}, computeFolderStatus : function () { if (!this.childNodes.length) return &#39;yellow&#39; var isWorking = false var hasFailed = false var allGreen = true Joose.A.each(this.childNodes, function (childNode) { if (childNode.isLeaf()) { var test = childNode.get(&#39;test&#39;) if (test &amp;&amp; test.isFailed()) { allGreen = false hasFailed = true // stop iteration return false } if (!test &amp;&amp; childNode.get(&#39;isStarting&#39;)) isWorking = true if (test &amp;&amp; !test.isFinished()) isWorking = true if (test &amp;&amp; !test.isPassed()) allGreen = false if (!test) allGreen = false } else { var status = childNode.computeFolderStatus() if (status == &#39;red&#39;) { allGreen = false hasFailed = true // stop iteration return false } if (status == &#39;working&#39;) { isWorking = true // stop iteration return false } if (status == &#39;yellow&#39;) allGreen = false } }) if (isWorking) return &#39;working&#39; if (hasFailed) return &#39;red&#39; if (allGreen) return &#39;green&#39; return &#39;yellow&#39; }, updateFolderStatus : function () { this.set(&#39;folderStatus&#39;, this.computeFolderStatus()) var parentNode = this.parentNode if (parentNode &amp;&amp; !parentNode.isRoot()) parentNode.updateFolderStatus() } })</pre> </body> </html>