Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add API docs for isDisabled() assertion #85

Merged
merged 1 commit into from
Apr 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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