Skip to content

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

Closed

Description

@TimothyGillespie

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

Activity

  1. added
    needs triage
    on Feb 26, 2022
  2. 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[/+] on Feb 26, 2022
  3. self-assigned this
    on Feb 28, 2022
  4. added
    P3
    and removed
    needs triage
    on Feb 28, 2022
  5. added 2 commits that reference this issue on Feb 28, 2022
    537e53f
    303e030
  6. added 2 commits that reference this issue on Mar 5, 2022
    552103b
    2f2b0c7
  7. added a commit that references this issue on Apr 3, 2022
    979fab1
  8. angular-automatic-lock-bot commented on Apr 5, 2022

    @angular-automatic-lock-bot

    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.

  9. locked and limited conversation to collaborators on Apr 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P3area: cdk/testing

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions