@testing-library/user-event
Advanced tools
Comparing version 8.0.4 to 8.0.5
@@ -248,1 +248,21 @@ import React from "react"; | ||
}); | ||
it("should not focus disabled elements", () => { | ||
const { getByTestId } = render( | ||
<div> | ||
<input data-testid="one" /> | ||
<input tabIndex={-1} /> | ||
<button disabled>click</button> | ||
<input disabled /> | ||
<input data-testid="five" /> | ||
</div> | ||
); | ||
const [one, five] = [getByTestId("one"), getByTestId("five")]; | ||
userEvent.tab(); | ||
expect(one).toHaveFocus(); | ||
userEvent.tab(); | ||
expect(five).toHaveFocus(); | ||
}); |
@@ -299,3 +299,3 @@ "use strict"; | ||
let list = Array.prototype.filter.call(focusableElements, function (item) { | ||
return item.getAttribute("tabindex") !== "-1"; | ||
return item.getAttribute("tabindex") !== "-1" && !item.disabled; | ||
}).map((el, idx) => ({ | ||
@@ -302,0 +302,0 @@ el, |
{ | ||
"name": "@testing-library/user-event", | ||
"version": "8.0.4", | ||
"version": "8.0.5", | ||
"description": "Simulate user events for react-testing-library", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -244,4 +244,5 @@ import { fireEvent } from "@testing-library/dom"; | ||
); | ||
let list = Array.prototype.filter.call(focusableElements, function (item) { | ||
return item.getAttribute("tabindex") !== "-1"; | ||
return item.getAttribute("tabindex") !== "-1"&& !item.disabled; | ||
}).map((el, idx) => ({ el, idx })) | ||
@@ -248,0 +249,0 @@ .sort((a, b) => { |
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
12863762
2183