Skip to content

Commit 45e5251

Browse files
feat: refactor tests
1 parent 80672e0 commit 45e5251

1 file changed

Lines changed: 7 additions & 11 deletions

File tree

src/course-home/progress-tab/grades/grade-summary/GradeSummaryHeader.test.jsx

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ describe('GradeSummaryHeader', () => {
7474
});
7575
});
7676

77-
it('hides tooltip on blur and hover out (covering setShowTooltip(false))', async () => {
77+
it('hides tooltip on blur', async () => {
7878
renderComponent();
7979

8080
const iconButton = screen.getByRole('button', {
@@ -88,21 +88,17 @@ describe('GradeSummaryHeader', () => {
8888
expect(screen.getByText(messages.gradeSummaryTooltipBody.defaultMessage)).toBeInTheDocument();
8989
});
9090

91-
const outside = document.createElement('div');
92-
document.body.appendChild(outside);
93-
await userEvent.unhover(iconButton);
94-
await userEvent.hover(outside);
91+
const blurTarget = document.createElement('button');
92+
blurTarget.textContent = 'Outside';
93+
document.body.appendChild(blurTarget);
94+
blurTarget.focus();
9595

96-
const otherButton = document.createElement('button');
97-
otherButton.textContent = 'Other';
98-
document.body.appendChild(otherButton);
99-
otherButton.focus();
96+
await userEvent.unhover(iconButton);
10097

10198
await waitFor(() => {
10299
expect(screen.queryByText(messages.gradeSummaryTooltipBody.defaultMessage)).not.toBeInTheDocument();
103100
});
104101

105-
document.body.removeChild(outside);
106-
document.body.removeChild(otherButton);
102+
document.body.removeChild(blurTarget);
107103
});
108104
});

0 commit comments

Comments
 (0)