[24/N] Add unit tests for base Algorithm class and control bar helpers - #115
Open
karkir0003 wants to merge 24 commits into
Conversation
…de, and AnimatedCircularlyLinkedListNode
This was referenced Oct 3, 2026
Open
This was referenced Oct 3, 2026
This branch has not been deployed
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.
🥞 Stack
Addresses #93
Context
Adds unit test coverage for
Algorithm.js, the foundational base class for all 52 algorithm and data structure visualizers across the application, as well as the imperative DOM helpers used to build the top algorithm control bar and accessible keyboard tab navigation.Changes Made
• Introduced
src/algo/__tests__/Algorithm.test.jscovering:• Algorithm bar DOM generator functions:
•
addLabelToAlgorithmBar(standalone table entry vs nested in group).•
addCheckboxToAlgorithmBar(initial checked/unchecked state, group attachment).•
addDropDownGroupToAlgorithmBar(options parsing, selection mapping, keyboard navigation binding).•
addRadioButtonGroupToAlgorithmBar(radio groups in table layouts).•
addControlToAlgorithmBar(buttons and text inputs, tabindex attribution).•
addDivisorToAlgorithmBar(layout separators).•
addGroupToAlgorithmBar(horizontal and vertical layout groups, nested parenting).•
controlKeyrecognition (backspace, tab, arrows, delete, enter).• Base
Algorithmclass lifecycle:• Event listener registrations on
AnimationManager(AnimationStarted,AnimationEnded,AnimationUndo).•
cmdbuffering gated byrecordAnimation.• Action history management, action execution dispatch (
implementAction), and state replay onundo().• Abstract method interface contracts (
sizeChanged,disableUI,enableUI,reset).• Input normalization (
normalizeNumber).• Pseudocode canvas layout:
• Dual-language code generation (
addCodeToCanvasBaseAll,addCodeToCanvasBase).• Syntax highlighting / unhighlighting on code lines and multi-matrix labels (
highlight,unhighlight).• Cleanup and opacity management (
removeCode,setCodeAlpha).• Keyboard focus & input submission:
• Global Tab key cyclic focus navigation across algorithm and animation control bars (
handleControlTabNavigation, forward and shift+Tab).• Enter key submission bindings (
attachTabNavigation,enableTabNavigationForButton).• Input validation handlers (
returnSubmit,returnSubmitFloat,addReturnSubmit).• Button shaking animation triggers (
shake).Test Plan
• Ran
npm test -- --watchAll=false(all 33 test suites pass, 318 tests passing).• Ran
npm run lintandnpm run prettier.• Verified 98.48% line coverage and 100% function coverage on
src/algo/Algorithm.js.