The simulate extended plugin provides methods for simulating complex user interactions based on the jQuery.simulate() plugin. The plugin provides simulation of:
- Drag & Drop
- Key Sequences
- Key Combinations
Additionally, the extended plugin includes documentation and fixes for the jQuery simulate plugin itself.
To use the jQuery simulate extended plugins, include jquery.simulate.js
, jquery.simulate.ext.js
and then the desired plugins (in that order).
The simulations are executed by calling the .simulate()
function on a jQuery object. The simulation
is then executed on all elements in the collection of the jQuery object (unless otherwise noted).
- Synopsis:
.simulate(type, options)
- Parameters:
- type {String}: The type of the interaction to be simulated.
- options {Object}: An option object containing the options for the action to be simulated.
The types of simulated actions are:
- From the simulate plugin:
- Mouse Events:
"mousemove"
,"mousedown"
,"mouseup"
,"click"
,dblclick"
,"mouseover"
,"mouseout"
,"mouseenter"
,"mouseleave"
,"contextmenu"
- Key Events:
"keydown"
,"keyup"
,"keypress"
"focus"
"blur"
- Mouse Events:
- From the simulate-ext plugins:
- Drag & Drop:
"drag-n-drop"
,"drag"
,"drop"
"key-sequence"
"key-combo"
- Drag & Drop:
$('input[name="testInput"]').simulate("key-sequence", {sequence: "asdf"});
The demos folder contains a demonstration of most of the features of the simulate extended plugins.
Live demos can be found at jsFiddle and JS Bin where you can also play around with the plugin:
- http://jsfiddle.net/Ignitor/Psjhf/embedded/result/ (jsFiddle)
- http://jsbin.com/inalax/25/edit#live (JS Bin)
The options and events for the different interactions are described in the files in the doc folder:
The plugin requires
- jQuery 1.7.0+
- jQuery Simulate
- bililiteRange for the key-sequence and key-combo plugins
The plugins have been successfully tested with jQuery 1.7.2, 1.10.2 and jQuery Simulate @485ca7192a, @25938de206. However, they should be compatible with other/future versions as well.
There are some issues with bililiteRange and some browsers. To workaround these issues, jQuery simulate extended
performs some quirk detections when the document is ready. Those quirk detections also contain temporary DOM manipulations.
If you don't want those DOM manipulations to take place, you can disable the quirk detection by setting the flag
ext_disableQuirkDetection
in the jQuery.simulate
object after jquery.simulate.js
has been loaded but before
any jQuery simulate extended plugin is loaded. For example:
<!-- ... -->
<script type="text/javascript" src="../libs/jquery.simulate.js"></script>
<script type="text/javascript">$.simulate.ext_disableQuirkDetection = true;</script>
<script type="text/javascript" src="../src/jquery.simulate.ext.js"></script>
<script type="text/javascript" src="../src/jquery.simulate.key-sequence.js"></script>
<!-- ... -->
For more information, see issue #9.
Copyright © 2013 Jochen Ulrich https://github.com/j-ulrich/jquery-simulate-ext
Licensed under the MIT license.