{"id":20630208,"url":"https://github.com/macacajs/dom-event-simulate","last_synced_at":"2025-04-15T18:19:53.847Z","repository":{"id":34246067,"uuid":"154090966","full_name":"macacajs/dom-event-simulate","owner":"macacajs","description":"simulate user interaction with DOM events.","archived":false,"fork":false,"pushed_at":"2022-04-24T02:11:49.000Z","size":70,"stargazers_count":30,"open_issues_count":0,"forks_count":2,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-04-15T18:19:49.711Z","etag":null,"topics":["dom-events","event","macaca"],"latest_commit_sha":null,"homepage":"https://macacajs.github.io/dom-event-simulate/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/macacajs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-10-22T05:21:15.000Z","updated_at":"2024-01-22T09:28:55.000Z","dependencies_parsed_at":"2022-08-08T00:02:24.215Z","dependency_job_id":null,"html_url":"https://github.com/macacajs/dom-event-simulate","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/macacajs%2Fdom-event-simulate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/macacajs%2Fdom-event-simulate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/macacajs%2Fdom-event-simulate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/macacajs%2Fdom-event-simulate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/macacajs","download_url":"https://codeload.github.com/macacajs/dom-event-simulate/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249126007,"owners_count":21216705,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dom-events","event","macaca"],"created_at":"2024-11-16T14:07:11.756Z","updated_at":"2025-04-15T18:19:53.831Z","avatar_url":"https://github.com/macacajs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dom-event-simulate\n\n[![NPM version][npm-image]][npm-url]\n[![Package quality][quality-image]][quality-url]\n[![CI][CI-image]][CI-url]\n[![Test coverage][coveralls-image]][coveralls-url]\n[![node version][node-image]][node-url]\n[![npm download][download-image]][download-url]\n\n[npm-image]: https://img.shields.io/npm/v/dom-event-simulate.svg\n[npm-url]: https://npmjs.org/package/dom-event-simulate\n[quality-image]: https://packagequality.com/shield/dom-event-simulate.svg\n[quality-url]: https://packagequality.com/#?package=dom-event-simulate\n[CI-image]: https://github.com/macacajs/dom-event-simulate/actions/workflows/ci.yml/badge.svg\n[CI-url]: https://github.com/macacajs/dom-event-simulate/actions/workflows/ci.yml\n[coveralls-image]: https://img.shields.io/coveralls/macacajs/dom-event-simulate.svg\n[coveralls-url]: https://coveralls.io/r/macacajs/dom-event-simulate?branch=master\n[node-image]: https://img.shields.io/badge/node.js-%3E=_8-green.svg\n[node-url]: http://nodejs.org/download/\n[download-image]: https://img.shields.io/npm/dm/dom-event-simulate.svg\n[download-url]: https://npmjs.org/package/dom-event-simulate\n\n\u003e simulate user interaction with DOM events.\n\n\u003c!-- GITCONTRIBUTOR_START --\u003e\n\n## Contributors\n\n|[\u003cimg src=\"https://avatars.githubusercontent.com/u/1011681?v=4\" width=\"100px;\"/\u003e\u003cbr/\u003e\u003csub\u003e\u003cb\u003exudafeng\u003c/b\u003e\u003c/sub\u003e](https://github.com/xudafeng)\u003cbr/\u003e|[\u003cimg src=\"https://avatars.githubusercontent.com/u/1209810?v=4\" width=\"100px;\"/\u003e\u003cbr/\u003e\u003csub\u003e\u003cb\u003eparadite\u003c/b\u003e\u003c/sub\u003e](https://github.com/paradite)\u003cbr/\u003e|[\u003cimg src=\"https://avatars.githubusercontent.com/u/10104168?v=4\" width=\"100px;\"/\u003e\u003cbr/\u003e\u003csub\u003e\u003cb\u003eyihuineng\u003c/b\u003e\u003c/sub\u003e](https://github.com/yihuineng)\u003cbr/\u003e|[\u003cimg src=\"https://avatars.githubusercontent.com/u/8325822?v=4\" width=\"100px;\"/\u003e\u003cbr/\u003e\u003csub\u003e\u003cb\u003eelaine1234\u003c/b\u003e\u003c/sub\u003e](https://github.com/elaine1234)\u003cbr/\u003e|[\u003cimg src=\"https://avatars.githubusercontent.com/u/252317?v=4\" width=\"100px;\"/\u003e\u003cbr/\u003e\u003csub\u003e\u003cb\u003ecyjake\u003c/b\u003e\u003c/sub\u003e](https://github.com/cyjake)\u003cbr/\u003e|[\u003cimg src=\"https://avatars.githubusercontent.com/u/52845048?v=4\" width=\"100px;\"/\u003e\u003cbr/\u003e\u003csub\u003e\u003cb\u003esnapre\u003c/b\u003e\u003c/sub\u003e](https://github.com/snapre)\u003cbr/\u003e|\n| :---: | :---: | :---: | :---: | :---: | :---: |\n\n\nThis project follows the git-contributor [spec](https://github.com/xudafeng/git-contributor), auto updated at `Sun Apr 24 2022 00:26:12 GMT+0800`.\n\n\u003c!-- GITCONTRIBUTOR_END --\u003e\n\n## Installment\n\n```bash\n$ npm i dom-event-simulate --save-dev\n```\n\n## CDN\n\n```\nhttps://unpkg.com/dom-event-simulate@latest/lib/dom-event-simulate.js\n```\n\n## Usage\n\n```javascript\nconst { domEvent } = require('dom-event-simulate');\n// input @\ndomEvent(element, 'keydown', {\n  keyCode: 50,\n  key: '@',\n});\n// start a drag\ndomEvent(dom, 'mousedown', {\n  clientX: point.x,\n  clientY: point.y,\n});\ndomEvent(dom, 'mousemove', {\n  clientX: point.x + 10,\n  clientY: point.y + 10,\n});\ndomEvent(dom, 'mouseup', {\n  clientX: point.x + 10,\n  clientY: point.y + 10,\n});\n```\n\n```javascript\nvar element = document.querySelector('#input');\n\nelement.addEventListener('change', function(e) {\n  console.log(e.target.files);\n}, false);\n\ndomEvent(element, 'change', {\n  data: {\n    target: {\n      files: [\n        {\n          file: 'file1.png',\n        },\n        {\n          file: 'file2.jpg',\n        }\n      ],\n    },\n  }\n});\n```\n\n## Use with macaca-wd\n\nsee: https://macacajs.github.io/macaca-wd/#domEvent\n\n## Support Events\n\n| type | name | args |\n| --- | --- | --- |\n| mouseEvents | click | |\n| mouseEvents | dblclick | |\n| mouseEvents | mouseover | |\n| mouseEvents | mouseout | |\n| mouseEvents | mouseenter | |\n| mouseEvents | mouseleave | |\n| mouseEvents | mousedown | |\n| mouseEvents | mouseup | |\n| mouseEvents | mousemove | |\n| mouseEvents | dragstart | |\n| mouseEvents | dragenter | |\n| mouseEvents | dragover | |\n| mouseEvents | dragleave | |\n| mouseEvents | drag | |\n| mouseEvents | drop | |\n| mouseEvents | dragend | |\n| mouseEvents | wheel | |\n| keyboardEvent | keydown | |\n| keyboardEvent | keyup | |\n| keyboardEvent | keypress | |\n| UIEvents | submit | |\n| UIEvents | blur | |\n| UIEvents | change | |\n| UIEvents | focus | |\n| UIEvents | resize | |\n| UIEvents | scroll | |\n| UIEvents | select | |\n| bubbleEvents | scroll | |\n| bubbleEvents | resize | |\n| bubbleEvents | reset | |\n| bubbleEvents | change | |\n| bubbleEvents | select | |\n| bubbleEvents | error | |\n| bubbleEvents | abort | |\n| TouchEvent | touchstart | |\n| TouchEvent | touchmove | |\n| TouchEvent | touchend | |\n| TouchEvent | touchcancel | |\n| GestureEvent | gesturestart | |\n| GestureEvent | gesturechange | |\n| GestureEvent | gestureend | |\n\n## Helper Methods\n\n```javascript\nconst { helper: eventHelper } = require('dom-event-simulate');\n\n// Type content to input element.\neventHelper.elementInput\n\n// Type content to a contentEditable element.\neventHelper.formInput\n```\n\n## License\n\nThe MIT License (MIT)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmacacajs%2Fdom-event-simulate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmacacajs%2Fdom-event-simulate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmacacajs%2Fdom-event-simulate/lists"}