test: add unit tests for HelpWidget#5836
Merged
omsuneri merged 1 commit intosugarlabs:masterfrom Feb 21, 2026
Merged
Conversation
Contributor
|
✅ All Jest tests passed! This PR is ready to merge. |
Contributor
vanshika2720
left a comment
There was a problem hiding this comment.
@kh-ub-ayb Great test coverage for HelpWidget — well structured, meaningful, and CI is passing. Scope is clean (tests only)
Minor suggestion: in the future, it might be worth importing help.js directly instead of loading it via new Function(), as that would improve readability and maintainability. Not a blocker for this PR.
Contributor
Author
|
@walterbender @omsuneri please review |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds a new unit test suite for the
HelpWidgetclass with 39 comprehensive tests covering constructor initialization, block categorization, deprecated page search, and page navigation rendering.Changes
js/widgets/__tests__/help.test.jsTest Coverage
beginnerBlocks/advancedBlocks/appendedBlockListinit as empty arrays,index = 0,isOpen = true, widget windowclear/show/sendToCenter,_helpDivcreation,onclosehandler (setsisOpenfalse, callsdestroy, restoresdocument.onkeydown),windowForarguments, widget bodymaxHeight_prepareBlockListcategorization_blockHelpwith first block, handles empty protoBlockDict, handles mixed valid/invalid blocks_showPage, no-op for nonexistent names, finds first/last page, searches by content in any positiontakeFocus, disables right arrow on last page, disables left arrow on first page, enables both on middle page, clears previous contentICONSIZE = 32Scope
js/widgets/__tests__/help.test.jswas addedVerification