Ember Simulant Test Helpers

0.3.2 · abandoned · verified Wed Apr 22

This package, `ember-simulant-test-helpers`, provides specialized Ember test helpers for simulating complex DOM interactions, particularly multi-touch gestures like panning. It achieves this by utilizing `simulant.js` to generate highly realistic synthetic DOM events. This allows for more granular control over event sequences than typically offered by standard Ember test helpers, enabling comprehensive testing of components that respond to advanced user interactions. The package is currently at version 0.3.2. Due to its last update being several years ago and its 0.x versioning, it is effectively abandoned and unlikely to receive further updates or compatibility fixes for newer Ember or JavaScript ecosystem versions. Its primary differentiator was its direct integration with `simulant.js` for detailed event simulation, offering a level of event fidelity often missing in basic test utilities.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates how to import and use the `panX` helper within an Ember rendering test to simulate a horizontal pan gesture on a DOM element.

import { find, render } from '@ember/test-helpers';
import { setupRenderingTest } from 'ember-qunit';
import { module, test } from 'qunit';
import { panX } from 'ember-simulant-test-helpers';

module('Integration | Helper | panX', function(hooks) {
  setupRenderingTest(hooks);

  test('it can simulate a horizontal pan gesture', async function(assert) {
    await render('<div class="my-swipe-aware-thingy" style="width: 200px; height: 100px; touch-action: none;"></div>');

    const element = find('.my-swipe-aware-thingy');
    let panDetected = false;
    element.addEventListener('panstart', () => panDetected = true);
    element.addEventListener('panend', () => assert.true(panDetected, 'Pan start should be detected'));

    await panX(element, {
      position: [50, 50],
      amount: 100,
      duration: 100
    });

    assert.dom('.my-swipe-aware-thingy').exists('The element should still be in the DOM');
    // In a real test, you'd assert on application state changes or CSS transformations
  });
});

view raw JSON →