rich-harris / simulant Goto Github PK
View Code? Open in Web Editor NEWSimulated DOM events for automated testing
License: MIT License
Simulated DOM events for automated testing
License: MIT License
Currently simulant.fire
doesn't return anything. Would be awesome if it returned the event object, either the passed in one, or the created one.
The current distribution build of simulant specifies simulant.js.map
as the source mapping URL (
Line 404 in 5024b2b
simulant.js.map
does not seem to exist. Perhaps a build issue?
(As an aside, I find it amusing that the source map URL happens to be defined on line 404 =)
You moved simulant.js into a dist folder, but didn't update the file configuration in package.json
Does anyone know how to fire a keyup enter event?
I have tried the following:
simulant.fire(target, 'keyup', { keyCode: 13, which:13 });
But it does not seem to work.
Hi!
When I tried to make a trigger for the tap event (for Ractive on-tap with ractive-events-tap plugin):
$.fn.r_trigger = (event_name, opt)->
el = @[0]
return if !el
switch event_name
when 'tap'
if win.navigator.pointerEnabled
simulant.fire(el, 'pointerdown', opt)
simulant.fire(el, 'pointerup', opt)
else if win.navigator.msPointerEnabled
simulant.fire(el, 'MSPointerDown', opt)
simulant.fire(el, 'MSPointerUp', opt)
else
simulant.fire(el, 'mousedown', opt)
simulant.fire(el, 'click', opt)
else
simulant.fire(el, event_name, opt)
@
I encountered a problem that Simulant fails to fire some events in the legacy mode.
So I had to add 4 events pointerdown pointerup MSPointerDown MSPointerUp
to the the eventTypesByGroup.Event
I'm not sure if it is the best way to resolve the problem, so I didn't do a pull request.
Thanks for the lib!
Can the target
property of the event be overridden? This could be useful for instance when firing a change
event on an input[type=file]
element to allow setting the e.target.files
property?
Example: http://stackoverflow.com/a/25098258.
Would be really useful for testing to be able to e.g. input text like
simulate.type(el, 'Lorem hipsum');
which would send all keydown / keyup / keypress events which should be sent and maybe even throw error if field doesn't have focus at the time.
There are couple of alternatives for this library https://github.com/bitovi/syn and http://postdocs.stanford.edu/Templates/yui-3.5.0/docs/event/simulate.html.
I've been using Syn earlier and now I'm looking for replacement, since in previous projects we had to patch it heavily. Specially handling change event for select was hard for it :)
YUI might be good choice since it has been around forever, but I would prefer smaller lib, which concentrates only to handle event simulation. Do you have any comments how simulant compare to YUI?
Is it possible to set pageX
and pageY
on the mousemove
event? Something like this would be nice:
simulant.fire(document, 'mousemove', {
pageX: 0,
pageY: 0
})
but on the event handler all I get is {"isTrusted":false}
no matter what I put in the options.
Doesn't seem to support npm or node/browserify.. why is it even published on npm?
It has this error when I try to call `beforeUnloadEvent'
TypeError: 'undefined' is not an object (evaluating 'maps__initialisersByGroup[group][1]')
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.