Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug(cdk/testing): The UnitTestElements.hover() does not trigger a mouseover event #24486

Closed
1 task
TimothyGillespie opened this issue Feb 26, 2022 · 1 comment · Fixed by #24490
Closed
1 task
Assignees
Labels
area: cdk/testing P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@TimothyGillespie
Copy link

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

Currently, the UnitTestElement would trigger a mouseenter event but not a mouseover event. This is unexpected since a mouseover should always trigger alongside a mouseenter. I noticed this when I wrote a harness for a component depending on the mouseover event, and thus required a workaround.

I would gladly contribute a fix. However, tests are required and there seems to be no test infrastructure for UnitTestElement yet, which makes it difficult for me to submit a PR right away.

It seems to me the issue would be resolved by simply adding the line
dispatchMouseEvent(this.element, 'mouseover');
here: https://github.com/angular/components/blob/master/src/cdk/testing/testbed/unit-test-element.ts

Reproduction

Steps to reproduce:

  1. Create a component utilizing mousover.
  2. Create Harness utilizing the hover to trigger the mouseover.
  3. Notice that the test will not work as expected.

Expected Behavior

A mouseover event is triggered when using the hover() method.

Actual Behavior

No mouseover event is triggered when using the hover() method.

Environment

  • Angular: 13.2.4
  • CDK/Material: 13.2.4
  • Browser(s): Jest
  • Operating System (e.g. Windows, macOS, Ubuntu): Fedora and Windows
@TimothyGillespie TimothyGillespie added the needs triage This issue needs to be triaged by the team label Feb 26, 2022
@TimothyGillespie TimothyGillespie changed the title cdk/testing: The UnitTestElements.hover() does not trigger a mouseover event bug(cdk/testing): The UnitTestElements.hover() does not trigger a mouseover event Feb 26, 2022
@crisbeto crisbeto self-assigned this Feb 28, 2022
@crisbeto crisbeto added area: cdk/testing has pr P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent and removed needs triage This issue needs to be triaged by the team labels Feb 28, 2022
crisbeto added a commit to crisbeto/material2 that referenced this issue Feb 28, 2022
…lement

Fixes that the `UnitTestElement` wasn't dispatching `mouseover` and `mouseout` on `hover`/`mouseAway` like the browser would.

Fixes angular#24486.
crisbeto added a commit to crisbeto/material2 that referenced this issue Feb 28, 2022
…lement

Fixes that the `UnitTestElement` wasn't dispatching `mouseover` and `mouseout` on `hover`/`mouseAway` like the browser would.

Fixes angular#24486.
andrewseguin pushed a commit that referenced this issue Mar 5, 2022
…lement (#24490)

Fixes that the `UnitTestElement` wasn't dispatching `mouseover` and `mouseout` on `hover`/`mouseAway` like the browser would.

Fixes #24486.
andrewseguin pushed a commit that referenced this issue Mar 5, 2022
…lement (#24490)

Fixes that the `UnitTestElement` wasn't dispatching `mouseover` and `mouseout` on `hover`/`mouseAway` like the browser would.

Fixes #24486.

(cherry picked from commit 552103b)
forsti0506 pushed a commit to forsti0506/components that referenced this issue Apr 3, 2022
…lement (angular#24490)

Fixes that the `UnitTestElement` wasn't dispatching `mouseover` and `mouseout` on `hover`/`mouseAway` like the browser would.

Fixes angular#24486.
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Apr 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: cdk/testing P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants