Skip to content

Public test helpers

Compare
Choose a tag to compare
@sir-dunxalot sir-dunxalot released this 14 Dec 02:55
· 553 commits to master since this release
  • #114 - Public test helpers
    • introduces test helpers (assertTooltipNotRendered, assertTooltipRendered, assertTooltipVisible, assertTooltipNotVisible, and triggerTooltipTargetEvent). See documentation here.
    • Fixes issue where a tooltip target was mouseenter then mouseleave before the tooltip could render. This use to cause "sticking tooltips"
    • Fixes issue where two click events were registered when a user clicked on a tooltip. This produced no UI issues but broke some consuming app's tests
    • Under-the-cover event handling and databinding improvements (no UI effect)
    • More test coverage
    • Tests pass in all scenarios (previously ember-beta and ember-canary were failing)

The test helpers we use within this addon are now available in consuming app's integration and acceptance tests. Here is a real-life example of a consuming app using the helpers.

import { triggerTooltipTargetEvent, assertTooltipNotRendered, assertTooltipRendered, assertTooltipVisible } from 'ember-simple/tests/helpers/ember-tooltips';

moduleForAcceptance('Acceptance | index');

test('visiting / and check tooltip', function(assert) {
  visit('/');

  andThen(function() {

      assert.equal(currentURL(), '/');

      const $tooltipTarget = Ember.$('.js-test-ember-tooltip-target');

      triggerTooltipTargetEvent($tooltipTarget, 'click');

      assertTooltipRendered(assert, {selector: '.js-test-ember-tooltip'});

      assertTooltipVisible(assert, {selector: '.js-test-ember-tooltip'});

  });
});

Documentation for test helpers exists in the readme.

More test helpers will be added in the future, including checking tooltip content and the tooltip positions. This request is tracked by #128.