UNPKG

siesta-lite

Version:

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

146 lines (103 loc) 4.93 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 */ Role(&#39;Ariadne.ExtJSDomQueryFinder.Role.ExtJSHelper&#39;, { methods : { getComponentOfDomElement : function (el) { var doc = el.ownerDocument var body = doc.body var Ext = (doc.defaultView || doc.parentWindow).Ext if (!Ext || !Ext.getCmp) return null while (el &amp;&amp; el != body) { var elId = el.getAttribute(&#39;id&#39;) if (elId &amp;&amp; Ext.getCmp(elId)) return Ext.getCmp(elId) el = el.parentElement } return null }, getExtByDomElement : function (el) { var doc = el.ownerDocument return (doc.defaultView || doc.parentWindow).Ext }, getExtCssClassPrefixRegexp : function (el) { var Ext = this.getExtByDomElement(el) if (!Ext) return null var baseCSSPrefix = Ext.baseCSSPrefix || &#39;x&#39; return new RegExp(&#39;^&#39; + baseCSSPrefix) }, // Ext JS 4+: Form fields sometimes get their &#39;name&#39; generated based on a parent id // property is considered to be auto-generated if it contains an id string and id is in turn auto-generated valueIsAutoGeneratedByComponent : function (comp, value) { // Not relevant for Ext &lt; 4 if (!comp.up) return false; value = String(value) var componentsToCheck = comp.autoGenId ? [ comp ] : [] var parentWithAutoId = comp.up(&#39;[autoGenId=true]&#39;); if (parentWithAutoId) componentsToCheck.push(parentWithAutoId) var childrenWithAutoId = parentWithAutoId &amp;&amp; parentWithAutoId.query &amp;&amp; parentWithAutoId.query(&#39;[autoGenId=true]&#39;) if (childrenWithAutoId) componentsToCheck.push.apply(componentsToCheck, childrenWithAutoId) return componentsToCheck.some(function (comp) { return value.indexOf(comp.id) &gt;= 0 }) }, componentHasAutoGeneratedId : function (component, Ext) { var id = component.id // Ext3 ? if (/^ext-gen\d+|^ext-comp\d+/.test(id)) { return true; } if (Ext &amp;&amp; this.idIsGeneratedByExtDotIdCall(id, Ext)) return true if (component.isWidget) { return id.replace(/\d+$/, &#39;&#39;) == component.identifiablePrefix } // even if `autoGenId` can be set to false, the id of the component can be formed from the id // if its parent, like &quot;window-1019-header_hd&quot; (id of window header), where &quot;window-1019&quot; is autogenerated id // of parent component return component.autoGenId || this.valueIsAutoGeneratedByComponent(component, id); }, // detect ids generated with `Ext.id()` idIsGeneratedByExtDotIdCall : function (id, Ext, el) { Ext = Ext || this.getExtByDomElement(el) if (!Ext) return false var match = /^(.+?)\d+$/.exec(id) return Boolean(match &amp;&amp; match[ 1 ] == Ext.idPrefix) }, domElementHasAutoGeneratedId : function (el) { var id = el.getAttribute(&#39;id&#39;) || &#39;&#39; if (/^ext-/.test(id) || this.idIsGeneratedByExtDotIdCall(id, null, el)) return true // id of node in the dom can be formed from the id of the component this node belongs to // for example dom node `container-1019-innertCt` belonging to container-1019 // such ids are considered auto-generated and should be ignored var comp = this.getComponentOfDomElement(el) if (comp) { if ((id !== comp.id &amp;&amp; id.indexOf(comp.id) &gt; -1) || this.componentHasAutoGeneratedId(comp)) { return true } } return false } } }); </pre> </body> </html>