diff --git a/API.md b/API.md index d389bd066..382d0025d 100644 --- a/API.md +++ b/API.md @@ -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)** diff --git a/README.md b/README.md index 6de422aeb..307517fb6 100644 --- a/README.md +++ b/README.md @@ -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 ------------------------------------------------------------------------------ diff --git a/lib/assertions.js b/lib/assertions.js index f190668b4..2e038cc38 100644 --- a/lib/assertions.js +++ b/lib/assertions.js @@ -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 * @@ -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.