Skip to content

Commit

Permalink
Add API docs for isDisabled() assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
Turbo87 committed Apr 19, 2018
1 parent c3bc78b commit 25c621b
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
20 changes: 20 additions & 0 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
- [isVisible](#isvisible)
- [isNotVisible](#isnotvisible)
- [hasAttribute](#hasattribute)
- [isDisabled](#isdisabled)
- [isNotDisabled](#isnotdisabled)
- [doesNotHaveAttribute](#doesnothaveattribute)
- [hasClass](#hasclass)
Expand Down Expand Up @@ -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.

Expand Down
1 change: 1 addition & 0 deletions documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ toc:
- isVisible
- isNotVisible
- hasAttribute
- isDisabled
- isNotDisabled
- doesNotHaveAttribute
- hasClass
Expand Down
13 changes: 13 additions & 0 deletions lib/assertions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -290,6 +302,7 @@ export default class DOMAssertions {
* @example
* assert.dom('.foo').isNotDisabled();
*
* @see {@link #isDisabled}
*/
isNotDisabled(message) {
isNotDisabled.call(this, message);
Expand Down

0 comments on commit 25c621b

Please sign in to comment.