adopted-ember-addons / adopted-ember-addons/ember-sortable

The reorder test helper does not work correctly when a direction is explicitly set

未关闭
#498 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
TypeScript
星标
299
派生
159
平均合并
4 天 6 小时
30 天内合并 PR
4

描述

**Describe the bug**
The reorder test helper does not work correctly when a direction is explicitly set.

**To Reproduce**
Steps to reproduce the behavior:

1. Use `{{sortable-group groupName="closableTabs" direction='x' onChange=@onReorder}}` on a List Element2.
2. Use the reorder helper in the test file

**Expected behavior**
The new order of the items in the list is the one provided to the reorder helper.

**Additional context**

#### The Template File
```hbs


    {{#each @views as |exploration|}}

  1. ...
    ```

    #### Inside the test logic

    ```ts
    import { reorder } from 'ember-sortable/test-support/helpers';

    ...

    await reorder(
    'mouse',
    '[data-test-tabs]',
    `[data-test-id="${explorations[1].explorationId}"]`,
    `[data-test-id="${explorations[0].explorationId}"]`,
    `[data-test-id="${explorations[3].explorationId}"]`,
    `[data-test-id="${explorations[2].explorationId}"]`
    );
    ```

    **Workaround**

    ```ts
    get direction() {
    if (ENV.environment === 'test') {
    return;
    }
    return 'x';
    }
    ```

    ```diff
    + {{sortable-group groupName="closableTabs" direction=this.direction onChange=@onReorder}}
    - {{sortable-group groupName="closableTabs" direction='x' onChange=@onReorder}}
    ```

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

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