Commit a057050
fix: reset MathJax.Hub.Queue spy in refreshMath beforeEach to avoid jasmine-jquery Sizzle error
In Jasmine 2.99, toHaveBeenCalledWith iterates ALL recorded spy call
arguments element-by-element (even for calls that obviously don't match)
to build a useful diff. In Jasmine 2.6, array comparison short-circuited
on the first failing element.
Problem.bind() calls MathJax.Hub.Queue([refreshMath, null, domEl]) for
each input.math element. When toHaveBeenCalledWith then checks that call
against the expected args ["Text", stubbedJax, "E=mc^2"], it compares
each element pairwise — including domEl (index 2 of the actual array)
against "E=mc^2" (index 2 of the expected array).
jasmine-jquery's custom equality tester calls $(domEl).is("E=mc^2") when
it sees a DOM node on the left. jQuery's Sizzle interprets "E=mc^2" as a
CSS selector and throws a syntax error.
Fix: reset Queue.calls after new Problem() so bind()'s call is not in the
recorded set. This isolates the describe to testing only what refreshMath
itself queues, which is the intent of the test.
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>1 parent 46e0b76 commit a057050
1 file changed
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
994 | 994 | | |
995 | 995 | | |
996 | 996 | | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
997 | 1006 | | |
998 | 1007 | | |
999 | 1008 | | |
| |||
0 commit comments