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

paper-autocomplete breaking following tests

Đang mở
#729 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
JavaScript
Star
879
Fork
327
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.