adopted-ember-addons / adopted-ember-addons/ember-paper

paper-autocomplete breaking following tests

Open
#729 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
879
Forks
327
PR merge metrics
No merged PRs in 30d

Description

I have run into a scenario where I am testing the options returned in an paper-autocomplete. If I do not select an option, all the following integration and unit tests fail. I have simplified my code to help illustrate the issue.

Here is the autocomplete from my template.

```EmberScript
{{#paper-autocomplete
triggerClass="cd-autcomplete-selector"
placeholder="Find a location..."
label="Find a location..."
allowClear=true
searchText=(readonly locationSearchText)
onSearchTextChange=(action (mut locationSearchText))
selected=selectedLocation
search=(route-action "search")
searchField="label"
labelPath="label"
loadingMessage="Searching locations..."
noMatchesMessage="We were unable to find that location."
onSelectionChange=(action (mut selectedLocation)) as |location autocomplete|}}
{{paper-autocomplete-highlight searchText=term.searchText flags="i" label=location.label}}
{{else}}
We are unable to find that busienss location!
{{/paper-autocomplete}}
```

Here is my search action:

```javascript
search () {
return [
{ field: 'name', label: 'Marietta' },
{ field: 'name', label: 'Mountville' },
{ field: 'name', label: 'Lancaster' }
]
}
```

Here is my acceptance test:
```javascript
test('autocomplete test', function (assert) {
visit('/autocomplete')

fillIn('.cd-autcomplete-selector input', 'Mar')

andThen(() => {
assert.equal(find('.ember-power-select-option:contains(Marietta)').length, 1, 'Should show Marietta.')
})
})
```

After adding the code 137 tests are failing.

screen shot 2017-06-09 at 3 27 55 pm

I have found a work around for this issue. Which may help you diagnose this issue. By adding a call to selectChoose to select an option. All tests are fixed and pass again.

```javascript
test('autocomplete test', function (assert) {
visit('/autocomplete')

fillIn('.cd-autcomplete-selector input', 'Mar')

andThen(() => {
assert.equal(find('.ember-power-select-option:contains(Marietta)').length, 1, 'Should show Marietta.')

selectChoose('.cd-autcomplete-selector', '.ember-power-select-option:eq(0)')
})
})
```

screen shot 2017-06-09 at 3 16 49 pm

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.