diff --git a/API.md b/API.md index 22778b4ba..3426b4ba3 100644 --- a/API.md +++ b/API.md @@ -15,6 +15,7 @@ - [isVisible](#isvisible) - [isNotVisible](#isnotvisible) - [hasAttribute](#hasattribute) + - [isDisabled](#isdisabled) - [isNotDisabled](#isnotdisabled) - [doesNotHaveAttribute](#doesnothaveattribute) - [hasClass](#hasclass) @@ -254,8 +255,27 @@ or regular expression. assert.dom('input.password-input').hasAttribute('type', 'password'); ``` +### isDisabled + +- **See: [#isNotDisabled](#isNotDisabled)** + +Assert that the [HTMLElement][] or an [HTMLElement][] matching the +`selector` is disabled. + +**Parameters** + +- `message` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** + +**Examples** + +```javascript +assert.dom('.foo').isDisabled(); +``` + ### isNotDisabled +- **See: [#isDisabled](#isDisabled)** + Assert that the [HTMLElement][] or an [HTMLElement][] matching the `selector` is not disabled. diff --git a/documentation.yml b/documentation.yml index 678a928b2..e4f31d84f 100644 --- a/documentation.yml +++ b/documentation.yml @@ -29,6 +29,7 @@ toc: - isVisible - isNotVisible - hasAttribute + - isDisabled - isNotDisabled - doesNotHaveAttribute - hasClass diff --git a/lib/assertions.js b/lib/assertions.js index ac4574958..57506bf01 100644 --- a/lib/assertions.js +++ b/lib/assertions.js @@ -259,6 +259,18 @@ export default class DOMAssertions { } } + /** + * Assert that the [HTMLElement][] or an [HTMLElement][] matching the + * `selector` is disabled. + * + * @name isDisabled + * @param {string?} message + * + * @example + * assert.dom('.foo').isDisabled(); + * + * @see {@link #isNotDisabled} + */ isDisabled(message) { let element = this.findTargetElement(); @@ -290,6 +302,7 @@ export default class DOMAssertions { * @example * assert.dom('.foo').isNotDisabled(); * + * @see {@link #isDisabled} */ isNotDisabled(message) { isNotDisabled.call(this, message);