UNPKG

siesta-lite

Version:

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

183 lines (141 loc) 5.46 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.Recorder.UI.Model.Action&#39;, { extend : &#39;Ext.data.TreeModel&#39;, fields : Object.keys ? Object.keys(Siesta.Recorder.Action.meta.getAttributes().properties) : [], actionClass : Siesta.Recorder.Action, $action : null, // initialized in the prototype (see below), shared by all instances formatStringHelper : null, constructor : function (data) { if (!data.children &amp;&amp; !(&#39;leaf&#39; in data) &amp;&amp; !data.root) data.leaf = true; // surprisingly the change in &quot;data&quot; variable will be reflected in &quot;arguments&quot; this.callParent([ data ]); if (data &amp;&amp; !data.root) { var action = data; if (!(action instanceof this.actionClass)) { action = new this.actionClass(action) } this.$action = action; Ext.applyIf(action, this.data); this.data = action; } }, getReadableStringWithModifierKeys : function (text, options) { options = options || {}; var modifierKeys = &#39;&#39;; var modifierRe = /CTRL|CMD|SHIFT|ALT/; var ctrlKey = options.ctrlKey, metaKey = options.metaKey &amp;&amp; Ext.isMac, shiftKey = options.shiftKey, altKey = options.altKey; if (altKey) { modifierKeys = &#39;[ALT]&#39;; } if (ctrlKey) { modifierKeys = &#39;[CTRL]&#39;; } if (metaKey) { modifierKeys += &#39;[CMD]&#39;; } if (shiftKey) { modifierKeys += &#39;[SHIFT]&#39;; } // Prepend modifier keys to all chars typed if (modifierKeys) { var keys = this.formatStringHelper.extractKeysAndSpecialKeys(text); var prependedKeys = keys.map(function (character) { // Don&#39;t prepend recorded special keys if (!modifierRe.test(character)) { // should use single quotes return &quot;&lt;span class=&#39;modifierkeys&#39;&gt;&quot; + modifierKeys + &#39;&lt;/span&gt;&#39; + Ext.String.htmlEncode(character); } return &#39;&#39;; }); text = prependedKeys.join(&#39;&#39;); } return text; } // , // setTargetByType : function (targetType, target) { // return this.$action.setTargetByType() // }, // resetValues : function () { // this.$action.resetValues() // // this.afterEdit([ &#39;targets&#39;, &#39;value&#39;, &#39;__offset__&#39; ]) // }, // // // clearTargetOffset : function () { // this.$action.clearTargetOffset() // // this.afterEdit([ &#39;targets&#39; ]) // }, // // // setTargetOffset : function (value) { // this.$action.setTargetOffset(value) // // this.afterEdit([ &#39;__offset__&#39; ]) // } }, function () { var prototype = this.prototype // anonymous class that consumes the &quot;CanFormatStrings&quot; role var cls = Class({ does : Siesta.Util.Role.CanFormatStrings }) // anonymous helper instance of anonymous class :) prototype.formatStringHelper = new cls() //var attributeNames = []; //Siesta.Recorder.Action.meta.getAttributes().each(function(attr){ attributeNames.push(attr.name)}); // //if (this.addFields) { // this.addFields(attributeNames); //} else { // var fields = prototype.fields // fields.addAll(attributeNames); //} Joose.A.each([ &#39;getTargetOffset&#39;, &#39;isMouseAction&#39;, &#39;parseOffset&#39;, &#39;getTarget&#39;, &#39;getTargets&#39;, &#39;hasTarget&#39;, &#39;asStep&#39;, &#39;asCode&#39; ], function (methodName) { prototype[ methodName ] = function () { return this.$action[ methodName ].apply(this.$action, arguments) } }) Joose.O.each({ clearTargetOffset : [ &#39;target&#39; ], setTargetOffset : [ &#39;target&#39; ], resetValues : [ &#39;target&#39;, &#39;value&#39; ], setAction : [ &#39;action&#39;, &#39;target&#39; ] }, function (fields, methodName) { prototype[ methodName ] = function () { var res = this.$action[ methodName ].apply(this.$action, arguments) // TODO not needed since we do refreshNode //this.afterEdit(fields) return res } }) }); </pre> </body> </html>