UNPKG

siesta-lite

Version:

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

148 lines (120 loc) 4.91 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.UI.TestNameColumn&#39;, { extend : &#39;Ext.tree.Column&#39;, xtype : &#39;testnamecolumn&#39;, requires : [ &#39;Siesta.Project.Browser.UI.TreeFilterField&#39; ], dataIndex : &#39;title&#39;, sortable : false, menuDisabled : true, flex : 1, tdCls : &#39;test-name-cell&#39;, scope : this, project : null, filterGroups : null, store : null, initComponent : function () { var R = Siesta.Resource(&#39;Siesta.Project.Browser.UI.TestGrid&#39;); Ext.apply(this, { items : [ { xtype : &#39;treefilter&#39;, emptyText : R.get(&#39;filterTestsText&#39;), margins : &#39;0 0 0 10&#39;, itemId : &#39;trigger&#39;, filterGroups : this.filterGroups, filterField : &#39;title&#39;, store : this.store, tipText : R.get(&#39;filterFieldTooltip&#39;) } ] }); this.callParent(arguments); }, // HACK OVERRIDE treeRenderer : function (value, metaData, testFile) { metaData.tdCls = &#39;test-name-cell-&#39; + (testFile.data.leaf ? &#39;leaf&#39; : &#39;parent&#39;); var iconCls = &#39;&#39; if (testFile.isLeaf()) { var test = testFile.get(&#39;test&#39;) if (test) { if (testFile.get(&#39;isFailed&#39;)) iconCls = &#39;siesta-test-failed fa-flag&#39; else if (testFile.get(&#39;isRunning&#39;) &amp;&amp; !test.isFinished()) iconCls = &#39;fa-flash siesta-running-not-finished&#39; else if (test.isFinished()) { if (test.isPassed()) iconCls = &#39;fa-check siesta-test-passed&#39; else iconCls = &#39;fa-bug siesta-test-failed&#39; } else iconCls = &#39;fa-hourglass-o siesta-test-starting&#39; } else { if (testFile.get(&#39;isMissing&#39;)) iconCls = &#39;fa-close siesta-test-file-missing&#39; else if (testFile.get(&#39;isStarting&#39;)) iconCls = &#39;fa-hourglass-o siesta-test-starting&#39; else iconCls = this.getTestIcon(testFile) + &#39; siesta-test-file&#39; } } else { var status = testFile.get(&#39;folderStatus&#39;); if (status == &#39;working&#39;) { iconCls = &#39; fa-hourglass-o siesta-folder-running&#39;; } else if (status == &#39;green&#39;) { iconCls = &#39; fa-check siesta-folder-pass&#39;; } else if (status == &#39;red&#39;) { iconCls = &#39; fa-bug siesta-folder-fail&#39;; } else { iconCls = &#39;&#39;; } } testFile.data.iconCls = iconCls if (testFile.isLeaf()) { var tooltip = testFile.get(&#39;tooltip&#39;) || value metaData.tdAttr = &#39;title=&quot;&#39; + tooltip + &#39;&quot;&#39;; } return this.callParent(arguments); }, getTestIcon : function(test) { if (this.project.getDescriptorConfig(test.get(&#39;descriptor&#39;), &#39;pageUrl&#39;)) { return &#39;fa-desktop&#39;; // Application test } else { return &#39;fa-file-o&#39;; // Unit test } }, renderer : function (v, m, r) { return v + ( r.get(&#39;descriptor&#39;).referenceUrl ? &#39;&lt;span style=&quot;padding-left: 3px; vertical-align: super; font-size: xx-small&quot; class=&quot;fa fa-external-link&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&#39; : &#39;&#39; ); } }) </pre> </body> </html>