test: add unit tests for JSEditor widget#5840
Merged
omsuneri merged 1 commit intosugarlabs:masterfrom Feb 21, 2026
Merged
Conversation
Contributor
|
✅ All Jest tests passed! This PR is ready to merge. |
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
Adds a new unit test suite for the
JSEditorwidget class with 51 comprehensive tests covering constructor setup, code editing functionality, and export/run behavior.Changes
js/widgets/__tests__/jseditor.test.jsTest Coverage
isOpen = true,_showingHelp = false, widget window ref (clear/show/setPosition/takeFocus/windowForargs),_editordiv,_jarCodeJar instance,_codefrom JSGenerate,_codeBck = null,_currentStyle = 0, 4 editor styles,window.jsEditor = self,JSGenerate.runcalled, editor appended to widget body_generateCode(callsJSGenerate.run, updates_code/jar, resets_showingHelp),_setLinesCount(generates line numbers, no-op when missing),_toggleHelp(toggles flag, saves/restores code backup, displays JS_API,gold/whitebutton color),_toggleConsole(hide/show console, arrow icon state),_markErrorSpan(inserts error span, preserves surrounding text),_addDebuggerToLine(inserts debugger),_removeDebuggerFromLine(removes debugger)_runCode(no-op when showing help, clears old console output, callsMusicBlocks.initon valid code, logs syntax error on parse failure, skips init on syntax error),logConsole(appends message, default/specified color, line breaks, no-op when missing),clearConsole(clears content, no-op when missing),_changeStyle(cycles themes, callspreventDefault, wraps around)Scope
js/widgets/__tests__/jseditor.test.jswas addedVerification