ember-test-helpers icon indicating copy to clipboard operation
ember-test-helpers copied to clipboard

Not able to use `tab` helper

Open Jeyffrey opened this issue 3 years ago • 5 comments

Hello, I need some help ! When I do: import helpers from '@ember/test-helpers';

In the helpers object, I don't have the tab util. I already tried with the latest version.

Is it normal? Should I do something specific?

Jeyffrey avatar Aug 02 '22 15:08 Jeyffrey

have you tried named import:

import { tab } from '@ember/test-helpers';

?

ro0gr avatar Aug 04 '22 10:08 ro0gr

have you tried named import:

import { tab } from '@ember/test-helpers';

?

Yeah I also tried it

Jeyffrey avatar Aug 04 '22 11:08 Jeyffrey

May you provide with a minimal reproduction? otherwise it'd be impossible to reason about the issue.

ro0gr avatar Aug 04 '22 13:08 ro0gr

We added a trap-focus to a modal component with a modifier, and we wanted to test it. Here is the current branch https://github.com/1024pix/pix-ui/compare/dev...pix-5157-add-trap-focus.

Currently, in the project, the @ember/test-helpers version is 2.6.0, but I tried locally with the most recent one. So, after updating it, I tried to import the tab util, but I wasn't able to do it. Whereas, I have no trouble with the tap one, for example.

Jeyffrey avatar Aug 04 '22 14:08 Jeyffrey

Hello @ro0gr,

We've set up a minimal reproduction case.

The GitHub Action CI should fail because of the issue we have.

You can also run it locally with:

  1. Cloning the repo
  2. npm ci (we're using Node 16.14.0)
  3. npm test or npm start then going to http://localhost:4200/tests

The simple test we have is in the /tests/unit/components/trap-focus-test.js file. As you can see there, tap is imported and is a function but tab is not for some reason.

There is a warning because Ember CLI is not tested in our Node version because we're using the Ember 3.18.0 (the same issues occur with Ember 3.27.0) but we guessed it shouldn't cause this particular issue. (Our apps are slowly migrating to Ember 4).

Let us know if we can give you more informations.

Thanks by advance!

yannbertrand avatar Aug 09 '22 15:08 yannbertrand

This appears to no longer be an issue.

I'm closing this -- but if anyone is still having a problem, please feel free to open a new issue! <3

NullVoxPopuli avatar Aug 20 '24 15:08 NullVoxPopuli

Can confirm it works now, see https://github.com/yannbertrand/ember-test-helpers-tab-reproduction/actions/runs/10476962930/job/29017029938.

Thanks!

yannbertrand avatar Aug 20 '24 18:08 yannbertrand