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

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

Offen
#498 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
TypeScript
Sterne
299
Forks
159
Ø Merge
4 T. 6 Std.
Gemergte PRs (30 T.)
4

Beschreibung

**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}}
    ```

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.