UNPKG

siesta-lite

Version:

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

105 lines (84 loc) 3.19 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 */ <span id='Siesta-Util-Role-CanStyleOutput'>/** </span>@class Siesta.Util.Role.CanStyleOutput @private A role, providing output coloring functionality */ Role(&#39;Siesta.Util.Role.CanStyleOutput&#39;, { has : { <span id='Siesta-Util-Role-CanStyleOutput-cfg-disableColoring'> /** </span> * @cfg {Boolean} disableColoring When set to `true` will disable the colors in the console output in automation launchers / NodeJS launcher */ disableColoring : false, style : { is : &#39;rwc&#39;, lazy : &#39;this.buildStyle&#39; }, styles : { init : { &#39;bold&#39; : [1, 22], &#39;italic&#39; : [3, 23], &#39;underline&#39; : [4, 24], &#39;black &#39; : [30, 39], &#39;yellow&#39; : [33, 39], &#39;cyan&#39; : [36, 39], &#39;white&#39; : [37, 39], &#39;green&#39; : [32, 39], &#39;red&#39; : [31, 39], &#39;grey&#39; : [90, 39], &#39;blue&#39; : [34, 39], &#39;magenta&#39; : [35, 39], &#39;bgblack &#39; : [40, 49], &#39;bgyellow&#39; : [43, 49], &#39;bgcyan&#39; : [46, 49], &#39;bgwhite&#39; : [47, 49], &#39;bggreen&#39; : [42, 49], &#39;bgred&#39; : [41, 49], &#39;bggrey&#39; : [100, 49], &#39;bgblue&#39; : [44, 49], &#39;bgmagenta&#39; : [45, 49], &#39;inverse&#39; : [7, 27] } } }, methods : { buildStyle : function () { var me = this var style = {} Joose.O.each(this.styles, function (value, name) { style[ name ] = function (text) { return me.styled(text, name) } }) return style }, styled : function (text, style) { if (this.disableColoring) return text var styles = this.styles return &#39;\x1B[&#39; + styles[ style ][ 0 ] + &#39;m&#39; + text + &#39;\x1B[&#39; + styles[ style ][ 1 ] + &#39;m&#39; } } }) </pre> </body> </html>