diff --git a/src/__tests__/to-be-disabled.js b/src/__tests__/to-be-disabled.js
index fcbd9ce4..e336a79e 100644
--- a/src/__tests__/to-be-disabled.js
+++ b/src/__tests__/to-be-disabled.js
@@ -283,3 +283,20 @@ test('.toBeEnabled custom element', () => {
expect(queryByTestId('enabled-custom-element')).not.toBeEnabled()
}).toThrowError('element is enabled')
})
+
+test('.toBeEnabled web-component', () => {
+ const {queryByTestId} = render(`
+
+
+ `)
+
+ expect(queryByTestId('disabled-custom-element')).not.toBeEnabled()
+ expect(() => {
+ expect(queryByTestId('disabled-custom-element')).toBeEnabled()
+ }).toThrowError('element is not enabled')
+
+ expect(queryByTestId('enabled-custom-element')).toBeEnabled()
+ expect(() => {
+ expect(queryByTestId('enabled-custom-element')).not.toBeEnabled()
+ }).toThrowError('element is enabled')
+})
diff --git a/src/to-be-disabled.js b/src/to-be-disabled.js
index 484437ad..846a69a8 100644
--- a/src/to-be-disabled.js
+++ b/src/to-be-disabled.js
@@ -50,7 +50,11 @@ function canElementBeDisabled(element) {
}
function isElementDisabled(element) {
- return canElementBeDisabled(element) && element.hasAttribute('disabled')
+ return (
+ canElementBeDisabled(element) &&
+ element.hasAttribute('disabled') &&
+ element.attributes.disabled.value !== 'false'
+ )
}
function isAncestorDisabled(element) {