Repository navigation
test: give MathJax v4 Problem specs from openedx-platform a home in xblocks-core - #320
irfanuddinahmad wants to merge 2 commits into
Conversation
|
Thanks for the pull request, @irfanuddinahmad! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. DetailsWhere can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
|
@farhan @navinkarkera this gives every test that openedx/openedx-platform#33555 added to the built-in Problem
Navin, if the server-rendered behavior isn't what you intend for formula-equation previews, let us know and we'll adjust the assertions. The full mapping is in the PR description, and CI is green. | Generated using Claude Code |
Ports three tests that openedx/openedx-platform#33555 (MathJax v4 upgrade) added to xmodule/js/spec/capa/display_spec.js, which openedx/openedx-platform#38751 removes along with the built-in Problem block: - should clear and typeset the math element - wraps calculator input in backticks for input.math - clears preview and skips typesetPromise on empty input Names, bodies and assertions are unchanged except for the extracted block's Problem(runtime, element) constructor. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…pecs openedx/openedx-platform#33555 added six specs for the built-in block's client-side refreshMath formula-equation preview, which openedx/openedx-platform#38751 removes. The extracted block renders these previews only via the server (preview_formcalc, 989ae32), so add tests asserting that path's behavior for the same inputs: - calculator syntax R_1*R_2/R_3 renders as LaTeX - \(..\), \[..\], $$..$$ and $..$ inputs are rejected with a parse error The binding spec maps to existing coverage (formula_equation_preview_spec 'makes a request on user input' and display_spec 'does not bind refreshMath to formula equation inputs'). Co-Authored-By: Claude Opus 5.5 <[email protected]>
c3a7928 to
e03f244
Compare
Summary
Gives every test that openedx/openedx-platform#33555 (MathJax v4 upgrade, merged 2026-11-05) added to the built-in block's
xmodule/js/spec/capa/display_spec.jsa counterpart here. openedx/openedx-platform#38751 removes that file along with the built-in Problem block. This follows the Slash-n-Burn rule agreed with @farhan: no platform test is deleted; each one is moved here, or kept in the platform with modifications.Moved unchanged (3)
These apply to the extracted block and pass against it as is:
should clear and typeset the math elementassets/spec/display_spec.js›refreshMathwraps calculator input in backticks for input.mathassets/spec/display_spec.js›refreshMathclears preview and skips typesetPromise on empty inputassets/spec/display_spec.js›refreshMath formula and delimiter handlingThe only adaptation is the extracted block's
Problem(runtime, element)constructor.Replaced with tests of the path that runs (6)
The other 6 specs tested the built-in block's client-side
refreshMathrendering of formula-equation input previews. That path never runs on master, because the toggle isTrue, and #38751 removes it. In this repo, formula-equation previews are deliberately rendered only by the server (preview_formcalc, viaformula_equation_preview.js). That's the most recent design, from989ae32, and the October follow-ups kept it. So the replacements assert what that path actually does for the same inputs:bind the formulaequationinputformula_equation_preview_spec›makes a request on user input, anddisplay_spec›does not bind refreshMath to formula equation inputswraps calculator syntax in backticks for formulaequationinputFormulaEquationTest.test_formcalc_ajax_calculator_syntax_renders_as_latex.R_1*R_2/R_3→\frac{R_{1}\cdot R_{2}}{R_{3}}preserves explicit TeX delimiters \(...\)test_formcalc_ajax_inline_tex_delimiters_rejectedpreserves display math TeX delimiters \[\]test_formcalc_ajax_display_tex_delimiters_rejectedpreserves double-dollar delimiterstest_formcalc_ajax_double_dollar_delimiters_rejectedpreserves single-dollar delimiterstest_formcalc_ajax_single_dollar_delimiters_rejectedThe four delimiter tests assert that the server rejects TeX-delimited input with
Sorry, couldn't parse formulaand echoes the formula back. The new Python tests call the reallatex_preview, with no mocks.Test plan
pytest src/xblock_problem/capa/tests/test_inputtypes.py::FormulaEquationTest: 12 passed (7 existing + 5 new)ruff check,ruff format --check,pylintcleanRelated: openedx/openedx-platform#38751, openedx/openedx-platform#33555, epic openedx/openedx-platform#37819
🤖 Generated with Claude Code