-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Fix imprecise tooltip positioning in PollListItem #31157
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
base: develop
Are you sure you want to change the base?
Changes from 4 commits
0764a48
e3781c7
e122119
8f3a603
c434980
2b2bb34
67c7f06
6d4cd71
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -50,4 +50,20 @@ describe("<PollListItem />", () => { | |
|
|
||
| expect(onClick).toHaveBeenCalled(); | ||
| }); | ||
|
|
||
| it("handles tooltip mouse events", () => { | ||
| const { container } = getComponent(); | ||
| const contentDiv = container.querySelector(".mx_PollListItem_content"); | ||
| const questionSpan = container.querySelector(".mx_PollListItem_question"); | ||
|
|
||
| expect(contentDiv).toBeTruthy(); | ||
| expect(questionSpan?.textContent).toBe("Question?"); | ||
|
|
||
| // Test that mouse events work without error | ||
| fireEvent.mouseEnter(contentDiv!); | ||
| fireEvent.mouseLeave(contentDiv!); | ||
|
||
|
|
||
| // Component should still be functional after state changes | ||
| expect(container.querySelector(".mx_PollListItem")).toBeTruthy(); | ||
|
||
| }); | ||
| }); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure it's really relevant to this test to assert these things, or why we need the question div at all. We also really ought to be selecting things by role, or testId if that really isn't possible. In this case, this raises the question of why the inner div is necessary now that the tooltip is on something inside it: then we could just have the mouseenter/leave be on the li and select it using
getByRole("listitem", { name: "01/01/70 Question?" }).Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oki, I moved the mouse events to the li element and added the aria-label. I also added getByRole as you suggested.