https://github.com/nullvoxpopuli/testing-library-ember
maybe one day @testing-library/ember. Based off of https://testing-library.com/docs/dom-testing-library/intro and https://github.com/emberjs/ember-test-helpers
https://github.com/nullvoxpopuli/testing-library-ember
Last synced: over 1 year ago
JSON representation
maybe one day @testing-library/ember. Based off of https://testing-library.com/docs/dom-testing-library/intro and https://github.com/emberjs/ember-test-helpers
- Host: GitHub
- URL: https://github.com/nullvoxpopuli/testing-library-ember
- Owner: NullVoxPopuli
- Created: 2022-04-25T22:54:26.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-12-22T22:57:59.000Z (over 1 year ago)
- Last Synced: 2025-01-09T08:33:21.514Z (over 1 year ago)
- Language: JavaScript
- Size: 132 KB
- Stars: 6
- Watchers: 3
- Forks: 0
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# testing-library-ember
## Install
```
npm install --save-dev testing-library-ember
# or
yarn add --dev testing-library-ember
# or
pnpm add --save-dev testing-library-ember
```
Also, be sure to install `@testing-library/dom` and `@ember/test-helpers` (as they are peer dependencies)
## Compatibility
- `@testing-library/dom` v8+
- `ember-source` v3+
- `@ember/test-helpers` v2+
## Usage
For all synchronous queries, use [`@testing-library/dom`](https://testing-library.com/docs/dom-testing-library/install).
This library is only needed for the async behaviors of testing-library, such as `fireEvent.click` and `screen.findbyText`.
For example:
```js
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
import { screen } from '@testing-library/dom';
import { fireEvent } from 'ember-testing-library';
module(`Demo`, function(hooks) {
setupRenderingTest(hooks);
test('demo ember + testing-library', async function(assert) {
await render(hbs`...`);
let button = screen.getByRole('button', {name: 'Click Me'})
await fireEvent.click(button);
assert.strictEqual(screen.getByText('Output'), 'the new output');
});
});
```
See the tests in test-app for examples