UNPKG

siesta-lite

Version:

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

1 lines 6.91 kB
Ext.data.JsonP.Siesta_Test_UserAgent_Keyboard({"tagname":"class","name":"Siesta.Test.UserAgent.Keyboard","autodetected":{},"files":[{"filename":"Keyboard.js","href":"Keyboard.html#Siesta-Test-UserAgent-Keyboard"}],"members":[{"name":"keyPress","tagname":"method","owner":"Siesta.Test.UserAgent.Keyboard","id":"method-keyPress","meta":{}},{"name":"type","tagname":"method","owner":"Siesta.Test.UserAgent.Keyboard","id":"method-type","meta":{}}],"alternateClassNames":[],"aliases":{},"id":"class-Siesta.Test.UserAgent.Keyboard","component":false,"superclasses":[],"subclasses":[],"mixedInto":["Siesta.Test.Browser"],"mixins":[],"parentMixins":[],"requires":[],"uses":[],"html":"<div><pre class=\"hierarchy\"><h4>Mixed into</h4><div class='dependency'><a href='#!/api/Siesta.Test.Browser' rel='Siesta.Test.Browser' class='docClass'>Siesta.Test.Browser</a></div><h4>Files</h4><div class='dependency'><a href='source/Keyboard.html#Siesta-Test-UserAgent-Keyboard' target='_blank'>Keyboard.js</a></div></pre><div class='doc-contents'><p>This is a mixin, providing the keyboard events simulation functionality.</p>\n</div><div class='members'><div class='members-section'><div class='definedBy'>Defined By</div><h3 class='members-title icon-method'>Methods</h3><div class='subsection'><div id='method-keyPress' class='member first-child not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><span class='defined-in' rel='Siesta.Test.UserAgent.Keyboard'>Siesta.Test.UserAgent.Keyboard</span><br/><a href='source/Keyboard.html#Siesta-Test-UserAgent-Keyboard-method-keyPress' target='_blank' class='view-source'>view source</a></div><a href='#!/api/Siesta.Test.UserAgent.Keyboard-method-keyPress' class='name expandable'>keyPress</a>( <span class='pre'>el, key, options, callback, scope</span> ) : Promise<span class=\"signature\"></span></div><div class='description'><div class='short'> ...</div><div class='long'>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>el</span> : <a href=\"#!/api/Siesta.Test.ActionTarget\" rel=\"Siesta.Test.ActionTarget\" class=\"docClass\">Siesta.Test.ActionTarget</a><div class='sub-desc'>\n</div></li><li><span class='pre'>key</span> : String<div class='sub-desc'>\n</div></li><li><span class='pre'>options</span> : Object<div class='sub-desc'><p>any extra options used to configure the DOM event. This argument can be omitted.</p>\n</div></li><li><span class='pre'>callback</span> : Function<div class='sub-desc'><p>A function to be called after the type operation is completed.</p>\n</div></li><li><span class='pre'>scope</span> : Object<div class='sub-desc'><p>The scope for the callback</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'>Promise</span><div class='sub-desc'><p>Returns a promise resolved once the action has completed</p>\n\n<p>This method will simluate the key press, translated to the specified DOM element. It is generally exactly equivalent of\ntyping a single character, special characters are supported in the same way as in <a href=\"#!/api/Siesta.Test.UserAgent.Keyboard-method-type\" rel=\"Siesta.Test.UserAgent.Keyboard-method-type\" class=\"docClass\">type</a> method.</p>\n</div></li></ul></div></div></div><div id='method-type' class='member not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><span class='defined-in' rel='Siesta.Test.UserAgent.Keyboard'>Siesta.Test.UserAgent.Keyboard</span><br/><a href='source/Keyboard.html#Siesta-Test-UserAgent-Keyboard-method-type' target='_blank' class='view-source'>view source</a></div><a href='#!/api/Siesta.Test.UserAgent.Keyboard-method-type' class='name expandable'>type</a>( <span class='pre'>el, text, callback, scope, [options], [clearExisting]</span> ) : Promise<span class=\"signature\"></span></div><div class='description'><div class='short'>This method will simulate keyboard typing on either a provided DOM element, or, if omitted, on the currently focuced ...</div><div class='long'><p>This method will simulate keyboard typing on either a provided DOM element, or, if omitted, on the currently focuced DOM element.\nSimulation of certain special keys such as ENTER, ESC, LEFT etc is supported.\nYou can type these special keys by using the all uppercase name the key inside square brackets: <code>[ENTER]</code>, <code>[BACKSPACE]</code>.\nSee <a href=\"#!/api/Siesta.Test.UserAgent.KeyCodes\" rel=\"Siesta.Test.UserAgent.KeyCodes\" class=\"docClass\">Siesta.Test.UserAgent.KeyCodes</a> for a list of key names.</p>\n\n<p>For example:</p>\n\n<pre><code>t.type(el, 'Foo bar[ENTER]', function () {\n ...\n})\n</code></pre>\n\n<p>To type the <code>[ENTER]</code> as plain text and not as a special character - use double square brackets: <code>[[ENTER]]</code></p>\n\n<p>To specify a control key like \"shift/control/alt\" of to be pressed during typing, use the <code>options</code> argument, for example:</p>\n\n<pre><code>t.type(el, 'Foo bar[ENTER]', callback, scope, { shiftKey : true, ctrlKey : true, altKey : true });\n</code></pre>\n\n<p>This method returns a <code>Promise</code> which is resolved once the click has completed:</p>\n\n<pre><code> t.type('#someEl', 'someText').then(function () {\n return t.type('#anotherEl', 'someText')\n }).then(function () {\n return t.type('#yetAnotherEl', 'someText')\n })\n</code></pre>\n\n<p>See also <a href=\"#!/api/Siesta.Test-method-chain\" rel=\"Siesta.Test-method-chain\" class=\"docClass\">chain</a> method for slimer chaining notation.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>el</span> : <a href=\"#!/api/Siesta.Test.ActionTarget\" rel=\"Siesta.Test.ActionTarget\" class=\"docClass\">Siesta.Test.ActionTarget</a><div class='sub-desc'><p>The element to type into. If not provided, currently focused element will be used as target.</p>\n</div></li><li><span class='pre'>text</span> : String<div class='sub-desc'><p>The text to type, including any names of special keys in square brackets.</p>\n</div></li><li><span class='pre'>callback</span> : Function<div class='sub-desc'><p>A function to be called after the type operation is completed.</p>\n</div></li><li><span class='pre'>scope</span> : Object<div class='sub-desc'><p>The scope for the callback</p>\n</div></li><li><span class='pre'>options</span> : Object (optional)<div class='sub-desc'><p>any extra options used to configure the DOM key events (like holding shiftKey, ctrlKey, altKey etc).</p>\n</div></li><li><span class='pre'>clearExisting</span> : Boolean (optional)<div class='sub-desc'><p>true to clear existing text in the target before typing</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'>Promise</span><div class='sub-desc'><p>Returns a promise resolved once the action has completed</p>\n</div></li></ul></div></div></div></div></div></div></div>","meta":{}});