refactor(pitchdrummatrix): extract duplicated play-button icon construction - #7990
Open
Sumanthvu wants to merge 1 commit into
Open
refactor(pitchdrummatrix): extract duplicated play-button icon construction#7990Sumanthvu wants to merge 1 commit into
Sumanthvu wants to merge 1 commit into
Conversation
…uction The _playAll() method contained four nearly identical copies of the play/stop button icon construction pattern (12 lines each). Extract this into a single _setPlayButtonIcon(state) helper that accepts 'play' or 'stop'. Add four focused tests for the new helper covering both icon states and their DOM attributes.
Sumanthvu
requested review from
Ashutoshx7,
omsuneri,
pikurasa and
walterbender
as code owners
August 8, 2026 14:02
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
Extract the play/stop button icon construction in
PitchDrumMatrix._playAll()into a reusable_setPlayButtonIcon(state)helper.Problem
The
_playAll()method contained four nearly identical 12-line blocks that construct a play or stop button icon. Each block:textContent<img>element withsrc,title,alt, and sizing attributesThe only difference between copies is the icon source (
play-button.svgvsstop-button.svg) and the label text ("Play"vs"Stop").Changes
js/widgets/pitchdrummatrix.js_setPlayButtonIcon(state)— accepts"play"or"stop", performs the icon construction once._playAll()— replaced four copy-paste blocks with single-line calls to the new helper.js/widgets/__tests__/pitchdrummatrix.test.js_setPlayButtonIcon:src,title, andaltattributes.Verification
PR Category
Please check at least one category: