{"_id":"simulant","_rev":"15-a4353c33c2df05176f41e7e1104ed83a","name":"simulant","description":"Simulated DOM events for automated testing","dist-tags":{"latest":"0.2.2"},"versions":{"0.1.0":{"name":"simulant","description":"Simulated DOM events for automated testing","version":"0.1.0","author":{"name":"Rich Harris"},"licenses":[{"type":"MIT"}],"repository":{"type":"git","url":"https://github.com/Rich-Harris/Simulant.git"},"github":"https://github.com/Rich-Harris/Simulant","bugs":{"url":"https://github.com/Rich-Harris/Simulant/issues"},"jam":{"main":"simulant.js","include":["simulant.js","simulant.min.js","README.md"]},"devDependencies":{"grunt":"~0.4.1","grunt-contrib-concat":"~0.3.0","grunt-contrib-clean":"~0.5.0","grunt-contrib-jshint":"~0.6.3","grunt-contrib-qunit":"~0.2.2","grunt-contrib-copy":"~0.4.1","grunt-contrib-uglify":"~0.2.2","grunt-contrib-watch":"~0.5.3"},"testling":{"html":"test/testling.html","browsers":["ie/6..latest","chrome/10.0","chrome/15.0","chrome/23..canary","firefox/3.6","firefox/7.0","firefox/12.0","firefox/18.0..nightly","opera/10..next","safari/4..latest"]},"_id":"simulant@0.1.0","dist":{"shasum":"25872b222b98889cf5efa608a126bbb350b79686","tarball":"https://registry.npmjs.org/simulant/-/simulant-0.1.0.tgz","integrity":"sha512-iixRlI77cUqcx0fWpQyxi5gkPSgloDTAvBK1KpPQD6s4LeS1Wpyv0KVwsQR8lgKnFVznnMmUDKyhbmVbkTm5lA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBM+IrmktVbsIqNWd+ht1v54cwp4htU3CBK1ZfGdCaggAiB54llUulm7y3yBHvpKjI3uXdYoFV4R+wNQUJ6TbrnoaQ=="}]},"_from":".","_npmVersion":"1.2.13","_npmUser":{"name":"rich_harris","email":"richard.a.harris@gmail.com"},"maintainers":[{"name":"rich_harris","email":"richard.a.harris@gmail.com"}]},"0.1.2":{"name":"simulant","description":"Simulated DOM events for automated testing","version":"0.1.2","author":{"name":"Rich Harris"},"licenses":[{"type":"MIT"}],"repository":{"type":"git","url":"https://github.com/Rich-Harris/Simulant.git"},"github":"https://github.com/Rich-Harris/Simulant","bugs":{"url":"https://github.com/Rich-Harris/Simulant/issues"},"main":"build/simulant.js","devDependencies":{"grunt":"~0.4.1","grunt-contrib-concat":"~0.3.0","grunt-contrib-clean":"~0.5.0","grunt-contrib-jshint":"~0.6.3","grunt-contrib-qunit":"~0.2.2","grunt-contrib-copy":"~0.4.1","grunt-contrib-uglify":"~0.2.2","grunt-contrib-watch":"~0.5.3"},"testling":{"html":"test/testling.html","browsers":["ie/6..latest","chrome/10.0","chrome/15.0","chrome/23..canary","firefox/3.6","firefox/7.0","firefox/12.0","firefox/18.0..nightly","opera/10..next","safari/4..latest"]},"gitHead":"bf4dc4afeaf7662280975108284a78419d72308d","homepage":"https://github.com/Rich-Harris/Simulant","_id":"simulant@0.1.2","scripts":{},"_shasum":"df6ad90b185e25cdda673dcbe9fce9c705a1a4a7","_from":".","_npmVersion":"1.4.23","_npmUser":{"name":"rich_harris","email":"richard.a.harris@gmail.com"},"maintainers":[{"name":"rich_harris","email":"richard.a.harris@gmail.com"}],"dist":{"shasum":"df6ad90b185e25cdda673dcbe9fce9c705a1a4a7","tarball":"https://registry.npmjs.org/simulant/-/simulant-0.1.2.tgz","integrity":"sha512-naeXjjcsYluzkzSIstH9ifs2TwVAgWdzuBCwFG93pgB3DhMTV8rihu5IhiOY6iTF5gTOjdaAIMwlhrRjk9gpXw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD5oOswohK1DwXrpj4Ylmi4UFnZri5SSKNRV8kyGF0uSgIgU7Zq73hfqNXIIC7tXxbBSdPXyuVR1+m/JLBZln1YIzw="}]}},"0.1.3":{"name":"simulant","description":"Simulated DOM events for automated testing","version":"0.1.3","author":{"name":"Rich Harris"},"license":"MIT","repository":{"type":"git","url":"https://github.com/Rich-Harris/simulant"},"main":"simulant.js","scripts":{"prepublish":"npm run build","build":"gobble build .tmp -f; cp .tmp/simulant.js simulant.js"},"devDependencies":{"gobble":"^0.6.10","gobble-es6-transpiler":"^0.1.0"},"files":["simulant.js","README.md"],"gitHead":"e0cb631fc6c70e7910b6db39ce677770a47088f7","bugs":{"url":"https://github.com/Rich-Harris/simulant/issues"},"homepage":"https://github.com/Rich-Harris/simulant","_id":"simulant@0.1.3","_shasum":"c8c5ac7bffbf2a862f257ded6536c5280fe2a977","_from":".","_npmVersion":"1.4.23","_npmUser":{"name":"rich_harris","email":"richard.a.harris@gmail.com"},"maintainers":[{"name":"rich_harris","email":"richard.a.harris@gmail.com"}],"dist":{"shasum":"c8c5ac7bffbf2a862f257ded6536c5280fe2a977","tarball":"https://registry.npmjs.org/simulant/-/simulant-0.1.3.tgz","integrity":"sha512-FH+3fYNd/B9NgaRGwmIVJl4iqT2UEZjmxUQNf6Lxwyfbb1Mu9PcxDKivoXNSNfUGw/S/ZgPJezF+d3lkKiRjWw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD4X9LOXAnxwFSUHmtxe2lqHs8yKDjBslCUZder1+gKKAIhANkqZOP0yH89iXjR1ae0l1jH0/owYvJDPgd/t4Z8StZr"}]}},"0.1.4":{"name":"simulant","description":"Simulated DOM events for automated testing","version":"0.1.4","author":{"name":"Rich Harris"},"license":"MIT","repository":{"type":"git","url":"https://github.com/Rich-Harris/simulant"},"main":"dist/simulant.js","jsnext:main":"src/simulant.js","scripts":{"prepublish":"npm run build","build":"npm run test; mkdir -p dist; cp .tmp/simulant.js dist/simulant.js","test":"mocha","start":"gobble"},"devDependencies":{"chai":"^2.2.0","gobble":"^0.7.13","gobble-babel":"^5.0.0","gobble-cli":"^0.3.5","gobble-esperanto-bundle":"^0.1.7","gobble-sorcery":"^0.2.5","jsdom":"^4.1.0","mocha":"^2.2.3","phantomjs":"^1.9.16"},"files":["simulant.js","README.md"],"gitHead":"d5dbdb97213e02c630f8222b29bd6a8cadbe3906","bugs":{"url":"https://github.com/Rich-Harris/simulant/issues"},"homepage":"https://github.com/Rich-Harris/simulant","_id":"simulant@0.1.4","_shasum":"a5090ddc147b5df5135d8be3bd1b677bcfeaf0df","_from":".","_npmVersion":"2.5.1","_nodeVersion":"1.2.0","_npmUser":{"name":"rich_harris","email":"richard.a.harris@gmail.com"},"maintainers":[{"name":"rich_harris","email":"richard.a.harris@gmail.com"}],"dist":{"shasum":"a5090ddc147b5df5135d8be3bd1b677bcfeaf0df","tarball":"https://registry.npmjs.org/simulant/-/simulant-0.1.4.tgz","integrity":"sha512-oAsQ78gSJ8cLutYoWAFD2By+Oc7OJ7RlE+wYdfgQho0g6+5zsi7SJMxjeOTVbCW3NJ/Kt0cZjZQGSKcdBfvaww==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDxkP9r9oLSTOvlyZzjTVOGGJyXsLgBi0V9Dl7wYzq0HAIhAMm2wrJROFhPm/B2ea1yyi3Y4dQVa1OLL3FxwnDwguV1"}]}},"0.1.5":{"name":"simulant","description":"Simulated DOM events for automated testing","version":"0.1.5","author":{"name":"Rich Harris"},"license":"MIT","repository":{"type":"git","url":"https://github.com/Rich-Harris/simulant"},"main":"dist/simulant.js","jsnext:main":"src/simulant.js","scripts":{"prepublish":"npm run build","build":"npm run test; mkdir -p dist; cp .tmp/simulant.js dist/simulant.js","test":"mocha","start":"gobble"},"devDependencies":{"chai":"^2.2.0","gobble":"^0.7.13","gobble-babel":"^5.0.0","gobble-cli":"^0.3.5","gobble-esperanto-bundle":"^0.1.7","gobble-sorcery":"^0.2.5","jsdom":"^4.1.0","mocha":"^2.2.3","phantomjs":"^1.9.16"},"files":["dist","src","README.md"],"gitHead":"5024b2bc7ce9cb23bcc62832d8d2c52efc79be82","bugs":{"url":"https://github.com/Rich-Harris/simulant/issues"},"homepage":"https://github.com/Rich-Harris/simulant","_id":"simulant@0.1.5","_shasum":"543088cd3755ef82955fb7dcac638633c7a36c64","_from":".","_npmVersion":"2.5.1","_nodeVersion":"1.2.0","_npmUser":{"name":"rich_harris","email":"richard.a.harris@gmail.com"},"maintainers":[{"name":"rich_harris","email":"richard.a.harris@gmail.com"}],"dist":{"shasum":"543088cd3755ef82955fb7dcac638633c7a36c64","tarball":"https://registry.npmjs.org/simulant/-/simulant-0.1.5.tgz","integrity":"sha512-XIZ1qxvNUccj2tjC4ae7mXqMOpe7OYJyMQ+qUISNJLR4zjwO2ubs3p89c4Rfs/nFxz/ftuQE+BvAWtFR4RA3SQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDrLxCZmxWCZH+ll6+aI/p/tPcS1YHCjZIkuN76BO++NAIgSVa5qypoy4PcsgwpMrl+87zsgsE5dRhJRbCl3jDC0Zc="}]}},"0.2.0":{"name":"simulant","description":"Simulated DOM events for automated testing","version":"0.2.0","author":{"name":"Rich Harris"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/Rich-Harris/simulant.git"},"main":"dist/simulant.umd.js","jsnext:main":"dist/simulant.es.js","scripts":{"prepublish":"npm run lint && rm -rf dist && npm test && npm run build:es","build":"npm run build:umd && npm run build:es","build:umd":"rollup -c -f umd -o dist/simulant.umd.js","build:es":"rollup -c -f es6 -o dist/simulant.es.js","test":"node test/run.js","pretest":"npm run build:umd","lint":"eslint src"},"devDependencies":{"babel-preset-es2015-rollup":"^1.1.1","chalk":"^1.1.1","eslint":"^1.10.3","nightmare":"^2.1.6","rollup":"^0.25.2","rollup-plugin-babel":"^2.3.9"},"files":["dist","README.md"],"gitHead":"b41228935697d0221b92f7abb2397cb85cd9c2fb","bugs":{"url":"https://github.com/Rich-Harris/simulant/issues"},"homepage":"https://github.com/Rich-Harris/simulant#readme","_id":"simulant@0.2.0","_shasum":"18e409eadabf3b01915512ebfa9c7c5c19521486","_from":".","_npmVersion":"2.14.4","_nodeVersion":"4.1.1","_npmUser":{"name":"rich_harris","email":"richard.a.harris@gmail.com"},"dist":{"shasum":"18e409eadabf3b01915512ebfa9c7c5c19521486","tarball":"https://registry.npmjs.org/simulant/-/simulant-0.2.0.tgz","integrity":"sha512-FoXbCyULsw0owkM6ou+F008prt7Ll6c9QRdySTjkg7Xkn9TGpthbabxwMWRxcu+592goQeGR1EC+xmo3Hziwdw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC2MVvdNvPqNaFjzIpI2FeFS6qCF1Elvc6n/qjfV4QV8AIgbLKF3c1rMi/a7CCiAeVduzu1nsdiexhFUehB4HEo428="}]},"maintainers":[{"name":"rich_harris","email":"richard.a.harris@gmail.com"}],"_npmOperationalInternal":{"host":"packages-6-west.internal.npmjs.com","tmp":"tmp/simulant-0.2.0.tgz_1454530411356_0.2688792503904551"}},"0.2.1":{"name":"simulant","description":"Simulated DOM events for automated testing","version":"0.2.1","author":{"name":"Rich Harris"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/Rich-Harris/simulant.git"},"main":"dist/simulant.umd.js","jsnext:main":"dist/simulant.es.js","scripts":{"prepublish":"npm run lint && rm -rf dist && npm test && npm run build:es","build":"npm run build:umd && npm run build:es","build:umd":"rollup -c -f umd -o dist/simulant.umd.js","build:es":"rollup -c -f es6 -o dist/simulant.es.js","test":"node test/run.js","pretest":"npm run build:umd","lint":"eslint src"},"devDependencies":{"chalk":"^1.1.3","eslint":"^2.8.0","nightmare":"^2.3.4","rollup":"^0.26.0","rollup-plugin-buble":"^0.6.0"},"files":["dist","README.md"],"gitHead":"34967f56bb9fe9d5385b8edcf47a981f1a1fddde","bugs":{"url":"https://github.com/Rich-Harris/simulant/issues"},"homepage":"https://github.com/Rich-Harris/simulant#readme","_id":"simulant@0.2.1","_shasum":"ab36f5e14cbe692667c7d3dce2ba8f7a4ed3888a","_from":".","_npmVersion":"3.8.3","_nodeVersion":"5.10.1","_npmUser":{"name":"rich_harris","email":"richard.a.harris@gmail.com"},"dist":{"shasum":"ab36f5e14cbe692667c7d3dce2ba8f7a4ed3888a","tarball":"https://registry.npmjs.org/simulant/-/simulant-0.2.1.tgz","integrity":"sha512-ryi1tvD+AYvyLEqetWzq34uf3EZFM5W+x/A2lHGCavIO7cv6xhMyuiUCcsB2/2YEpiOGs0DeMAyAw+062BFYBQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIED68q2JokLaCYfWBxjK5sw72ZTlw3cCNgKfHBmJKw7aAiEA/OhHjtOpI3bqJDOU88IPJhwTN69XLOb01U2uayqtoJw="}]},"maintainers":[{"name":"rich_harris","email":"richard.a.harris@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/simulant-0.2.1.tgz_1461726152942_0.2834142108913511"}},"0.2.2":{"name":"simulant","description":"Simulated DOM events for automated testing","version":"0.2.2","author":{"name":"Rich Harris"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/Rich-Harris/simulant.git"},"main":"dist/simulant.umd.js","jsnext:main":"dist/simulant.es.js","scripts":{"prepublish":"npm run lint && rm -rf dist && npm test && npm run build:es","build":"npm run build:umd && npm run build:es","build:umd":"rollup -c -f umd -o dist/simulant.umd.js","build:es":"rollup -c -f es6 -o dist/simulant.es.js","test":"node test/run.js","pretest":"npm run build:umd","lint":"eslint src"},"devDependencies":{"chalk":"^1.1.3","eslint":"^2.8.0","nightmare":"^2.3.4","rollup":"^0.26.0","rollup-plugin-buble":"^0.7.0"},"files":["dist","README.md"],"gitHead":"8e6b09e78fa479a5cb27edb913b2c139533b634d","bugs":{"url":"https://github.com/Rich-Harris/simulant/issues"},"homepage":"https://github.com/Rich-Harris/simulant#readme","_id":"simulant@0.2.2","_shasum":"f1bce52712b6a7a0da38ddfdda7e83b20b1da01e","_from":".","_npmVersion":"3.8.6","_nodeVersion":"6.0.0","_npmUser":{"name":"rich_harris","email":"richard.a.harris@gmail.com"},"dist":{"shasum":"f1bce52712b6a7a0da38ddfdda7e83b20b1da01e","tarball":"https://registry.npmjs.org/simulant/-/simulant-0.2.2.tgz","integrity":"sha512-YV1S5PNZp2BBwdmv32bVMsvWy8zycEViiGs+To9AUa4ic6x5Sv/7UhvXq2lXWobIlC7zDoMoULO9IDHNdi+3PQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEJJobIY5zwPsgWLJpkFi5yOtHm1nYO8LJ71ItVqFQJrAiAbQAyhIB1FNcXSp+yNEPasP7aVKSslQyTM+/+tfBMvnA=="}]},"maintainers":[{"name":"rich_harris","email":"richard.a.harris@gmail.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/simulant-0.2.2.tgz_1462464405106_0.15240169130265713"}}},"readme":"# simulant.js\n\n**Simulated DOM events for automated testing**\n\n## What's this for?\n\nSometimes you need to create fake DOM events so that you can test the parts of your app or library that depend on user input. But doing so is a royal pain in the arse:\n\n```js\n// WITHOUT SIMULANT.JS\ntry {\n  // DOM Level 3\n  event = new MouseEvent( 'mousemove', {\n    bubbles: true,\n    cancelable: true,\n    relatedTarget: previousNode\n  });\n\n  node.dispatchEvent( event );\n}\n\ncatch ( err ) {\n  if ( document.createEvent ) {\n    // DOM Level 2\n    event = document.createEvent( 'MouseEvents' );\n    event.initMouseEvent( 'mousemove', true, true, window, null, 0, 0, 0, 0, '', false, false, false, false, 0, previousNode );\n\n    node.dispatchEvent( event );\n  }\n\n  else {\n    // IE8 and below\n    event = document.createEventObject();\n    event.relatedTarget = previousNode;\n\n    node.fireEvent( 'onmousemove', event );\n  }\n}\n\n\n// WITH SIMULANT.JS\nsimulant.fire( node, 'mousemove', { relatedTarget: previousNode });\n```\n\nSimulant was created to make automated testing of [Ractive.js](https://github.com/ractivejs/ractive) across different browsers easier.\n\n\n## Why not just use jQuery?\n\nIn some cases you can. But events created with `$(element).trigger('click')`, for example, won't trigger handlers bound using `element.addEventListener('click', handler)` in many situations, such as when you're doing automated tests with [PhantomJS](http://phantomjs.org/).\n\nSimulant uses native DOM events, not fake events, so its behaviour is more predictable.\n\n\n## Installation\n\n```bash\nnpm install simulant\n```\n\n\n## Usage\n\n```js\n// Create a simulated event\nevent = simulant( 'click' );\n\n// Create a simulated event with parameters, e.g. a middle-click\nevent = simulant( 'click', { button: 1, which: 2 });\n\n// Fire a previously created event\ntarget = document.getElementById( 'target' );\nsimulant.fire( target, event );\n\n// Create an event and fire it immediately\nsimulant.fire( target, 'click' );\nsimulant.fire( target, 'click', { button: 1, which: 2 });\n\n// Polyfill addEventListener in old browsers\nif ( !window.addEventListener ) {\n  simulant.polyfill();\n}\n```\n\n\n## Limitations\n\nNormally, events have side-effects - a click in a text input will focus it, a mouseover of an element will trigger its hover state, and so on. When creating events programmatically, these side-effects don't happen - so your tests shouldn't expect them to. For example you shouldn't fire simulated keypress events at an input element and expect its value to change accordingly.\n\nThere are exceptions - a click event on a checkbox input will cause a secondary change event to be fired, for example.\n\n\n## Building and testing\n\nSimulant uses [jsdom](https://github.com/tmpvar/jsdom) for testing, which requires [io.js](iojs.org) rather than node.js.\n\nTo build the library, do `npm run build`.\n\nTo test the library using jsdom, do `npm test`.\n\nTo test the library in browsers, do `npm start`. This will build the library (and watch the source files for changes) and serve a simple test page to [localhost:4567](http://localhost:4567).\n\n\n## License\n\nCopyright (c) 2013-16 [Rich Harris](http://rich-harris.co.uk) ([@rich_harris](http://twitter.com/rich_harris)).\nReleased under an MIT license.\n","maintainers":[{"name":"rich_harris","email":"richard.a.harris@gmail.com"}],"time":{"modified":"2022-06-26T20:09:40.841Z","created":"2013-08-30T13:45:53.252Z","0.1.0":"2013-08-30T13:45:56.123Z","0.1.2":"2014-09-01T00:07:25.694Z","0.1.3":"2014-11-23T22:54:11.430Z","0.1.4":"2015-04-07T21:22:30.403Z","0.1.5":"2015-04-09T01:57:27.090Z","0.2.0":"2016-02-03T20:13:34.234Z","0.2.1":"2016-04-27T03:02:35.454Z","0.2.2":"2016-05-05T16:06:46.670Z"},"author":{"name":"Rich Harris"},"repository":{"type":"git","url":"git+https://github.com/Rich-Harris/simulant.git"},"homepage":"https://github.com/Rich-Harris/simulant#readme","bugs":{"url":"https://github.com/Rich-Harris/simulant/issues"},"readmeFilename":"README.md","license":"MIT","users":{"antixrist":true}}