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

paper-autocomplete breaking following tests

未关闭
#729 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
JavaScript
星标
879
派生
327
PR 合并指标
30 天内没有已合并 PR

描述

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

贡献指南

打开贡献指南

调研方向

Start with the paper-autocomplete example and the acceptance test shown in the issue, then run the focused test and the surrounding suite with and without selectChoose. Trace the autocomplete teardown or state handling that affects later tests; done means the test can leave the autocomplete unselected without causing subsequent unit and integration tests to fail.

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript
领域
frontend, testing-qa
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。