From 215955ee5ea3582d49471f327291924deb44ff42 Mon Sep 17 00:00:00 2001 From: Matan Borenkraout Date: Sun, 7 May 2023 23:02:16 +0300 Subject: [PATCH] feat: add an isDisabled function to identify whether elements are disabled or not (#919) Co-authored-by: Sebastian Silbermann --- .changeset/rare-cycles-nail.md | 5 +++++ sources/__tests__/is-disabled.js | 20 ++++++++++++++++++++ sources/index.ts | 1 + sources/is-disabled.ts | 27 +++++++++++++++++++++++++++ 4 files changed, 53 insertions(+) create mode 100644 .changeset/rare-cycles-nail.md create mode 100644 sources/__tests__/is-disabled.js create mode 100644 sources/is-disabled.ts diff --git a/.changeset/rare-cycles-nail.md b/.changeset/rare-cycles-nail.md new file mode 100644 index 00000000..09c8e778 --- /dev/null +++ b/.changeset/rare-cycles-nail.md @@ -0,0 +1,5 @@ +--- +"dom-accessibility-api": minor +--- + +add an `isDisabled` function to check if elements are disabled or not diff --git a/sources/__tests__/is-disabled.js b/sources/__tests__/is-disabled.js new file mode 100644 index 00000000..9c6f88be --- /dev/null +++ b/sources/__tests__/is-disabled.js @@ -0,0 +1,20 @@ +import { isDisabled } from "../is-disabled"; +import { cleanup, renderIntoDocument } from "./helpers/test-utils"; + +describe("isDisabled", () => { + afterEach(cleanup); + test.each([ + ["