Skip to content

Commit

Permalink
Merge pull request #31 from Oreoz/master
Browse files Browse the repository at this point in the history
Add includesText() alias
  • Loading branch information
Turbo87 authored Oct 17, 2017
2 parents 8cd7710 + a46087e commit 7753bc9
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,8 @@ matching the `selector` contains the given `text`, using the
[`textContent`](https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent)
attribute.

**Aliases:** `includesText`

**Parameters**

- `text` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)**
Expand Down
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,21 @@ A basic codemod to automatically convert your assertions is available at
[https://github.com/simplabs/qunit-dom-codemod](https://github.com/simplabs/qunit-dom-codemod).


Contributing
------------------------------------------------------------------------------

### How to Run Tests

```bash
yarn run test
```

### How to Generate the Documentation

```bash
yarn run docs
```

Related
------------------------------------------------------------------------------

Expand Down
6 changes: 6 additions & 0 deletions lib/assertions.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,8 @@ export default class DOMAssertions {
* [`textContent`](https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent)
* attribute.
*
* **Aliases:** `includesText`
*
* @param {string} text
* @param {string?} message
*
Expand All @@ -317,6 +319,10 @@ export default class DOMAssertions {
this.pushResult({ result, actual, expected, message });
}

includesText(expected, message) {
this.hasTextContaining(expected, message);
}

/**
* Assert that the `value` property of an [HTMLInputElement][] matches
* the `expected` text or regular expression.
Expand Down

0 comments on commit 7753bc9

Please sign in to comment.