Skip to content
This repository was archived by the owner on May 26, 2019. It is now read-only.

Commit 6b05b02

Browse files
algo74toddjordan
authored andcommitted
Fix second test in autocomplete-component (#2271)
At least in my case, the test was falling because `triggerKeyEvent(this.element.querySelector('.list-filter input'), "keyup", 83);` apparently did not modify the value of the input field.
1 parent 34fa393 commit 6b05b02

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

source/tutorial/autocomplete-component.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -467,10 +467,10 @@ represented by the variable `FILTERED_ITEMS` when any value is set.
467467

468468
We force the action by generating a `keyUp` event on our input field, and then assert that only one item is rendered.
469469

470-
First add `triggerKeyEvent` to the list of imports. The [`triggerKeyEvent`](https://github.com/emberjs/ember-test-helpers/blob/master/API.md#triggerkeyevent) helper sends a key stroke event to the UI, simulating the user typing a key.
470+
First add `triggerKeyEvent` and `fillIn` to the list of imports. The [`fillIn`](https://github.com/emberjs/ember-test-helpers/blob/master/API.md#fillin) helper simulates the user filling in the element. The [`triggerKeyEvent`](https://github.com/emberjs/ember-test-helpers/blob/master/API.md#triggerkeyevent) helper sends a key stroke event to the UI, simulating the user typing a key.
471471

472472
```tests/integration/components/list-filter-test.js
473-
import { render, settled, triggerKeyEvent } from '@ember/test-helpers';
473+
import { render, settled, triggerKeyEvent, fillIn } from '@ember/test-helpers';
474474
```
475475

476476
Now use it to simulate the user typing a key into the search field.
@@ -501,6 +501,8 @@ test('should update with matching listings', async function (assert) {
501501
{{/list-filter}}
502502
`);
503503
504+
// filling in the component's input field with 's'
505+
await fillIn(this.element.querySelector('.list-filter input'),'s');
504506
// The keyup event here should invoke an action that will cause the list to be filtered
505507
await triggerKeyEvent(this.element.querySelector('.list-filter input'), "keyup", 83);
506508

0 commit comments

Comments
 (0)