-
-
Notifications
You must be signed in to change notification settings - Fork 3k
refactor: remove jQuery from test directory (@Leonabcd123) #7325
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
Conversation
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.
Pull request overview
This pull request removes jQuery dependencies from the test directory, replacing jQuery calls with native DOM manipulation utilities provided by the ElementWithUtils and ElementsWithUtils classes from frontend/src/ts/utils/dom.ts.
Changes:
- Refactored jQuery selectors ($) to native DOM utilities (qs, qsa, qsr)
- Replaced jQuery event handlers with native addEventListener and custom onChild method
- Updated DOM manipulation methods (addClass, removeClass, setHtml, etc.) to use ElementWithUtils API
- Removed jQuery-specific type annotations (JQuery.KeyDownEvent → KeyboardEvent)
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/src/ts/utils/dom.ts | Added new utility methods (getOuterHeight, getOuterWidth, getChildren) and made scrollIntoView/focus parameters optional |
| frontend/src/ts/test/test-ui.ts | Extensive refactoring of jQuery to native DOM utilities, updated event handlers and element manipulation |
| frontend/src/ts/test/test-screenshot.ts | Replaced jQuery selectors and methods with native utilities |
| frontend/src/ts/test/test-logic.ts | Updated event handlers and type annotations |
| frontend/src/ts/test/test-config.ts | Refactored animations and DOM manipulations |
| frontend/src/ts/test/result.ts | Extensive jQuery removal throughout result display logic |
| frontend/src/ts/test/replay.ts | Updated event handlers and selectors |
| frontend/src/ts/test/pb-crown.ts | Removed jQuery, used native utilities for crown display |
| frontend/src/ts/test/out-of-focus.ts | Refactored focus warning display |
| frontend/src/ts/test/monkey.ts | Updated monkey animation logic |
| frontend/src/ts/test/live-speed.ts | Refactored live speed display |
| frontend/src/ts/test/live-burst.ts | Refactored live burst display |
| frontend/src/ts/test/live-acc.ts | Refactored live accuracy display |
| frontend/src/ts/test/layout-emulator.ts | Updated event listener registration |
| frontend/src/ts/test/funbox/memory-funbox-timer.ts | Updated timer display |
| frontend/src/ts/test/funbox/layoutfluid-funbox-timer.ts | Updated timer display |
| frontend/src/ts/test/funbox/funbox.ts | Refactored funbox activation/deactivation |
| frontend/src/ts/test/funbox/funbox-functions.ts | Updated funbox function implementations |
| frontend/src/ts/test/focus.ts | Updated focus management |
| frontend/src/ts/states/connection.ts | Added debugging console.warn statements that should be removed |
| frontend/src/ts/observables/connection-event.ts | Added debugging console.warn statement that should be removed |
| frontend/tests/test/layout-emulator.spec.ts | Updated test type annotations |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.
Pull request overview
Copilot reviewed 20 out of 20 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Pull request overview
Copilot reviewed 20 out of 20 changed files in this pull request and generated 7 comments.
Comments suppressed due to low confidence (1)
frontend/src/ts/utils/dom.ts:308
- The
addClassandremoveClassmethods split space-separated class names into an array and recursively call themselves. However, thesplit(" ")call will create empty strings if there are multiple consecutive spaces (e.g., "class1 class2"). This could lead to adding/removing empty class names. Consider filtering out empty strings after splitting:className.split(" ").filter(cn => cn.length > 0).
addClass(className: string | string[]): this {
if (Array.isArray(className)) {
this.native.classList.add(...className);
} else {
if (className.includes(" ")) {
return this.addClass(className.split(" "));
}
this.native.classList.add(className);
}
return this;
}
/**
* Remove a class from the element
*/
removeClass(className: string | string[]): this {
if (Array.isArray(className)) {
this.native.classList.remove(...className);
} else {
if (className.includes(" ")) {
return this.removeClass(className.split(" "));
}
this.native.classList.remove(className);
}
return this;
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Description
Closes #7186