@testing-library/user-event
Advanced tools
Comparing version 8.0.6 to 8.0.7
@@ -324,2 +324,20 @@ import React from "react"; | ||
}); | ||
it.each(["input", "textarea"])( | ||
"should not give focus for <%s> when mouseDown is prevented", | ||
type => { | ||
const { getByTestId } = render( | ||
React.createElement(type, { | ||
"data-testid": "element", | ||
onMouseDown: (evt) => { | ||
evt.preventDefault(); | ||
}, | ||
}) | ||
); | ||
userEvent.click(getByTestId("element")); | ||
expect(getByTestId("element")).not.toHaveFocus(); | ||
} | ||
); | ||
}); |
@@ -66,5 +66,7 @@ "use strict"; | ||
_dom.fireEvent.mouseDown(element); | ||
const continueDefaultHandling = _dom.fireEvent.mouseDown(element); | ||
element.focus(); | ||
if (continueDefaultHandling) { | ||
element.focus(); | ||
} | ||
@@ -71,0 +73,0 @@ _dom.fireEvent.mouseUp(element); |
{ | ||
"name": "@testing-library/user-event", | ||
"version": "8.0.6", | ||
"version": "8.0.7", | ||
"description": "Simulate user events for react-testing-library", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -259,2 +259,3 @@ <div align="center"> | ||
<td align="center"><a href="http://jagascript.com"><img src="https://avatars0.githubusercontent.com/u/4562878?v=4" width="100px;" alt=""/><br /><sub><b>Jaga Santagostino</b></sub></a><br /><a href="https://github.com/testing-library/user-event/commits?author=kandros" title="Code">๐ป</a> <a href="https://github.com/testing-library/user-event/commits?author=kandros" title="Tests">โ ๏ธ</a></td> | ||
<td align="center"><a href="http://jordy.app"><img src="https://avatars3.githubusercontent.com/u/12712484?v=4" width="100px;" alt=""/><br /><sub><b>jordyvandomselaar</b></sub></a><br /><a href="https://github.com/testing-library/user-event/commits?author=jordyvandomselaar" title="Code">๐ป</a> <a href="https://github.com/testing-library/user-event/commits?author=jordyvandomselaar" title="Tests">โ ๏ธ</a></td> | ||
</tr> | ||
@@ -261,0 +262,0 @@ </table> |
@@ -47,4 +47,6 @@ import { fireEvent } from "@testing-library/dom"; | ||
fireEvent.mouseMove(element); | ||
fireEvent.mouseDown(element); | ||
element.focus(); | ||
const continueDefaultHandling = fireEvent.mouseDown(element); | ||
if (continueDefaultHandling) { | ||
element.focus(); | ||
} | ||
fireEvent.mouseUp(element); | ||
@@ -51,0 +53,0 @@ fireEvent.click(element); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12867486
2251
270