Skip to content

test: add unit tests for PhraseMakerUI widget#5815

Merged
omsuneri merged 1 commit intosugarlabs:masterfrom
kh-ub-ayb:test/add-phrasemaker-ui-tests
Feb 19, 2026
Merged

test: add unit tests for PhraseMakerUI widget#5815
omsuneri merged 1 commit intosugarlabs:masterfrom
kh-ub-ayb:test/add-phrasemaker-ui-tests

Conversation

@kh-ub-ayb
Copy link
Contributor

Summary

This PR adds a new unit test suite for the PhraseMakerUI widget module, covering all 7 of its UI rendering and interaction methods with 49 comprehensive tests.

Changes

  • Added 49 new unit tests in js/widgets/__tests__/PhraseMakerUI.test.js
  • No changes to source code

Test Coverage

Describe Block Tests Coverage
Module Export 7 Verifies all 7 method exports
calculateNoteWidth 10 Eighth/quarter/half/whole/sixteenth notes, minimum width (15), _cellScale multiplier, floor rounding, fractional noteValue
highlightCell 5 Sets selectorBackground, missing row/cell guards, multi-cell targeting, multi-row targeting
unhighlightCell 5 Resets to rhythmcellcolor, skips non-highlighted cells, missing row/cell guards, scoped unhighlight
updateNoteCellVisual 7 Active sets background + checkmark, inactive clears both, null/undefined cell guards, toggle round-trip
updatePlayButton 8 Null/undefined _playButton guards, stop/play SVG sources, title text, ICONSIZE dimensions, toggle switching
resetMatrix 6 Resets noteValueRow cells, skips tuplet row when disabled, resets tuplet row when enabled, empty cells, different colors per row type

Scope

  • Only js/widgets/__tests__/PhraseMakerUI.test.js was added
  • No changes to source code

Verification

  • All 49 tests pass

@github-actions
Copy link
Contributor

✅ All Jest tests passed! This PR is ready to merge.

@kh-ub-ayb
Copy link
Contributor Author

@walterbender @omsuneri please review

@omsuneri omsuneri merged commit 3d5ee54 into sugarlabs:master Feb 19, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants