@doenet/doenetml 0.6.0-alpha1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (549) hide show
  1. package/.prettierrc +3 -0
  2. package/LICENSE +661 -0
  3. package/README.md +146 -0
  4. package/cypress/e2e/ActivityViewer/activityVariants.cy.js +1770 -0
  5. package/cypress/e2e/ActivityViewer/compiledActivity.cy.js +83 -0
  6. package/cypress/e2e/ActivityViewer/relationshipsAmongPages.cy.js +697 -0
  7. package/cypress/e2e/answerValidation/errorinnumbers.cy.js +2125 -0
  8. package/cypress/e2e/answerValidation/factoring.cy.js +1945 -0
  9. package/cypress/e2e/answerValidation/factoringOldAlgorithm.cy.js +892 -0
  10. package/cypress/e2e/answerValidation/functionanswers.cy.js +314 -0
  11. package/cypress/e2e/answerValidation/matchingpatterns.cy.js +287 -0
  12. package/cypress/e2e/answerValidation/matchpartial.cy.js +6711 -0
  13. package/cypress/e2e/answerValidation/pointlocation.cy.js +3989 -0
  14. package/cypress/e2e/answerValidation/symbolicequality.cy.js +1893 -0
  15. package/cypress/e2e/answerValidation/videoProgress.cy.js +210 -0
  16. package/cypress/e2e/assignNames/basiccopy.cy.js +2376 -0
  17. package/cypress/e2e/assignNames/collections.cy.js +9247 -0
  18. package/cypress/e2e/assignNames/selects.cy.js +105 -0
  19. package/cypress/e2e/assignNames/sequences.cy.js +1964 -0
  20. package/cypress/e2e/baseComponent/basecomponentproperties.cy.js +999 -0
  21. package/cypress/e2e/baseComponent/doenetMLtext.cy.js +427 -0
  22. package/cypress/e2e/chemistry/atom.cy.js +201 -0
  23. package/cypress/e2e/chemistry/ion.cy.js +608 -0
  24. package/cypress/e2e/chemistry/ioniccompound.cy.js +133 -0
  25. package/cypress/e2e/dynamicalsystem/cobwebpolyline.cy.js +2653 -0
  26. package/cypress/e2e/dynamicalsystem/equilibriumcurve.cy.js +311 -0
  27. package/cypress/e2e/dynamicalsystem/equilibriumline.cy.js +279 -0
  28. package/cypress/e2e/dynamicalsystem/equilibriumpoint.cy.js +283 -0
  29. package/cypress/e2e/dynamicalsystem/odesystem.cy.js +1834 -0
  30. package/cypress/e2e/equality/mathexpressions.cy.js +948 -0
  31. package/cypress/e2e/graphing/graphreferences.cy.js +978 -0
  32. package/cypress/e2e/graphing/graphreferences2.cy.js +615 -0
  33. package/cypress/e2e/linearAlgebra/eigenDecomposition.cy.js +401 -0
  34. package/cypress/e2e/tagSpecific/angle.cy.js +3898 -0
  35. package/cypress/e2e/tagSpecific/animatefromsequence.cy.js +2306 -0
  36. package/cypress/e2e/tagSpecific/answer.cy.js +31647 -0
  37. package/cypress/e2e/tagSpecific/bestfitline.cy.js +612 -0
  38. package/cypress/e2e/tagSpecific/blockquote.cy.js +30 -0
  39. package/cypress/e2e/tagSpecific/boolean.cy.js +742 -0
  40. package/cypress/e2e/tagSpecific/booleaninput.cy.js +1283 -0
  41. package/cypress/e2e/tagSpecific/booleanlist.cy.js +588 -0
  42. package/cypress/e2e/tagSpecific/booleanoperators.cy.js +596 -0
  43. package/cypress/e2e/tagSpecific/booleanoperatorsonmath.cy.js +498 -0
  44. package/cypress/e2e/tagSpecific/callaction.cy.js +2835 -0
  45. package/cypress/e2e/tagSpecific/choiceinput.cy.js +3205 -0
  46. package/cypress/e2e/tagSpecific/circle.cy.js +22036 -0
  47. package/cypress/e2e/tagSpecific/codeeditor.cy.js +1995 -0
  48. package/cypress/e2e/tagSpecific/collect.cy.js +5035 -0
  49. package/cypress/e2e/tagSpecific/componentsize.cy.js +502 -0
  50. package/cypress/e2e/tagSpecific/conditionalcontent.cy.js +3495 -0
  51. package/cypress/e2e/tagSpecific/contentBrowser.cy.js +335 -0
  52. package/cypress/e2e/tagSpecific/contentpicker.cy.js +261 -0
  53. package/cypress/e2e/tagSpecific/copy.cy.js +12627 -0
  54. package/cypress/e2e/tagSpecific/copy2.cy.js +5698 -0
  55. package/cypress/e2e/tagSpecific/curve.bezier.cy.js +12440 -0
  56. package/cypress/e2e/tagSpecific/curve.cy.js +1716 -0
  57. package/cypress/e2e/tagSpecific/curve.function.cy.js +1471 -0
  58. package/cypress/e2e/tagSpecific/curve.parametrized.cy.js +920 -0
  59. package/cypress/e2e/tagSpecific/document.cy.js +234 -0
  60. package/cypress/e2e/tagSpecific/endpoint.cy.js +197 -0
  61. package/cypress/e2e/tagSpecific/evaluate.cy.js +8895 -0
  62. package/cypress/e2e/tagSpecific/extract.cy.js +2282 -0
  63. package/cypress/e2e/tagSpecific/feedback.cy.js +2941 -0
  64. package/cypress/e2e/tagSpecific/function.cy.js +9450 -0
  65. package/cypress/e2e/tagSpecific/functioniterates.cy.js +1178 -0
  66. package/cypress/e2e/tagSpecific/functionoperators.cy.js +4047 -0
  67. package/cypress/e2e/tagSpecific/graph.cy.js +2491 -0
  68. package/cypress/e2e/tagSpecific/group.cy.js +683 -0
  69. package/cypress/e2e/tagSpecific/hint.cy.js +204 -0
  70. package/cypress/e2e/tagSpecific/image.cy.js +770 -0
  71. package/cypress/e2e/tagSpecific/integer.cy.js +206 -0
  72. package/cypress/e2e/tagSpecific/label.cy.js +800 -0
  73. package/cypress/e2e/tagSpecific/legend.cy.js +1001 -0
  74. package/cypress/e2e/tagSpecific/line.cy.js +12167 -0
  75. package/cypress/e2e/tagSpecific/linesegment.cy.js +4749 -0
  76. package/cypress/e2e/tagSpecific/lorem.cy.js +289 -0
  77. package/cypress/e2e/tagSpecific/map.cy.js +4476 -0
  78. package/cypress/e2e/tagSpecific/matchespattern.cy.js +693 -0
  79. package/cypress/e2e/tagSpecific/math.cy.js +10990 -0
  80. package/cypress/e2e/tagSpecific/mathdisplay.cy.js +2689 -0
  81. package/cypress/e2e/tagSpecific/mathinput.cy.js +15628 -0
  82. package/cypress/e2e/tagSpecific/mathinputgraph.cy.js +566 -0
  83. package/cypress/e2e/tagSpecific/mathlist.cy.js +4073 -0
  84. package/cypress/e2e/tagSpecific/mathoperators.cy.js +13851 -0
  85. package/cypress/e2e/tagSpecific/matrix.cy.js +8825 -0
  86. package/cypress/e2e/tagSpecific/matrixinput.cy.js +16277 -0
  87. package/cypress/e2e/tagSpecific/module.cy.js +1771 -0
  88. package/cypress/e2e/tagSpecific/number.cy.js +2221 -0
  89. package/cypress/e2e/tagSpecific/numberlist.cy.js +1285 -0
  90. package/cypress/e2e/tagSpecific/p.cy.js +72 -0
  91. package/cypress/e2e/tagSpecific/paginator.cy.js +2983 -0
  92. package/cypress/e2e/tagSpecific/parabola.cy.js +14331 -0
  93. package/cypress/e2e/tagSpecific/paragraphmarkup.cy.js +104 -0
  94. package/cypress/e2e/tagSpecific/periodicset.cy.js +1439 -0
  95. package/cypress/e2e/tagSpecific/piecewisefunction.cy.js +1055 -0
  96. package/cypress/e2e/tagSpecific/pluralize.cy.js +274 -0
  97. package/cypress/e2e/tagSpecific/point.cy.js +8895 -0
  98. package/cypress/e2e/tagSpecific/point2.cy.js +10259 -0
  99. package/cypress/e2e/tagSpecific/polygon.cy.js +5039 -0
  100. package/cypress/e2e/tagSpecific/polyline.cy.js +4704 -0
  101. package/cypress/e2e/tagSpecific/problem.cy.js +2768 -0
  102. package/cypress/e2e/tagSpecific/ray.cy.js +10770 -0
  103. package/cypress/e2e/tagSpecific/rectangle.cy.js +2143 -0
  104. package/cypress/e2e/tagSpecific/ref.cy.js +420 -0
  105. package/cypress/e2e/tagSpecific/regularPolygon.cy.js +1006 -0
  106. package/cypress/e2e/tagSpecific/regularPolygon2.cy.js +100 -0
  107. package/cypress/e2e/tagSpecific/regularPolygon3.cy.js +777 -0
  108. package/cypress/e2e/tagSpecific/samplerandomnumbers.cy.js +3619 -0
  109. package/cypress/e2e/tagSpecific/sectioning.cy.js +3530 -0
  110. package/cypress/e2e/tagSpecific/select.cy.js +5376 -0
  111. package/cypress/e2e/tagSpecific/selectfromsequence.cy.js +3846 -0
  112. package/cypress/e2e/tagSpecific/selectrandomnumbers.cy.js +2914 -0
  113. package/cypress/e2e/tagSpecific/sequence.cy.js +2093 -0
  114. package/cypress/e2e/tagSpecific/shuffle.cy.js +490 -0
  115. package/cypress/e2e/tagSpecific/sidebyside.cy.js +8057 -0
  116. package/cypress/e2e/tagSpecific/singlecharactercomponents.cy.js +72 -0
  117. package/cypress/e2e/tagSpecific/slider.cy.js +914 -0
  118. package/cypress/e2e/tagSpecific/solution.cy.js +109 -0
  119. package/cypress/e2e/tagSpecific/solveequations.cy.js +1026 -0
  120. package/cypress/e2e/tagSpecific/sort.cy.js +1685 -0
  121. package/cypress/e2e/tagSpecific/spreadsheet.cy.js +5971 -0
  122. package/cypress/e2e/tagSpecific/subsetofreals.cy.js +2725 -0
  123. package/cypress/e2e/tagSpecific/substitute.cy.js +2646 -0
  124. package/cypress/e2e/tagSpecific/tabular.cy.js +36 -0
  125. package/cypress/e2e/tagSpecific/text.cy.js +975 -0
  126. package/cypress/e2e/tagSpecific/textinput.cy.js +2177 -0
  127. package/cypress/e2e/tagSpecific/textlist.cy.js +369 -0
  128. package/cypress/e2e/tagSpecific/triangle.cy.js +1936 -0
  129. package/cypress/e2e/tagSpecific/triggerset.cy.js +2023 -0
  130. package/cypress/e2e/tagSpecific/updatevalue.cy.js +3288 -0
  131. package/cypress/e2e/tagSpecific/vector.cy.js +20183 -0
  132. package/cypress/e2e/tagSpecific/video.cy.js +612 -0
  133. package/cypress/e2e/tagSpecific/when.cy.js +202 -0
  134. package/cypress/e2e/variants/specifysinglevariant.cy.js +6726 -0
  135. package/cypress/e2e/variants/uniquevariants.cy.js +4846 -0
  136. package/cypress/fixtures/example.json +5 -0
  137. package/cypress/support/commands.js +32 -0
  138. package/cypress/support/e2e.js +31 -0
  139. package/cypress.config.js +18 -0
  140. package/docs/codeSnippet.jsx +11 -0
  141. package/docs/index.html +133 -0
  142. package/docs/index.jsx +138 -0
  143. package/docs/prism.css +3 -0
  144. package/index.html +14 -0
  145. package/index.js +21 -0
  146. package/media/answer_example.png +0 -0
  147. package/media/graph_example.png +0 -0
  148. package/media/graph_markup_example.png +0 -0
  149. package/package.json +83 -0
  150. package/public/favicon.ico +0 -0
  151. package/public/fonts/files/open-sans-v18-latin-700.woff +0 -0
  152. package/public/fonts/files/open-sans-v18-latin-700.woff2 +0 -0
  153. package/public/fonts/files/open-sans-v18-latin-700italic.woff +0 -0
  154. package/public/fonts/files/open-sans-v18-latin-700italic.woff2 +0 -0
  155. package/public/fonts/files/open-sans-v18-latin-italic.woff +0 -0
  156. package/public/fonts/files/open-sans-v18-latin-italic.woff2 +0 -0
  157. package/public/fonts/files/open-sans-v18-latin-light-italic.woff +0 -0
  158. package/public/fonts/files/open-sans-v18-latin-light-italic.woff2 +0 -0
  159. package/public/fonts/files/open-sans-v18-latin-light.woff +0 -0
  160. package/public/fonts/files/open-sans-v18-latin-light.woff2 +0 -0
  161. package/public/fonts/files/open-sans-v18-latin-regular.woff +0 -0
  162. package/public/fonts/files/open-sans-v18-latin-regular.woff2 +0 -0
  163. package/src/Core/ComponentTypes.js +426 -0
  164. package/src/Core/Core.js +11852 -0
  165. package/src/Core/CoreWorker.js +127 -0
  166. package/src/Core/Dependencies.js +8226 -0
  167. package/src/Core/Numerics.js +473 -0
  168. package/src/Core/ParameterStack.js +36 -0
  169. package/src/Core/ReadOnlyProxyHandler.js +41 -0
  170. package/src/Core/StateProxyHandler.js +88 -0
  171. package/src/Core/components/Aliases.js +67 -0
  172. package/src/Core/components/Angle.js +758 -0
  173. package/src/Core/components/AnimateFromSequence.js +922 -0
  174. package/src/Core/components/Answer.js +2087 -0
  175. package/src/Core/components/AsList.js +83 -0
  176. package/src/Core/components/AttractTo.js +245 -0
  177. package/src/Core/components/AttractToAngles.js +262 -0
  178. package/src/Core/components/AttractToConstraint.js +104 -0
  179. package/src/Core/components/AttractToGrid.js +315 -0
  180. package/src/Core/components/Award.js +906 -0
  181. package/src/Core/components/BestFitLine.js +318 -0
  182. package/src/Core/components/BezierControls.js +719 -0
  183. package/src/Core/components/BlockQuote.js +35 -0
  184. package/src/Core/components/Boolean.js +500 -0
  185. package/src/Core/components/BooleanInput.js +330 -0
  186. package/src/Core/components/BooleanList.js +396 -0
  187. package/src/Core/components/BooleanOperators.js +35 -0
  188. package/src/Core/components/BooleanOperatorsOfMath.js +148 -0
  189. package/src/Core/components/CallAction.js +261 -0
  190. package/src/Core/components/Caption.js +73 -0
  191. package/src/Core/components/Case.js +56 -0
  192. package/src/Core/components/Cell.js +439 -0
  193. package/src/Core/components/CellBlock.js +64 -0
  194. package/src/Core/components/Chart.js +795 -0
  195. package/src/Core/components/Choice.js +266 -0
  196. package/src/Core/components/ChoiceInput.js +1407 -0
  197. package/src/Core/components/Circle.js +2884 -0
  198. package/src/Core/components/CodeEditor.js +647 -0
  199. package/src/Core/components/CodeViewer.js +294 -0
  200. package/src/Core/components/CollaborateGroupSetup.js +46 -0
  201. package/src/Core/components/CollaborateGroups.js +119 -0
  202. package/src/Core/components/Collect.js +850 -0
  203. package/src/Core/components/Column.js +608 -0
  204. package/src/Core/components/ConditionalContent.js +468 -0
  205. package/src/Core/components/ConsiderAsResponses.js +49 -0
  206. package/src/Core/components/ConstrainTo.js +161 -0
  207. package/src/Core/components/ConstrainToAngles.js +244 -0
  208. package/src/Core/components/ConstrainToGraph.js +142 -0
  209. package/src/Core/components/ConstrainToGrid.js +175 -0
  210. package/src/Core/components/ConstraintUnion.js +119 -0
  211. package/src/Core/components/Constraints.js +497 -0
  212. package/src/Core/components/ContentBrowser.js +441 -0
  213. package/src/Core/components/ContentPicker.js +263 -0
  214. package/src/Core/components/ControlVectors.js +25 -0
  215. package/src/Core/components/Coords.js +63 -0
  216. package/src/Core/components/Copy.js +3412 -0
  217. package/src/Core/components/Curve.js +4130 -0
  218. package/src/Core/components/CustomAttribute.js +175 -0
  219. package/src/Core/components/DataFrame.js +357 -0
  220. package/src/Core/components/DiscreteSimulationResultList.js +342 -0
  221. package/src/Core/components/DiscreteSimulationResultPolyline.js +581 -0
  222. package/src/Core/components/Divisions.js +55 -0
  223. package/src/Core/components/Document.js +888 -0
  224. package/src/Core/components/Embed.js +65 -0
  225. package/src/Core/components/Endpoint.js +62 -0
  226. package/src/Core/components/Evaluate.js +321 -0
  227. package/src/Core/components/Extract.js +656 -0
  228. package/src/Core/components/Extrema.js +556 -0
  229. package/src/Core/components/Feedback.js +200 -0
  230. package/src/Core/components/FeedbackDefinitions.js +97 -0
  231. package/src/Core/components/Figure.js +148 -0
  232. package/src/Core/components/Footnote.js +73 -0
  233. package/src/Core/components/Function.js +5344 -0
  234. package/src/Core/components/FunctionIterates.js +306 -0
  235. package/src/Core/components/FunctionOperators.js +702 -0
  236. package/src/Core/components/Graph.js +1679 -0
  237. package/src/Core/components/Group.js +7 -0
  238. package/src/Core/components/HasSameFactoring.js +407 -0
  239. package/src/Core/components/Hint.js +241 -0
  240. package/src/Core/components/Image.js +524 -0
  241. package/src/Core/components/Indexing.js +79 -0
  242. package/src/Core/components/IntComma.js +64 -0
  243. package/src/Core/components/Integer.js +81 -0
  244. package/src/Core/components/Intersection.js +328 -0
  245. package/src/Core/components/Interval.js +29 -0
  246. package/src/Core/components/Label.js +492 -0
  247. package/src/Core/components/Latex.js +104 -0
  248. package/src/Core/components/Legend.js +329 -0
  249. package/src/Core/components/Line.js +2040 -0
  250. package/src/Core/components/LineSegment.js +882 -0
  251. package/src/Core/components/Lists.js +180 -0
  252. package/src/Core/components/Lorem.js +249 -0
  253. package/src/Core/components/MMeMen.js +377 -0
  254. package/src/Core/components/Map.js +873 -0
  255. package/src/Core/components/Markers.js +101 -0
  256. package/src/Core/components/MatchesPattern.js +339 -0
  257. package/src/Core/components/Math.js +2552 -0
  258. package/src/Core/components/MathInput.js +948 -0
  259. package/src/Core/components/MathList.js +828 -0
  260. package/src/Core/components/MathOperators.js +1286 -0
  261. package/src/Core/components/Matrix.js +497 -0
  262. package/src/Core/components/MatrixInput.js +3157 -0
  263. package/src/Core/components/MdMdnMrow.js +394 -0
  264. package/src/Core/components/Module.js +16 -0
  265. package/src/Core/components/Number.js +1031 -0
  266. package/src/Core/components/NumberList.js +550 -0
  267. package/src/Core/components/Option.js +24 -0
  268. package/src/Core/components/P.js +71 -0
  269. package/src/Core/components/Paginator.js +338 -0
  270. package/src/Core/components/Panel.js +126 -0
  271. package/src/Core/components/Parabola.js +1561 -0
  272. package/src/Core/components/ParagraphMarkup.js +59 -0
  273. package/src/Core/components/Pegboard.js +43 -0
  274. package/src/Core/components/PeriodicSet.js +291 -0
  275. package/src/Core/components/PiecewiseFunction.js +832 -0
  276. package/src/Core/components/Pluralize.js +198 -0
  277. package/src/Core/components/Point.js +1295 -0
  278. package/src/Core/components/Polygon.js +408 -0
  279. package/src/Core/components/Polyline.js +841 -0
  280. package/src/Core/components/RandomizedTextList.js +225 -0
  281. package/src/Core/components/Ray.js +1737 -0
  282. package/src/Core/components/Rectangle.js +1535 -0
  283. package/src/Core/components/Ref.js +350 -0
  284. package/src/Core/components/RegionBetweenCurveXAxis.js +124 -0
  285. package/src/Core/components/RegionHalfPlane.js +107 -0
  286. package/src/Core/components/RegularPolygon.js +2118 -0
  287. package/src/Core/components/RenderDoenetML.js +181 -0
  288. package/src/Core/components/Row.js +780 -0
  289. package/src/Core/components/SampleRandomNumbers.js +653 -0
  290. package/src/Core/components/Sectioning.js +303 -0
  291. package/src/Core/components/Select.js +947 -0
  292. package/src/Core/components/SelectFromSequence.js +1242 -0
  293. package/src/Core/components/SelectRandomNumbers.js +225 -0
  294. package/src/Core/components/Sequence.js +444 -0
  295. package/src/Core/components/Setup.js +53 -0
  296. package/src/Core/components/Shuffle.js +470 -0
  297. package/src/Core/components/SideBySide.js +2130 -0
  298. package/src/Core/components/SingleCharacterComponents.js +41 -0
  299. package/src/Core/components/Slider.js +819 -0
  300. package/src/Core/components/SolutionContainer.js +67 -0
  301. package/src/Core/components/Solutions.js +334 -0
  302. package/src/Core/components/SolveEquations.js +568 -0
  303. package/src/Core/components/Sort.js +398 -0
  304. package/src/Core/components/Sources.js +108 -0
  305. package/src/Core/components/Split.js +205 -0
  306. package/src/Core/components/Spreadsheet.js +1507 -0
  307. package/src/Core/components/StyleDefinitions.js +111 -0
  308. package/src/Core/components/SubsetOfReals.js +348 -0
  309. package/src/Core/components/SubsetOfRealsInput.js +1474 -0
  310. package/src/Core/components/Substitute.js +496 -0
  311. package/src/Core/components/SummaryStatistics.js +652 -0
  312. package/src/Core/components/Table.js +145 -0
  313. package/src/Core/components/Tabular.js +384 -0
  314. package/src/Core/components/Template.js +360 -0
  315. package/src/Core/components/Text.js +341 -0
  316. package/src/Core/components/TextInput.js +566 -0
  317. package/src/Core/components/TextList.js +442 -0
  318. package/src/Core/components/TextListFromString.js +137 -0
  319. package/src/Core/components/TextOperatorsOfMath.js +21 -0
  320. package/src/Core/components/Triangle.js +280 -0
  321. package/src/Core/components/TriggerSet.js +189 -0
  322. package/src/Core/components/TupleList.js +43 -0
  323. package/src/Core/components/UpdateValue.js +435 -0
  324. package/src/Core/components/VariantControl.js +36 -0
  325. package/src/Core/components/Vector.js +2478 -0
  326. package/src/Core/components/Verbatim.js +125 -0
  327. package/src/Core/components/Video.js +673 -0
  328. package/src/Core/components/When.js +198 -0
  329. package/src/Core/components/abstract/AngleListComponent.js +140 -0
  330. package/src/Core/components/abstract/BaseComponent.js +1496 -0
  331. package/src/Core/components/abstract/BlockComponent.js +5 -0
  332. package/src/Core/components/abstract/BooleanBaseOperator.js +88 -0
  333. package/src/Core/components/abstract/BooleanBaseOperatorOfMath.js +100 -0
  334. package/src/Core/components/abstract/BooleanBaseOperatorOneInput.js +44 -0
  335. package/src/Core/components/abstract/ComponentSize.js +789 -0
  336. package/src/Core/components/abstract/ComponentWithSelectableType.js +537 -0
  337. package/src/Core/components/abstract/CompositeComponent.js +142 -0
  338. package/src/Core/components/abstract/ConstraintComponent.js +19 -0
  339. package/src/Core/components/abstract/FunctionBaseOperator.js +680 -0
  340. package/src/Core/components/abstract/GraphicalComponent.js +56 -0
  341. package/src/Core/components/abstract/InlineComponent.js +5 -0
  342. package/src/Core/components/abstract/InlineRenderInlineChildren.js +63 -0
  343. package/src/Core/components/abstract/Input.js +192 -0
  344. package/src/Core/components/abstract/IntervalListComponent.js +218 -0
  345. package/src/Core/components/abstract/LineListComponent.js +114 -0
  346. package/src/Core/components/abstract/MathBaseOperator.js +631 -0
  347. package/src/Core/components/abstract/MathBaseOperatorOneInput.js +112 -0
  348. package/src/Core/components/abstract/PointListComponent.js +238 -0
  349. package/src/Core/components/abstract/SectioningComponent.js +1262 -0
  350. package/src/Core/components/abstract/SingleCharacterInline.js +23 -0
  351. package/src/Core/components/abstract/TextBaseOperatorOfMath.js +47 -0
  352. package/src/Core/components/abstract/TextOrInline.js +66 -0
  353. package/src/Core/components/abstract/VariableName.js +31 -0
  354. package/src/Core/components/abstract/VariableNameList.js +83 -0
  355. package/src/Core/components/abstract/VectorListComponent.js +235 -0
  356. package/src/Core/components/chemistry/Atom.js +910 -0
  357. package/src/Core/components/chemistry/ElectronConfiguration.js +36 -0
  358. package/src/Core/components/chemistry/Ion.js +684 -0
  359. package/src/Core/components/chemistry/IonicCompound.js +189 -0
  360. package/src/Core/components/chemistry/OrbitalDiagram.js +175 -0
  361. package/src/Core/components/chemistry/OrbitalDiagramInput.js +753 -0
  362. package/src/Core/components/chemistry/index.js +6 -0
  363. package/src/Core/components/commonsugar/breakstrings.js +627 -0
  364. package/src/Core/components/commonsugar/lists.js +177 -0
  365. package/src/Core/components/dynamicalSystems/CobwebPolyline.js +913 -0
  366. package/src/Core/components/dynamicalSystems/EquilibriumCurve.js +95 -0
  367. package/src/Core/components/dynamicalSystems/EquilibriumLine.js +93 -0
  368. package/src/Core/components/dynamicalSystems/EquilibriumPoint.js +93 -0
  369. package/src/Core/components/dynamicalSystems/ODESystem.js +943 -0
  370. package/src/Core/components/dynamicalSystems/index.js +5 -0
  371. package/src/Core/components/linearAlgebra/EigenDecomposition.js +294 -0
  372. package/src/Core/utils/array.js +30 -0
  373. package/src/Core/utils/booleanLogic.js +965 -0
  374. package/src/Core/utils/checkEquality.js +818 -0
  375. package/src/Core/utils/cid.js +29 -0
  376. package/src/Core/utils/componentInfoObjects.js +100 -0
  377. package/src/Core/utils/constraints.js +23 -0
  378. package/src/Core/utils/copy.js +572 -0
  379. package/src/Core/utils/deepFunctions.js +173 -0
  380. package/src/Core/utils/descendants.js +252 -0
  381. package/src/Core/utils/enumeration.js +234 -0
  382. package/src/Core/utils/feedback.js +84 -0
  383. package/src/Core/utils/function.js +1343 -0
  384. package/src/Core/utils/graphical.js +196 -0
  385. package/src/Core/utils/label.js +396 -0
  386. package/src/Core/utils/math.js +1056 -0
  387. package/src/Core/utils/naming.js +45 -0
  388. package/src/Core/utils/periodicSetEquality.js +403 -0
  389. package/src/Core/utils/randomNumbers.js +70 -0
  390. package/src/Core/utils/retrieveMedia.js +98 -0
  391. package/src/Core/utils/retrieveTextFile.js +140 -0
  392. package/src/Core/utils/returnAllPossibleVariants.js +73 -0
  393. package/src/Core/utils/rounding.js +316 -0
  394. package/src/Core/utils/sequence.js +754 -0
  395. package/src/Core/utils/serializedStateProcessing.js +4049 -0
  396. package/src/Core/utils/size.js +22 -0
  397. package/src/Core/utils/stateVariables.js +138 -0
  398. package/src/Core/utils/style.js +535 -0
  399. package/src/Core/utils/subset-of-reals.js +796 -0
  400. package/src/Core/utils/table.js +41 -0
  401. package/src/Core/utils/text.js +16 -0
  402. package/src/Core/utils/triggering.js +167 -0
  403. package/src/Core/utils/variants.js +477 -0
  404. package/src/DoenetML.css +308 -0
  405. package/src/DoenetML.jsx +201 -0
  406. package/src/Parser/doenet.grammar +90 -0
  407. package/src/Parser/doenet.js +33 -0
  408. package/src/Parser/doenet.terms.js +20 -0
  409. package/src/Parser/parser.js +266 -0
  410. package/src/Parser/tokens.js +129 -0
  411. package/src/Tools/CodeMirror.jsx +440 -0
  412. package/src/Tools/DarkmodeController.jsx +21 -0
  413. package/src/Tools/Footers/MathInputSelector.jsx +34 -0
  414. package/src/Tools/Footers/VirtualKeyboard.jsx +751 -0
  415. package/src/Tools/cypressTest/CypressTest.jsx +341 -0
  416. package/src/Tools/cypressTest/index.html +102 -0
  417. package/src/Tools/cypressTest/index.jsx +40 -0
  418. package/src/Viewer/ActivityViewer.jsx +1461 -0
  419. package/src/Viewer/PageViewer.jsx +1329 -0
  420. package/src/Viewer/renderers/alert.jsx +17 -0
  421. package/src/Viewer/renderers/angle.jsx +209 -0
  422. package/src/Viewer/renderers/answer.jsx +206 -0
  423. package/src/Viewer/renderers/asList.jsx +25 -0
  424. package/src/Viewer/renderers/blockQuote.jsx +41 -0
  425. package/src/Viewer/renderers/boolean.jsx +17 -0
  426. package/src/Viewer/renderers/booleanInput.css +105 -0
  427. package/src/Viewer/renderers/booleanInput.jsx +636 -0
  428. package/src/Viewer/renderers/button.jsx +369 -0
  429. package/src/Viewer/renderers/c.jsx +17 -0
  430. package/src/Viewer/renderers/callAction.jsx +18 -0
  431. package/src/Viewer/renderers/cell.jsx +59 -0
  432. package/src/Viewer/renderers/chart.jsx +83 -0
  433. package/src/Viewer/renderers/choiceInput.css +223 -0
  434. package/src/Viewer/renderers/choiceInput.jsx +535 -0
  435. package/src/Viewer/renderers/circle.jsx +990 -0
  436. package/src/Viewer/renderers/cobwebPolyline.jsx +442 -0
  437. package/src/Viewer/renderers/codeEditor.jsx +248 -0
  438. package/src/Viewer/renderers/codeViewer.jsx +105 -0
  439. package/src/Viewer/renderers/containerBlock.jsx +41 -0
  440. package/src/Viewer/renderers/containerInline.jsx +17 -0
  441. package/src/Viewer/renderers/contentBrowser.jsx +159 -0
  442. package/src/Viewer/renderers/contentPicker.jsx +160 -0
  443. package/src/Viewer/renderers/curve.jsx +1072 -0
  444. package/src/Viewer/renderers/ellipsis.jsx +17 -0
  445. package/src/Viewer/renderers/em.jsx +17 -0
  446. package/src/Viewer/renderers/embed.jsx +110 -0
  447. package/src/Viewer/renderers/feedback.jsx +74 -0
  448. package/src/Viewer/renderers/figure.jsx +131 -0
  449. package/src/Viewer/renderers/footnote.jsx +52 -0
  450. package/src/Viewer/renderers/graph.jsx +925 -0
  451. package/src/Viewer/renderers/hint.jsx +142 -0
  452. package/src/Viewer/renderers/image.jsx +581 -0
  453. package/src/Viewer/renderers/jsxgraph-distrib/jsxgraphcore.mjs +2 -0
  454. package/src/Viewer/renderers/jsxgraph-distrib/jsxgraphcore.mjs.map +1 -0
  455. package/src/Viewer/renderers/label.jsx +470 -0
  456. package/src/Viewer/renderers/legend.jsx +306 -0
  457. package/src/Viewer/renderers/line.jsx +511 -0
  458. package/src/Viewer/renderers/lineSegment.jsx +754 -0
  459. package/src/Viewer/renderers/list.jsx +111 -0
  460. package/src/Viewer/renderers/lq.jsx +12 -0
  461. package/src/Viewer/renderers/lsq.jsx +12 -0
  462. package/src/Viewer/renderers/math.jsx +582 -0
  463. package/src/Viewer/renderers/mathInput.css +10 -0
  464. package/src/Viewer/renderers/mathInput.jsx +425 -0
  465. package/src/Viewer/renderers/mathInputog.jsx +534 -0
  466. package/src/Viewer/renderers/mathList.jsx +39 -0
  467. package/src/Viewer/renderers/matrixInput.jsx +317 -0
  468. package/src/Viewer/renderers/mdash.jsx +12 -0
  469. package/src/Viewer/renderers/nbsp.jsx +12 -0
  470. package/src/Viewer/renderers/ndash.jsx +12 -0
  471. package/src/Viewer/renderers/number.jsx +454 -0
  472. package/src/Viewer/renderers/numberList.jsx +35 -0
  473. package/src/Viewer/renderers/orbitalDiagram.jsx +247 -0
  474. package/src/Viewer/renderers/orbitalDiagramInput.jsx +450 -0
  475. package/src/Viewer/renderers/p.jsx +38 -0
  476. package/src/Viewer/renderers/paginatorControls.jsx +41 -0
  477. package/src/Viewer/renderers/pegboard.jsx +239 -0
  478. package/src/Viewer/renderers/point.jsx +649 -0
  479. package/src/Viewer/renderers/polygon.jsx +612 -0
  480. package/src/Viewer/renderers/polyline.jsx +608 -0
  481. package/src/Viewer/renderers/pre.jsx +34 -0
  482. package/src/Viewer/renderers/q.jsx +17 -0
  483. package/src/Viewer/renderers/ray.jsx +410 -0
  484. package/src/Viewer/renderers/ref.jsx +149 -0
  485. package/src/Viewer/renderers/regionBetweenCurveXAxis.jsx +182 -0
  486. package/src/Viewer/renderers/renderDoenetML.jsx +56 -0
  487. package/src/Viewer/renderers/row.jsx +31 -0
  488. package/src/Viewer/renderers/rq.jsx +12 -0
  489. package/src/Viewer/renderers/rsq.jsx +12 -0
  490. package/src/Viewer/renderers/section.jsx +427 -0
  491. package/src/Viewer/renderers/sideBySide.jsx +80 -0
  492. package/src/Viewer/renderers/slider.jsx +800 -0
  493. package/src/Viewer/renderers/solution.jsx +134 -0
  494. package/src/Viewer/renderers/spreadsheet.jsx +83 -0
  495. package/src/Viewer/renderers/sq.jsx +17 -0
  496. package/src/Viewer/renderers/styles/global.css +14 -0
  497. package/src/Viewer/renderers/subsetOfRealsInput.jsx +392 -0
  498. package/src/Viewer/renderers/summaryStatistics.jsx +83 -0
  499. package/src/Viewer/renderers/table.jsx +78 -0
  500. package/src/Viewer/renderers/tabular.jsx +58 -0
  501. package/src/Viewer/renderers/tag.jsx +26 -0
  502. package/src/Viewer/renderers/text.jsx +439 -0
  503. package/src/Viewer/renderers/textInput.jsx +774 -0
  504. package/src/Viewer/renderers/textList.jsx +30 -0
  505. package/src/Viewer/renderers/triggerSet.jsx +52 -0
  506. package/src/Viewer/renderers/updateValue.jsx +30 -0
  507. package/src/Viewer/renderers/utils/css.js +13 -0
  508. package/src/Viewer/renderers/utils/graph.js +159 -0
  509. package/src/Viewer/renderers/utils/offGraphIndicators.js +91 -0
  510. package/src/Viewer/renderers/vector.jsx +678 -0
  511. package/src/Viewer/renderers/video.jsx +494 -0
  512. package/src/Viewer/useDoenetRenderer.jsx +128 -0
  513. package/src/main.jsx +16 -0
  514. package/src/media/fonts/files/open-sans-v18-latin-700.woff +0 -0
  515. package/src/media/fonts/files/open-sans-v18-latin-700.woff2 +0 -0
  516. package/src/media/fonts/files/open-sans-v18-latin-700italic.woff +0 -0
  517. package/src/media/fonts/files/open-sans-v18-latin-700italic.woff2 +0 -0
  518. package/src/media/fonts/files/open-sans-v18-latin-italic.woff +0 -0
  519. package/src/media/fonts/files/open-sans-v18-latin-italic.woff2 +0 -0
  520. package/src/media/fonts/files/open-sans-v18-latin-light-italic.woff +0 -0
  521. package/src/media/fonts/files/open-sans-v18-latin-light-italic.woff2 +0 -0
  522. package/src/media/fonts/files/open-sans-v18-latin-light.woff +0 -0
  523. package/src/media/fonts/files/open-sans-v18-latin-light.woff2 +0 -0
  524. package/src/media/fonts/files/open-sans-v18-latin-regular.woff +0 -0
  525. package/src/media/fonts/files/open-sans-v18-latin-regular.woff2 +0 -0
  526. package/src/test/testCode.doenet +26 -0
  527. package/src/test/testViewer.jsx +158 -0
  528. package/src/uiComponents/ActionButton.jsx +157 -0
  529. package/src/uiComponents/ActionButtonGroup.jsx +93 -0
  530. package/src/uiComponents/Button.jsx +160 -0
  531. package/src/uiComponents/ButtonGroup.jsx +56 -0
  532. package/src/uiComponents/ToggleButton.jsx +194 -0
  533. package/src/uiComponents/ToggleButtonGroup.jsx +77 -0
  534. package/src/utils/activityUtils.js +713 -0
  535. package/src/utils/array.js +17 -0
  536. package/src/utils/cid.js +34 -0
  537. package/src/utils/componentInfoObjects.js +89 -0
  538. package/src/utils/deepFunctions.js +165 -0
  539. package/src/utils/enumeration.js +226 -0
  540. package/src/utils/math.js +624 -0
  541. package/src/utils/naming.js +44 -0
  542. package/src/utils/retrieveTextFile.js +156 -0
  543. package/src/utils/returnAllPossibleVariants.js +81 -0
  544. package/src/utils/sequence.js +715 -0
  545. package/src/utils/serialize.js +29 -0
  546. package/src/utils/serializedStateProcessing.js +2587 -0
  547. package/src/utils/subset-of-reals.js +783 -0
  548. package/src/utils/url.js +19 -0
  549. package/vite.config.js +14 -0
@@ -0,0 +1,2689 @@
1
+ import { cesc, cesc2 } from "../../../../src/utils/url";
2
+
3
+ describe("Math Display Tag Tests", function () {
4
+ beforeEach(() => {
5
+ cy.clearIndexedDB();
6
+ cy.visit("/src/Tools/cypressTest/");
7
+ });
8
+
9
+ it("inline and display", () => {
10
+ cy.window().then(async (win) => {
11
+ win.postMessage(
12
+ {
13
+ doenetML: `
14
+ <text>a</text>
15
+ <m>\\sin(x)</m>
16
+ <me>\\cos(x)</me>
17
+ `,
18
+ },
19
+ "*",
20
+ );
21
+ });
22
+
23
+ cy.get(cesc("#\\/_text1")).should("have.text", "a"); // to wait until loaded
24
+
25
+ cy.log("Test value displayed in browser");
26
+ cy.get(cesc("#\\/_m1"))
27
+ .find(".mjx-mrow")
28
+ .eq(0)
29
+ .invoke("text")
30
+ .then((text) => {
31
+ expect(text.trim()).equal("sin(x)");
32
+ });
33
+ // not sure how to test that it is centered
34
+ cy.get(cesc("#\\/_me1"))
35
+ .find(".mjx-mrow")
36
+ .eq(0)
37
+ .invoke("text")
38
+ .then((text) => {
39
+ expect(text.trim()).equal("cos(x)");
40
+ });
41
+ });
42
+
43
+ it("numbered equations", () => {
44
+ cy.window().then(async (win) => {
45
+ win.postMessage(
46
+ {
47
+ doenetML: `
48
+ <text>a</text>
49
+ <lorem generateParagraphs="2" />
50
+ <men name="e1">\\sin(x)</men>
51
+ <lorem generateParagraphs="2" />
52
+ <men name="e2">\\cos(x)</men>
53
+ <lorem generateParagraphs="2" />
54
+ <men name="e3">\\tan(x)</men>
55
+ <lorem generateParagraphs="2" />
56
+
57
+ <p>We have equation <ref target="e1" name="re1" />, equation <ref target="e2" name="re2" />, and equation <ref target="e3" name="re3" />.</p>
58
+ <p>From copying properties: <copy prop="equationTag" target="e1" assignNames="te1" />, <copy prop="equationTag" target="e2" assignNames="te2" />, and <copy prop="equationTag" target="e3" assignNames="te3" />.</p>
59
+
60
+ <lorem generateParagraphs="8" />
61
+
62
+ `,
63
+ },
64
+ "*",
65
+ );
66
+ });
67
+
68
+ cy.get(cesc("#\\/_text1")).should("have.text", "a"); // to wait until loaded
69
+
70
+ cy.log("Test value displayed in browser");
71
+ cy.get(cesc("#\\/e1"))
72
+ .find(".mjx-mrow")
73
+ .eq(0)
74
+ .invoke("text")
75
+ .then((text) => {
76
+ expect(text.trim()).equal("sin(x)(1)");
77
+ });
78
+ cy.get(cesc("#\\/e2"))
79
+ .find(".mjx-mrow")
80
+ .eq(0)
81
+ .invoke("text")
82
+ .then((text) => {
83
+ expect(text.trim()).equal("cos(x)(2)");
84
+ });
85
+ cy.get(cesc("#\\/e3"))
86
+ .find(".mjx-mrow")
87
+ .eq(0)
88
+ .invoke("text")
89
+ .then((text) => {
90
+ expect(text.trim()).equal("tan(x)(3)");
91
+ });
92
+ cy.get(cesc("#\\/_p1")).should(
93
+ "have.text",
94
+ "We have equation (1), equation (2), and equation (3).",
95
+ );
96
+ cy.get(cesc("#\\/re1")).should("have.text", "(1)");
97
+ cy.get(cesc("#\\/re2")).should("have.text", "(2)");
98
+ cy.get(cesc("#\\/re3")).should("have.text", "(3)");
99
+
100
+ cy.get(cesc("#\\/_p2")).should(
101
+ "have.text",
102
+ "From copying properties: 1, 2, and 3.",
103
+ );
104
+ cy.get(cesc("#\\/te1")).should("have.text", "1");
105
+ cy.get(cesc("#\\/te2")).should("have.text", "2");
106
+ cy.get(cesc("#\\/te3")).should("have.text", "3");
107
+
108
+ cy.get(cesc("#\\/re1")).click();
109
+
110
+ cy.get(cesc("#\\/e1")).then((el) => {
111
+ let rect = el[0].getBoundingClientRect();
112
+ expect(rect.top).gt(-1).lt(5);
113
+ });
114
+
115
+ cy.get(cesc("#\\/re2")).click();
116
+
117
+ cy.get(cesc("#\\/e2")).then((el) => {
118
+ let rect = el[0].getBoundingClientRect();
119
+ expect(rect.top).gt(-1).lt(5);
120
+ });
121
+
122
+ cy.get(cesc("#\\/re3")).click();
123
+
124
+ cy.get(cesc("#\\/e3")).then((el) => {
125
+ let rect = el[0].getBoundingClientRect();
126
+ expect(rect.top).gt(-1).lt(5);
127
+ });
128
+ });
129
+
130
+ it("dynamic numbered equations", () => {
131
+ cy.window().then(async (win) => {
132
+ win.postMessage(
133
+ {
134
+ doenetML: `
135
+ <text>a</text>
136
+ <p>Number of equations 1: <mathinput prefill="2" name="m" /></p>
137
+ <p>Number of equations 2: <mathinput prefill="1" name="n" /></p>
138
+
139
+ <men name="x">x</men>
140
+ <map assignNames="m1 m2 m3 m4 m5 m6">
141
+ <template newNamespace><men name='eq'>$i m</men></template>
142
+ <sources indexAlias="i"><sequence length="$m" /></sources>
143
+ </map>
144
+ <men name="y">y</men>
145
+ <map assignNames="n1 n2 n3 n4 n5 n6">
146
+ <template newNamespace><men name="eq">$i n</men></template>
147
+ <sources indexAlias="i"><sequence length="$n" /></sources>
148
+ </map>
149
+ <men name="z">z</men>
150
+
151
+ <p name="px">x: <copy prop="equationTag" assignNames="etx" target="x" />, equation <ref target="x" name="rx" /></p>
152
+ <p name="pm1">m1: <copy prop="equationTag" assignNames="etm1" target="m1/eq" />, equation <ref target="m1/eq" name="rm1" /></p>
153
+ <p name="pm2">m2: <copy prop="equationTag" assignNames="etm2" target="m2/eq" />, equation <ref target="m2/eq" name="rm2" /></p>
154
+ <p name="pm3">m3: <copy prop="equationTag" assignNames="etm3" target="m3/eq" />, equation <ref target="m3/eq" name="rm3" /></p>
155
+ <p name="pm4">m4: <copy prop="equationTag" assignNames="etm4" target="m4/eq" />, equation <ref target="m4/eq" name="rm4" /></p>
156
+ <p name="pm5">m5: <copy prop="equationTag" assignNames="etm5" target="m5/eq" />, equation <ref target="m5/eq" name="rm5" /></p>
157
+ <p name="pm6">m6: <copy prop="equationTag" assignNames="etm6" target="m6/eq" />, equation <ref target="m6/eq" name="rm6" /></p>
158
+ <p name="py">y: <copy prop="equationTag" assignNames="ety" target="y" />, equation <ref target="y" name="ry" /></p>
159
+ <p name="pn1">n1: <copy prop="equationTag" assignNames="etn1" target="n1/eq" />, equation <ref target="n1/eq" name="rn1" /></p>
160
+ <p name="pn2">n2: <copy prop="equationTag" assignNames="etn2" target="n2/eq" />, equation <ref target="n2/eq" name="rn2" /></p>
161
+ <p name="pn3">n3: <copy prop="equationTag" assignNames="etn3" target="n3/eq" />, equation <ref target="n3/eq" name="rn3" /></p>
162
+ <p name="pn4">n4: <copy prop="equationTag" assignNames="etn4" target="n4/eq" />, equation <ref target="n4/eq" name="rn4" /></p>
163
+ <p name="pn5">n5: <copy prop="equationTag" assignNames="etn5" target="n5/eq" />, equation <ref target="n5/eq" name="rn5" /></p>
164
+ <p name="pn6">n6: <copy prop="equationTag" assignNames="etn6" target="n6/eq" />, equation <ref target="n6/eq" name="rn6" /></p>
165
+ <p name="pz">z: <copy prop="equationTag" assignNames="etz" target="z" />, equation <ref target="z" name="rz" /></p>
166
+ <p>
167
+ <copy prop="value" target="m" assignNames="ma" />
168
+ <copy prop="value" target="n" assignNames="na" />
169
+ </p>
170
+ <lorem generateParagraphs="8" />
171
+ `,
172
+ },
173
+ "*",
174
+ );
175
+ });
176
+
177
+ cy.get(cesc("#\\/_text1")).should("have.text", "a"); // to wait until loaded
178
+
179
+ cy.log("Test value displayed in browser");
180
+
181
+ function checkEquationNumbering(m, n) {
182
+ let counter = 1;
183
+
184
+ cy.get(cesc("#\\/x"))
185
+ .find(".mjx-mrow")
186
+ .eq(0)
187
+ .invoke("text")
188
+ .then((text) => {
189
+ expect(text.trim()).equal(`x(${counter})`);
190
+ });
191
+ cy.get(cesc("#\\/px")).should(
192
+ "have.text",
193
+ `x: ${counter}, equation (${counter})`,
194
+ );
195
+ cy.get(cesc("#\\/etx")).should("have.text", `${counter}`);
196
+ cy.get(cesc("#\\/rx")).should("have.text", `(${counter})`);
197
+ cy.get(cesc("#\\/rx")).click();
198
+ cy.get(cesc("#\\/x")).then((el) => {
199
+ let rect = el[0].getBoundingClientRect();
200
+ expect(rect.top).gt(-1).lt(5);
201
+ });
202
+
203
+ for (let i = 1; i <= m; i++) {
204
+ cy.window().then(async (win) => {
205
+ counter++;
206
+ cy.get(cesc(`#\\/m${i}\\/eq`))
207
+ .find(".mjx-mrow")
208
+ .eq(0)
209
+ .invoke("text")
210
+ .then((text) => {
211
+ expect(text.trim()).equal(`${i}m(${counter})`);
212
+ });
213
+ if (i <= 6) {
214
+ cy.get(cesc(`#\\/pm${i}`)).should(
215
+ "have.text",
216
+ `m${i}: ${counter}, equation (${counter})`,
217
+ );
218
+ cy.get(cesc(`#\\/etm${i}`)).should("have.text", `${counter}`);
219
+ cy.get(cesc(`#\\/rm${i}`)).should("have.text", `(${counter})`);
220
+ cy.get(cesc(`#\\/rm${i}`)).click();
221
+ cy.get(cesc(`#\\/m${i}\\/eq`)).then((el) => {
222
+ let rect = el[0].getBoundingClientRect();
223
+ expect(rect.top).gt(-1).lt(5);
224
+ });
225
+ }
226
+ });
227
+ }
228
+ for (let i = m + 1; i <= 6; i++) {
229
+ cy.window().then(async (win) => {
230
+ cy.get(cesc(`#\\/pm${i}`)).should(
231
+ "have.text",
232
+ `m${i}: , equation ???`,
233
+ );
234
+ cy.get(cesc(`#\\/etm${i}`)).should("not.exist");
235
+ cy.get(cesc(`#\\/rm${i}`)).should("have.text", `???`);
236
+ cy.get(cesc(`#\\/rm${i}`)).click();
237
+ cy.window().then(async (win) => {
238
+ expect(win.scrollY).eq(0);
239
+ });
240
+ });
241
+ }
242
+
243
+ cy.window().then(async (win) => {
244
+ counter++;
245
+ cy.get(cesc("#\\/y"))
246
+ .find(".mjx-mrow")
247
+ .eq(0)
248
+ .invoke("text")
249
+ .then((text) => {
250
+ expect(text.trim()).equal(`y(${counter})`);
251
+ });
252
+ cy.get(cesc("#\\/py")).should(
253
+ "have.text",
254
+ `y: ${counter}, equation (${counter})`,
255
+ );
256
+ cy.get(cesc("#\\/ety")).should("have.text", `${counter}`);
257
+ cy.get(cesc("#\\/ry")).should("have.text", `(${counter})`);
258
+ cy.get(cesc("#\\/ry")).click();
259
+ cy.get(cesc("#\\/y")).then((el) => {
260
+ let rect = el[0].getBoundingClientRect();
261
+ expect(rect.top).gt(-1).lt(5);
262
+ });
263
+ });
264
+
265
+ for (let i = 1; i <= n; i++) {
266
+ cy.window().then(async (win) => {
267
+ counter++;
268
+ cy.get(cesc(`#\\/n${i}\\/eq`))
269
+ .find(".mjx-mrow")
270
+ .eq(0)
271
+ .invoke("text")
272
+ .then((text) => {
273
+ expect(text.trim()).equal(`${i}n(${counter})`);
274
+ });
275
+ if (i <= 6) {
276
+ cy.get(cesc(`#\\/pn${i}`)).should(
277
+ "have.text",
278
+ `n${i}: ${counter}, equation (${counter})`,
279
+ );
280
+ cy.get(cesc(`#\\/etn${i}`)).should("have.text", `${counter}`);
281
+ cy.get(cesc(`#\\/rn${i}`)).should("have.text", `(${counter})`);
282
+ cy.get(cesc(`#\\/rn${i}`)).click();
283
+ cy.get(cesc(`#\\/n${i}\\/eq`)).then((el) => {
284
+ let rect = el[0].getBoundingClientRect();
285
+ expect(rect.top).gt(-1).lt(5);
286
+ });
287
+ }
288
+ });
289
+ }
290
+
291
+ for (let i = n + 1; i <= 6; i++) {
292
+ cy.window().then(async (win) => {
293
+ cy.get(cesc(`#\\/pn${i}`)).should(
294
+ "have.text",
295
+ `n${i}: , equation ???`,
296
+ );
297
+ cy.get(cesc(`#\\/etn${i}`)).should("not.exist");
298
+ cy.get(cesc(`#\\/rn${i}`)).should("have.text", `???`);
299
+ cy.get(cesc(`#\\/rn${i}`)).click();
300
+ cy.window().then(async (win) => {
301
+ expect(win.scrollY).eq(0);
302
+ });
303
+ });
304
+ }
305
+
306
+ cy.window().then(async (win) => {
307
+ counter++;
308
+ cy.get(cesc("#\\/z"))
309
+ .find(".mjx-mrow")
310
+ .eq(0)
311
+ .invoke("text")
312
+ .then((text) => {
313
+ expect(text.trim()).equal(`z(${counter})`);
314
+ });
315
+ cy.get(cesc("#\\/pz")).should(
316
+ "have.text",
317
+ `z: ${counter}, equation (${counter})`,
318
+ );
319
+ cy.get(cesc("#\\/etz")).should("have.text", `${counter}`);
320
+ cy.get(cesc("#\\/rz")).should("have.text", `(${counter})`);
321
+ cy.get(cesc("#\\/rz")).click();
322
+ cy.get(cesc("#\\/z")).then((el) => {
323
+ let rect = el[0].getBoundingClientRect();
324
+ expect(rect.top).gt(-1).lt(5);
325
+ });
326
+ });
327
+ }
328
+
329
+ checkEquationNumbering(2, 1);
330
+
331
+ cy.get(cesc("#\\/m") + " textarea").type(`{end}{backspace}4{enter}`, {
332
+ force: true,
333
+ });
334
+ cy.get(cesc("#\\/ma")).should("contain.text", "4");
335
+ checkEquationNumbering(4, 1);
336
+
337
+ cy.get(cesc("#\\/n") + " textarea").type(`{end}{backspace}2{enter}`, {
338
+ force: true,
339
+ });
340
+ cy.get(cesc("#\\/na")).should("contain.text", "2");
341
+ checkEquationNumbering(4, 2);
342
+
343
+ cy.get(cesc("#\\/m") + " textarea").type(`{end}{backspace}0{enter}`, {
344
+ force: true,
345
+ });
346
+ cy.get(cesc("#\\/ma")).should("contain.text", "0");
347
+ checkEquationNumbering(0, 2);
348
+
349
+ cy.get(cesc("#\\/n") + " textarea").type(`{end}{backspace}6{enter}`, {
350
+ force: true,
351
+ });
352
+ cy.get(cesc("#\\/na")).should("contain.text", "6");
353
+ checkEquationNumbering(0, 6);
354
+
355
+ cy.get(cesc("#\\/m") + " textarea").type(`{end}{backspace}3{enter}`, {
356
+ force: true,
357
+ });
358
+ cy.get(cesc("#\\/ma")).should("contain.text", "3");
359
+ checkEquationNumbering(3, 6);
360
+
361
+ cy.get(cesc("#\\/n") + " textarea").type(`{end}{backspace}1{enter}`, {
362
+ force: true,
363
+ });
364
+ cy.get(cesc("#\\/na")).should("contain.text", "1");
365
+ checkEquationNumbering(3, 1);
366
+ });
367
+
368
+ it("math inside", () => {
369
+ cy.window().then(async (win) => {
370
+ win.postMessage(
371
+ {
372
+ doenetML: `
373
+ <text>a</text>
374
+ <m><math simplify>x+x</math></m>
375
+ <me><math simplify>y+y</math></me>
376
+ <men><math simplify>z+z</math></men>
377
+ `,
378
+ },
379
+ "*",
380
+ );
381
+ });
382
+
383
+ cy.get(cesc("#\\/_text1")).should("have.text", "a"); // to wait until loaded
384
+
385
+ cy.log("Test value displayed in browser");
386
+ cy.get(cesc("#\\/_m1"))
387
+ .find(".mjx-mrow")
388
+ .eq(0)
389
+ .invoke("text")
390
+ .then((text) => {
391
+ expect(text.trim()).equal("2x");
392
+ });
393
+ cy.get(cesc("#\\/_me1"))
394
+ .find(".mjx-mrow")
395
+ .eq(0)
396
+ .invoke("text")
397
+ .then((text) => {
398
+ expect(text.trim()).equal("2y");
399
+ });
400
+ cy.get(cesc("#\\/_men1"))
401
+ .find(".mjx-mrow")
402
+ .eq(0)
403
+ .invoke("text")
404
+ .then((text) => {
405
+ expect(text.trim()).equal("2z(1)");
406
+ });
407
+ });
408
+
409
+ it("number inside", () => {
410
+ cy.window().then(async (win) => {
411
+ win.postMessage(
412
+ {
413
+ doenetML: `
414
+ <text>a</text>
415
+ <m><number>1</number></m>
416
+ <me><number>2+0i</number></me>
417
+ <men><number>3+4i</number></men>
418
+ <m><number>5+1i</number></m>
419
+ <me><number>6-1i</number></me>
420
+ <men><number>0-i</number></men>
421
+ `,
422
+ },
423
+ "*",
424
+ );
425
+ });
426
+
427
+ cy.get(cesc("#\\/_text1")).should("have.text", "a"); // to wait until loaded
428
+
429
+ cy.log("Test value displayed in browser");
430
+ cy.get(cesc("#\\/_m1"))
431
+ .find(".mjx-mrow")
432
+ .eq(0)
433
+ .invoke("text")
434
+ .then((text) => {
435
+ expect(text.trim()).equal("1");
436
+ });
437
+ cy.get(cesc("#\\/_me1"))
438
+ .find(".mjx-mrow")
439
+ .eq(0)
440
+ .invoke("text")
441
+ .then((text) => {
442
+ expect(text.trim()).equal("2");
443
+ });
444
+ cy.get(cesc("#\\/_men1"))
445
+ .find(".mjx-mtd")
446
+ .eq(0)
447
+ .invoke("text")
448
+ .then((text) => {
449
+ expect(text.trim()).equal("3+4i");
450
+ });
451
+ cy.get(cesc("#\\/_m2"))
452
+ .find(".mjx-mrow")
453
+ .eq(0)
454
+ .invoke("text")
455
+ .then((text) => {
456
+ expect(text.trim()).equal("5+i");
457
+ });
458
+ cy.get(cesc("#\\/_me2"))
459
+ .find(".mjx-mrow")
460
+ .eq(0)
461
+ .invoke("text")
462
+ .then((text) => {
463
+ expect(text.trim()).equal("6−i");
464
+ });
465
+ cy.get(cesc("#\\/_men2"))
466
+ .find(".mjx-mtd")
467
+ .eq(0)
468
+ .invoke("text")
469
+ .then((text) => {
470
+ expect(text.trim()).equal("−i");
471
+ });
472
+ });
473
+
474
+ it("align equations", () => {
475
+ cy.window().then(async (win) => {
476
+ win.postMessage(
477
+ {
478
+ doenetML: `
479
+ <text>a</text>
480
+ <md>
481
+ <mrow>q \\amp = sin(x)</mrow>
482
+ <mrow>cos(x) \\amp = z</mrow>
483
+ </md>
484
+ <mdn>
485
+ <mrow>q \\amp = sin(x)</mrow>
486
+ <mrow>cos(x) \\amp = z</mrow>
487
+ </mdn>
488
+ <md>
489
+ <mrow number="true">q \\amp = sin(x)</mrow>
490
+ <mrow number="true">cos(x) \\amp = z</mrow>
491
+ </md>
492
+ <mdn>
493
+ <mrow number="false">q \\amp = sin(x)</mrow>
494
+ <mrow number="false">cos(x) \\amp = z</mrow>
495
+ </mdn>
496
+ `,
497
+ },
498
+ "*",
499
+ );
500
+ });
501
+
502
+ cy.get(cesc("#\\/_text1")).should("have.text", "a"); // to wait until loaded
503
+
504
+ cy.log("Test value displayed in browser");
505
+ cy.get(cesc("#\\/_md1"))
506
+ .find(".mjx-mtr")
507
+ .eq(0)
508
+ .invoke("text")
509
+ .then((text) => {
510
+ expect(text.trim()).equal("q=sin(x)");
511
+ });
512
+ cy.get(cesc("#\\/_md1"))
513
+ .find(".mjx-mtr")
514
+ .eq(1)
515
+ .invoke("text")
516
+ .then((text) => {
517
+ expect(text.trim()).equal("cos(x)=z");
518
+ });
519
+ cy.get(cesc("#\\/_mdn1"))
520
+ .find(".mjx-mlabeledtr")
521
+ .eq(0)
522
+ .invoke("text")
523
+ .then((text) => {
524
+ expect(text.trim()).equal("q=sin(x)");
525
+ });
526
+ cy.get(cesc("#\\/_mdn1"))
527
+ .find(".mjx-mlabeledtr")
528
+ .eq(1)
529
+ .invoke("text")
530
+ .then((text) => {
531
+ expect(text.trim()).equal("cos(x)=z");
532
+ });
533
+ cy.get(cesc("#\\/_mdn1"))
534
+ .find(".mjx-label")
535
+ .eq(0)
536
+ .invoke("text")
537
+ .then((text) => {
538
+ expect(text.trim()).equal("(1)");
539
+ });
540
+ cy.get(cesc("#\\/_mdn1"))
541
+ .find(".mjx-label")
542
+ .eq(1)
543
+ .invoke("text")
544
+ .then((text) => {
545
+ expect(text.trim()).equal("(2)");
546
+ });
547
+ cy.get(cesc("#\\/_md2"))
548
+ .find(".mjx-mlabeledtr")
549
+ .eq(0)
550
+ .invoke("text")
551
+ .then((text) => {
552
+ expect(text.trim()).equal("q=sin(x)");
553
+ });
554
+ cy.get(cesc("#\\/_md2"))
555
+ .find(".mjx-mlabeledtr")
556
+ .eq(1)
557
+ .invoke("text")
558
+ .then((text) => {
559
+ expect(text.trim()).equal("cos(x)=z");
560
+ });
561
+ cy.get(cesc("#\\/_md2"))
562
+ .find(".mjx-label")
563
+ .eq(0)
564
+ .invoke("text")
565
+ .then((text) => {
566
+ expect(text.trim()).equal("(3)");
567
+ });
568
+ cy.get(cesc("#\\/_md2"))
569
+ .find(".mjx-label")
570
+ .eq(1)
571
+ .invoke("text")
572
+ .then((text) => {
573
+ expect(text.trim()).equal("(4)");
574
+ });
575
+ cy.get(cesc("#\\/_mdn2"))
576
+ .find(".mjx-mtr")
577
+ .eq(0)
578
+ .invoke("text")
579
+ .then((text) => {
580
+ expect(text.trim()).equal("q=sin(x)");
581
+ });
582
+ cy.get(cesc("#\\/_mdn2"))
583
+ .find(".mjx-mtr")
584
+ .eq(1)
585
+ .invoke("text")
586
+ .then((text) => {
587
+ expect(text.trim()).equal("cos(x)=z");
588
+ });
589
+ });
590
+
591
+ it("dynamic numbered aligned equations", () => {
592
+ cy.window().then(async (win) => {
593
+ win.postMessage(
594
+ {
595
+ doenetML: `
596
+ <text>a</text>
597
+ <p>Number of equations 1: <mathinput prefill="2" name="m" /></p>
598
+ <p>Number of equations 2: <mathinput prefill="1" name="n" /></p>
599
+
600
+ <men name="x">x</men>
601
+ <mdn name="ms">
602
+ <map assignNames="m1 m2 m3 m4 m5 m6">
603
+ <template newNamespace><mrow name='eq'>$i m &amp;= $v</mrow></template>
604
+ <sources indexAlias="i" alias="v"><sequence length="$m" from="11" /></sources>
605
+ </map>
606
+ </mdn>
607
+ <men name="y">y</men>
608
+ <mdn name="ns">
609
+ <map assignNames="n1 n2 n3 n4 n5 n6">
610
+ <template newNamespace><mrow name="eq">$i n &= $v</mrow></template>
611
+ <sources indexAlias="i" alias="v"><sequence length="$n" from="11" /></sources>
612
+ </map>
613
+ </mdn>
614
+ <men name="z">z</men>
615
+
616
+ <p name="px">x: <copy prop="equationTag" assignNames="etx" target="x" />, equation <ref target="x" name="rx" /></p>
617
+ <p name="pm1">m1: <copy prop="equationTag" assignNames="etm1" target="m1/eq" />, equation <ref target="m1/eq" name="rm1" /></p>
618
+ <p name="pm2">m2: <copy prop="equationTag" assignNames="etm2" target="m2/eq" />, equation <ref target="m2/eq" name="rm2" /></p>
619
+ <p name="pm3">m3: <copy prop="equationTag" assignNames="etm3" target="m3/eq" />, equation <ref target="m3/eq" name="rm3" /></p>
620
+ <p name="pm4">m4: <copy prop="equationTag" assignNames="etm4" target="m4/eq" />, equation <ref target="m4/eq" name="rm4" /></p>
621
+ <p name="pm5">m5: <copy prop="equationTag" assignNames="etm5" target="m5/eq" />, equation <ref target="m5/eq" name="rm5" /></p>
622
+ <p name="pm6">m6: <copy prop="equationTag" assignNames="etm6" target="m6/eq" />, equation <ref target="m6/eq" name="rm6" /></p>
623
+ <p name="py">y: <copy prop="equationTag" assignNames="ety" target="y" />, equation <ref target="y" name="ry" /></p>
624
+ <p name="pn1">n1: <copy prop="equationTag" assignNames="etn1" target="n1/eq" />, equation <ref target="n1/eq" name="rn1" /></p>
625
+ <p name="pn2">n2: <copy prop="equationTag" assignNames="etn2" target="n2/eq" />, equation <ref target="n2/eq" name="rn2" /></p>
626
+ <p name="pn3">n3: <copy prop="equationTag" assignNames="etn3" target="n3/eq" />, equation <ref target="n3/eq" name="rn3" /></p>
627
+ <p name="pn4">n4: <copy prop="equationTag" assignNames="etn4" target="n4/eq" />, equation <ref target="n4/eq" name="rn4" /></p>
628
+ <p name="pn5">n5: <copy prop="equationTag" assignNames="etn5" target="n5/eq" />, equation <ref target="n5/eq" name="rn5" /></p>
629
+ <p name="pn6">n6: <copy prop="equationTag" assignNames="etn6" target="n6/eq" />, equation <ref target="n6/eq" name="rn6" /></p>
630
+ <p name="pz">z: <copy prop="equationTag" assignNames="etz" target="z" />, equation <ref target="z" name="rz" /></p>
631
+ <p>
632
+ <copy prop="value" target="m" assignNames="ma" />
633
+ <copy prop="value" target="n" assignNames="na" />
634
+ </p>
635
+ <lorem generateParagraphs="8" />
636
+ `,
637
+ },
638
+ "*",
639
+ );
640
+ });
641
+
642
+ cy.get(cesc("#\\/_text1")).should("have.text", "a"); // to wait until loaded
643
+
644
+ cy.log("Test value displayed in browser");
645
+
646
+ function checkEquationNumbering(m, n) {
647
+ let counter = 1;
648
+
649
+ cy.get(cesc("#\\/x"))
650
+ .find(".mjx-mrow")
651
+ .eq(0)
652
+ .invoke("text")
653
+ .then((text) => {
654
+ expect(text.trim()).equal(`x(${counter})`);
655
+ });
656
+ cy.get(cesc("#\\/px")).should(
657
+ "have.text",
658
+ `x: ${counter}, equation (${counter})`,
659
+ );
660
+ cy.get(cesc("#\\/etx")).should("have.text", `${counter}`);
661
+ cy.get(cesc("#\\/rx")).should("have.text", `(${counter})`);
662
+ cy.get(cesc("#\\/rx")).click();
663
+ cy.get(cesc("#\\/x")).then((el) => {
664
+ let rect = el[0].getBoundingClientRect();
665
+ expect(rect.top).gt(-1).lt(5);
666
+ });
667
+
668
+ for (let i = 1; i <= m; i++) {
669
+ cy.window().then(async (win) => {
670
+ counter++;
671
+ cy.get(cesc("#\\/ms"))
672
+ .find(".mjx-mlabeledtr")
673
+ .eq(i - 1)
674
+ .invoke("text")
675
+ .then((text) => {
676
+ expect(text.trim()).equal(`${i}m=${i + 10}`);
677
+ });
678
+ cy.get(cesc("#\\/ms"))
679
+ .find(".mjx-label")
680
+ .eq(i - 1)
681
+ .invoke("text")
682
+ .then((text) => {
683
+ expect(text.trim()).equal(`(${counter})`);
684
+ });
685
+ if (i <= 6) {
686
+ cy.get(cesc(`#\\/pm${i}`)).should(
687
+ "have.text",
688
+ `m${i}: ${counter}, equation (${counter})`,
689
+ );
690
+ cy.get(cesc(`#\\/etm${i}`)).should("have.text", `${counter}`);
691
+ cy.get(cesc(`#\\/rm${i}`)).should("have.text", `(${counter})`);
692
+ cy.get(cesc(`#\\/rm${i}`)).click();
693
+ cy.get(cesc(`#\\/m${i}\\/eq`)).then((el) => {
694
+ let rect = el[0].getBoundingClientRect();
695
+ expect(rect.top).gt(-1).lt(5);
696
+ });
697
+ }
698
+ });
699
+ }
700
+ for (let i = m + 1; i <= 6; i++) {
701
+ cy.window().then(async (win) => {
702
+ cy.get(cesc(`#\\/pm${i}`)).should(
703
+ "have.text",
704
+ `m${i}: , equation ???`,
705
+ );
706
+ cy.get(cesc(`#\\/etm${i}`)).should("not.exist");
707
+ cy.get(cesc(`#\\/rm${i}`)).should("have.text", `???`);
708
+ cy.get(cesc(`#\\/rm${i}`)).click();
709
+ cy.window().then(async (win) => {
710
+ expect(win.scrollY).eq(0);
711
+ });
712
+ });
713
+ }
714
+
715
+ cy.window().then(async (win) => {
716
+ counter++;
717
+ cy.get(cesc("#\\/y"))
718
+ .find(".mjx-mrow")
719
+ .eq(0)
720
+ .invoke("text")
721
+ .then((text) => {
722
+ expect(text.trim()).equal(`y(${counter})`);
723
+ });
724
+ cy.get(cesc("#\\/py")).should(
725
+ "have.text",
726
+ `y: ${counter}, equation (${counter})`,
727
+ );
728
+ cy.get(cesc("#\\/ety")).should("have.text", `${counter}`);
729
+ cy.get(cesc("#\\/ry")).should("have.text", `(${counter})`);
730
+ cy.get(cesc("#\\/ry")).click();
731
+ cy.get(cesc("#\\/y")).then((el) => {
732
+ let rect = el[0].getBoundingClientRect();
733
+ expect(rect.top).gt(-1).lt(5);
734
+ });
735
+ });
736
+
737
+ for (let i = 1; i <= n; i++) {
738
+ cy.window().then(async (win) => {
739
+ counter++;
740
+ cy.get(cesc("#\\/ns"))
741
+ .find(".mjx-mlabeledtr")
742
+ .eq(i - 1)
743
+ .invoke("text")
744
+ .then((text) => {
745
+ expect(text.trim()).equal(`${i}n=${i + 10}`);
746
+ });
747
+ cy.get(cesc("#\\/ns"))
748
+ .find(".mjx-label")
749
+ .eq(i - 1)
750
+ .invoke("text")
751
+ .then((text) => {
752
+ expect(text.trim()).equal(`(${counter})`);
753
+ });
754
+ if (i <= 6) {
755
+ cy.get(cesc(`#\\/pn${i}`)).should(
756
+ "have.text",
757
+ `n${i}: ${counter}, equation (${counter})`,
758
+ );
759
+ cy.get(cesc(`#\\/etn${i}`)).should("have.text", `${counter}`);
760
+ cy.get(cesc(`#\\/rn${i}`)).should("have.text", `(${counter})`);
761
+ cy.get(cesc(`#\\/rn${i}`)).click();
762
+ cy.get(cesc(`#\\/n${i}\\/eq`)).then((el) => {
763
+ let rect = el[0].getBoundingClientRect();
764
+ expect(rect.top).gt(-1).lt(5);
765
+ });
766
+ }
767
+ });
768
+ }
769
+
770
+ for (let i = n + 1; i <= 6; i++) {
771
+ cy.window().then(async (win) => {
772
+ cy.get(cesc(`#\\/pn${i}`)).should(
773
+ "have.text",
774
+ `n${i}: , equation ???`,
775
+ );
776
+ cy.get(cesc(`#\\/etn${i}`)).should("not.exist");
777
+ cy.get(cesc(`#\\/rn${i}`)).should("have.text", `???`);
778
+ cy.get(cesc(`#\\/rn${i}`)).click();
779
+ cy.window().then(async (win) => {
780
+ expect(win.scrollY).eq(0);
781
+ });
782
+ });
783
+ }
784
+
785
+ cy.window().then(async (win) => {
786
+ counter++;
787
+ cy.get(cesc("#\\/z"))
788
+ .find(".mjx-mrow")
789
+ .eq(0)
790
+ .invoke("text")
791
+ .then((text) => {
792
+ expect(text.trim()).equal(`z(${counter})`);
793
+ });
794
+ cy.get(cesc("#\\/pz")).should(
795
+ "have.text",
796
+ `z: ${counter}, equation (${counter})`,
797
+ );
798
+ cy.get(cesc("#\\/etz")).should("have.text", `${counter}`);
799
+ cy.get(cesc("#\\/rz")).should("have.text", `(${counter})`);
800
+ cy.get(cesc("#\\/rz")).click();
801
+ cy.get(cesc("#\\/z")).then((el) => {
802
+ let rect = el[0].getBoundingClientRect();
803
+ expect(rect.top).gt(-1).lt(5);
804
+ });
805
+ });
806
+ }
807
+
808
+ checkEquationNumbering(2, 1);
809
+
810
+ cy.get(cesc("#\\/m") + " textarea").type(`{end}{backspace}4{enter}`, {
811
+ force: true,
812
+ });
813
+ cy.get(cesc("#\\/ma")).should("contain.text", "4");
814
+ checkEquationNumbering(4, 1);
815
+
816
+ cy.get(cesc("#\\/n") + " textarea").type(`{end}{backspace}2{enter}`, {
817
+ force: true,
818
+ });
819
+ cy.get(cesc("#\\/na")).should("contain.text", "2");
820
+ checkEquationNumbering(4, 2);
821
+
822
+ cy.get(cesc("#\\/m") + " textarea").type(`{end}{backspace}0{enter}`, {
823
+ force: true,
824
+ });
825
+ cy.get(cesc("#\\/ma")).should("contain.text", "0");
826
+ checkEquationNumbering(0, 2);
827
+
828
+ cy.get(cesc("#\\/n") + " textarea").type(`{end}{backspace}6{enter}`, {
829
+ force: true,
830
+ });
831
+ cy.get(cesc("#\\/na")).should("contain.text", "6");
832
+ checkEquationNumbering(0, 6);
833
+
834
+ cy.get(cesc("#\\/m") + " textarea").type(`{end}{backspace}3{enter}`, {
835
+ force: true,
836
+ });
837
+ cy.get(cesc("#\\/ma")).should("contain.text", "3");
838
+ checkEquationNumbering(3, 6);
839
+
840
+ cy.get(cesc("#\\/n") + " textarea").type(`{end}{backspace}1{enter}`, {
841
+ force: true,
842
+ });
843
+ cy.get(cesc("#\\/na")).should("contain.text", "1");
844
+ checkEquationNumbering(3, 1);
845
+ });
846
+
847
+ it("dynamic numbered aligned equations, numbering swapped", () => {
848
+ cy.window().then(async (win) => {
849
+ win.postMessage(
850
+ {
851
+ doenetML: `
852
+ <text>a</text>
853
+ <p>Number of equations 1: <mathinput prefill="2" name="m" /></p>
854
+ <p>Number of equations 2: <mathinput prefill="1" name="n" /></p>
855
+
856
+ <men name="x">x</men>
857
+ <mdn name="ms">
858
+ <map assignNames="m1 m2 m3 m4 m5 m6">
859
+ <template newNamespace><mrow name='eq' number="mod($i,2)=1">$i m &amp;= $v</mrow></template>
860
+ <sources indexAlias="i" alias="v"><sequence length="$m" from="11" /></sources>
861
+ </map>
862
+ </mdn>
863
+ <men name="y">y</men>
864
+ <mdn name="ns">
865
+ <map assignNames="n1 n2 n3 n4 n5 n6">
866
+ <template newNamespace><mrow name="eq" number="(-1)^$i = 1">$i n &= $v</mrow></template>
867
+ <sources indexAlias="i" alias="v"><sequence length="$n" from="11" /></sources>
868
+ </map>
869
+ </mdn>
870
+ <men name="z">z</men>
871
+
872
+ <p name="px">x: <copy prop="equationTag" assignNames="etx" target="x" />, equation <ref target="x" name="rx" /></p>
873
+ <p name="pm1">m1: <copy prop="equationTag" assignNames="etm1" target="m1/eq" />, equation <ref target="m1/eq" name="rm1" /></p>
874
+ <p name="pm2">m2: <copy prop="equationTag" assignNames="etm2" target="m2/eq" />, equation <ref target="m2/eq" name="rm2" /></p>
875
+ <p name="pm3">m3: <copy prop="equationTag" assignNames="etm3" target="m3/eq" />, equation <ref target="m3/eq" name="rm3" /></p>
876
+ <p name="pm4">m4: <copy prop="equationTag" assignNames="etm4" target="m4/eq" />, equation <ref target="m4/eq" name="rm4" /></p>
877
+ <p name="pm5">m5: <copy prop="equationTag" assignNames="etm5" target="m5/eq" />, equation <ref target="m5/eq" name="rm5" /></p>
878
+ <p name="pm6">m6: <copy prop="equationTag" assignNames="etm6" target="m6/eq" />, equation <ref target="m6/eq" name="rm6" /></p>
879
+ <p name="py">y: <copy prop="equationTag" assignNames="ety" target="y" />, equation <ref target="y" name="ry" /></p>
880
+ <p name="pn1">n1: <copy prop="equationTag" assignNames="etn1" target="n1/eq" />, equation <ref target="n1/eq" name="rn1" /></p>
881
+ <p name="pn2">n2: <copy prop="equationTag" assignNames="etn2" target="n2/eq" />, equation <ref target="n2/eq" name="rn2" /></p>
882
+ <p name="pn3">n3: <copy prop="equationTag" assignNames="etn3" target="n3/eq" />, equation <ref target="n3/eq" name="rn3" /></p>
883
+ <p name="pn4">n4: <copy prop="equationTag" assignNames="etn4" target="n4/eq" />, equation <ref target="n4/eq" name="rn4" /></p>
884
+ <p name="pn5">n5: <copy prop="equationTag" assignNames="etn5" target="n5/eq" />, equation <ref target="n5/eq" name="rn5" /></p>
885
+ <p name="pn6">n6: <copy prop="equationTag" assignNames="etn6" target="n6/eq" />, equation <ref target="n6/eq" name="rn6" /></p>
886
+ <p name="pz">z: <copy prop="equationTag" assignNames="etz" target="z" />, equation <ref target="z" name="rz" /></p>
887
+ <p>
888
+ <copy prop="value" target="m" assignNames="ma" />
889
+ <copy prop="value" target="n" assignNames="na" />
890
+ </p>
891
+ <lorem generateParagraphs="8" />
892
+ `,
893
+ },
894
+ "*",
895
+ );
896
+ });
897
+
898
+ cy.get(cesc("#\\/_text1")).should("have.text", "a"); // to wait until loaded
899
+
900
+ cy.log("Test value displayed in browser");
901
+
902
+ function checkEquationNumbering(m, n) {
903
+ let counter = 1;
904
+
905
+ cy.get(cesc("#\\/x"))
906
+ .find(".mjx-mrow")
907
+ .eq(0)
908
+ .invoke("text")
909
+ .then((text) => {
910
+ expect(text.trim()).equal(`x(${counter})`);
911
+ });
912
+ cy.get(cesc("#\\/px")).should(
913
+ "have.text",
914
+ `x: ${counter}, equation (${counter})`,
915
+ );
916
+ cy.get(cesc("#\\/etx")).should("have.text", `${counter}`);
917
+ cy.get(cesc("#\\/rx")).should("have.text", `(${counter})`);
918
+ cy.get(cesc("#\\/rx")).click();
919
+ cy.url().should("match", RegExp(cesc(`#\\/x`) + "$"));
920
+ cy.get(cesc("#\\/x")).then((el) => {
921
+ let rect = el[0].getBoundingClientRect();
922
+ expect(rect.top).gt(-1).lt(5);
923
+ });
924
+
925
+ let labeledMs = 0;
926
+ let unlabeledMs = 0;
927
+ for (let i = 1; i <= m; i++) {
928
+ cy.window().then(async (win) => {
929
+ if (i % 2 === 1) {
930
+ labeledMs++;
931
+ counter++;
932
+ cy.get(cesc("#\\/ms"))
933
+ .find(".mjx-mlabeledtr")
934
+ .eq(labeledMs - 1)
935
+ .invoke("text")
936
+ .then((text) => {
937
+ expect(text.trim()).equal(`${i}m=${i + 10}`);
938
+ });
939
+ cy.get(cesc("#\\/ms"))
940
+ .find(".mjx-label")
941
+ .eq(i - 1)
942
+ .invoke("text")
943
+ .then((text) => {
944
+ expect(text.trim()).equal(`(${counter})`);
945
+ });
946
+ if (i <= 6) {
947
+ cy.get(cesc(`#\\/pm${i}`)).should(
948
+ "have.text",
949
+ `m${i}: ${counter}, equation (${counter})`,
950
+ );
951
+ cy.get(cesc(`#\\/etm${i}`)).should("have.text", `${counter}`);
952
+ cy.get(cesc(`#\\/rm${i}`)).should("have.text", `(${counter})`);
953
+ cy.get(cesc(`#\\/rm${i}`)).click();
954
+ cy.url().should("match", RegExp(cesc(`#\\/m${i}\\/eq`) + "$"));
955
+ cy.get(cesc(`#\\/m${i}\\/eq`)).then((el) => {
956
+ let rect = el[0].getBoundingClientRect();
957
+ expect(rect.top).gt(-1).lt(5);
958
+ });
959
+ }
960
+ } else {
961
+ unlabeledMs++;
962
+ cy.get(cesc("#\\/ms"))
963
+ .find(".mjx-mtr")
964
+ .eq(unlabeledMs - 1)
965
+ .invoke("text")
966
+ .then((text) => {
967
+ expect(text.trim()).equal(`${i}m=${i + 10}`);
968
+ });
969
+ if (i <= 6) {
970
+ cy.get(cesc(`#\\/pm${i}`)).should(
971
+ "have.text",
972
+ `m${i}: , equation ???`,
973
+ );
974
+ cy.get(cesc(`#\\/etm${i}`)).should("have.text", "");
975
+ cy.get(cesc(`#\\/rm${i}`)).should("have.text", `???`);
976
+ cy.get(cesc(`#\\/rm${i}`)).click();
977
+ cy.url().should("match", RegExp(cesc(`#\\/m${i}\\/eq`) + "$"));
978
+ }
979
+ }
980
+ });
981
+ }
982
+ for (let i = m + 1; i <= 6; i++) {
983
+ cy.window().then(async (win) => {
984
+ cy.get(cesc(`#\\/pm${i}`)).should(
985
+ "have.text",
986
+ `m${i}: , equation ???`,
987
+ );
988
+ cy.get(cesc(`#\\/etm${i}`)).should("not.exist");
989
+ cy.get(cesc(`#\\/rm${i}`)).should("have.text", `???`);
990
+ cy.get(cesc(`#\\/rm${i}`)).click();
991
+ cy.url().should("match", RegExp(`#$`));
992
+ cy.window().then(async (win) => {
993
+ expect(win.scrollY).eq(0);
994
+ });
995
+ });
996
+ }
997
+
998
+ cy.window().then(async (win) => {
999
+ counter++;
1000
+ cy.get(cesc("#\\/y"))
1001
+ .find(".mjx-mrow")
1002
+ .eq(0)
1003
+ .invoke("text")
1004
+ .then((text) => {
1005
+ expect(text.trim()).equal(`y(${counter})`);
1006
+ });
1007
+ cy.get(cesc("#\\/py")).should(
1008
+ "have.text",
1009
+ `y: ${counter}, equation (${counter})`,
1010
+ );
1011
+ cy.get(cesc("#\\/ety")).should("have.text", `${counter}`);
1012
+ cy.get(cesc("#\\/ry")).should("have.text", `(${counter})`);
1013
+ cy.get(cesc("#\\/ry")).click();
1014
+ cy.url().should("match", RegExp(cesc(`#\\/y`) + "$"));
1015
+ cy.get(cesc("#\\/y")).then((el) => {
1016
+ let rect = el[0].getBoundingClientRect();
1017
+ expect(rect.top).gt(-1).lt(5);
1018
+ });
1019
+ });
1020
+
1021
+ let labeledNs = 0;
1022
+ let unlabeledNs = 0;
1023
+ for (let i = 1; i <= n; i++) {
1024
+ cy.window().then(async (win) => {
1025
+ if (i % 2 === 0) {
1026
+ labeledNs++;
1027
+ counter++;
1028
+ cy.get(cesc("#\\/ns"))
1029
+ .find(".mjx-mlabeledtr")
1030
+ .eq(labeledNs - 1)
1031
+ .invoke("text")
1032
+ .then((text) => {
1033
+ expect(text.trim()).equal(`${i}n=${i + 10}`);
1034
+ });
1035
+ cy.get(cesc("#\\/ns"))
1036
+ .find(".mjx-label")
1037
+ .eq(i - 1)
1038
+ .invoke("text")
1039
+ .then((text) => {
1040
+ expect(text.trim()).equal(`(${counter})`);
1041
+ });
1042
+ if (i <= 6) {
1043
+ cy.get(cesc(`#\\/pn${i}`)).should(
1044
+ "have.text",
1045
+ `n${i}: ${counter}, equation (${counter})`,
1046
+ );
1047
+ cy.get(cesc(`#\\/etn${i}`)).should("have.text", `${counter}`);
1048
+ cy.get(cesc(`#\\/rn${i}`)).should("have.text", `(${counter})`);
1049
+ cy.get(cesc(`#\\/rn${i}`)).click();
1050
+ cy.url().should("match", RegExp(cesc(`#\\/n${i}\\/eq`) + "$"));
1051
+ cy.get(cesc(`#\\/n${i}\\/eq`)).then((el) => {
1052
+ let rect = el[0].getBoundingClientRect();
1053
+ expect(rect.top).gt(-1).lt(5);
1054
+ });
1055
+ }
1056
+ } else {
1057
+ unlabeledNs++;
1058
+ cy.get(cesc("#\\/ns"))
1059
+ .find(".mjx-mtr")
1060
+ .eq(unlabeledNs - 1)
1061
+ .invoke("text")
1062
+ .then((text) => {
1063
+ expect(text.trim()).equal(`${i}n=${i + 10}`);
1064
+ });
1065
+ if (i <= 6) {
1066
+ cy.get(cesc(`#\\/pn${i}`)).should(
1067
+ "have.text",
1068
+ `n${i}: , equation ???`,
1069
+ );
1070
+ cy.get(cesc(`#\\/etn${i}`)).should("have.text", ``);
1071
+ cy.get(cesc(`#\\/rn${i}`)).should("have.text", `???`);
1072
+ cy.get(cesc(`#\\/rn${i}`)).click();
1073
+ cy.url().should("match", RegExp(cesc(`#\\/n${i}\\/eq`) + "$"));
1074
+ }
1075
+ }
1076
+ });
1077
+ }
1078
+
1079
+ for (let i = n + 1; i <= 6; i++) {
1080
+ cy.window().then(async (win) => {
1081
+ cy.get(cesc(`#\\/pn${i}`)).should(
1082
+ "have.text",
1083
+ `n${i}: , equation ???`,
1084
+ );
1085
+ cy.get(cesc(`#\\/etn${i}`)).should("not.exist");
1086
+ cy.get(cesc(`#\\/rn${i}`)).should("have.text", `???`);
1087
+ cy.get(cesc(`#\\/rn${i}`)).click();
1088
+ cy.url().should("match", RegExp(`#$`));
1089
+ cy.window().then(async (win) => {
1090
+ expect(win.scrollY).eq(0);
1091
+ });
1092
+ });
1093
+ }
1094
+
1095
+ cy.window().then(async (win) => {
1096
+ counter++;
1097
+ cy.get(cesc("#\\/z"))
1098
+ .find(".mjx-mrow")
1099
+ .eq(0)
1100
+ .invoke("text")
1101
+ .then((text) => {
1102
+ expect(text.trim()).equal(`z(${counter})`);
1103
+ });
1104
+ cy.get(cesc("#\\/pz")).should(
1105
+ "have.text",
1106
+ `z: ${counter}, equation (${counter})`,
1107
+ );
1108
+ cy.get(cesc("#\\/etz")).should("have.text", `${counter}`);
1109
+ cy.get(cesc("#\\/rz")).should("have.text", `(${counter})`);
1110
+ cy.get(cesc("#\\/rz")).click();
1111
+ cy.url().should("match", RegExp(cesc(`#\\/z`) + "$"));
1112
+ cy.get(cesc("#\\/z")).then((el) => {
1113
+ let rect = el[0].getBoundingClientRect();
1114
+ expect(rect.top).gt(-1).lt(5);
1115
+ });
1116
+ });
1117
+ }
1118
+
1119
+ checkEquationNumbering(2, 1);
1120
+
1121
+ cy.get(cesc("#\\/m") + " textarea").type(`{end}{backspace}4{enter}`, {
1122
+ force: true,
1123
+ });
1124
+ cy.get(cesc("#\\/ma")).should("contain.text", "4");
1125
+ checkEquationNumbering(4, 1);
1126
+
1127
+ cy.get(cesc("#\\/n") + " textarea").type(`{end}{backspace}2{enter}`, {
1128
+ force: true,
1129
+ });
1130
+ cy.get(cesc("#\\/na")).should("contain.text", "2");
1131
+ checkEquationNumbering(4, 2);
1132
+
1133
+ cy.get(cesc("#\\/m") + " textarea").type(`{end}{backspace}0{enter}`, {
1134
+ force: true,
1135
+ });
1136
+ cy.get(cesc("#\\/ma")).should("contain.text", "0");
1137
+ checkEquationNumbering(0, 2);
1138
+
1139
+ cy.get(cesc("#\\/n") + " textarea").type(`{end}{backspace}6{enter}`, {
1140
+ force: true,
1141
+ });
1142
+ cy.get(cesc("#\\/na")).should("contain.text", "6");
1143
+ checkEquationNumbering(0, 6);
1144
+
1145
+ cy.get(cesc("#\\/m") + " textarea").type(`{end}{backspace}3{enter}`, {
1146
+ force: true,
1147
+ });
1148
+ cy.get(cesc("#\\/ma")).should("contain.text", "3");
1149
+ checkEquationNumbering(3, 6);
1150
+
1151
+ cy.get(cesc("#\\/n") + " textarea").type(`{end}{backspace}1{enter}`, {
1152
+ force: true,
1153
+ });
1154
+ cy.get(cesc("#\\/na")).should("contain.text", "1");
1155
+ checkEquationNumbering(3, 1);
1156
+ });
1157
+
1158
+ it("add commas to large integers", () => {
1159
+ cy.window().then(async (win) => {
1160
+ win.postMessage(
1161
+ {
1162
+ doenetML: `
1163
+ <text>a</text>
1164
+ <p><intcomma>25236501.35</intcomma></p>
1165
+ <p><intcomma><math>25236501.35</math></intcomma></p>
1166
+ <p><m><intcomma>25236501.35</intcomma></m></p>
1167
+ <p><m><intcomma><math>25236501.35</math></intcomma></m></p>
1168
+ `,
1169
+ },
1170
+ "*",
1171
+ );
1172
+ });
1173
+
1174
+ cy.get(cesc("#\\/_text1")).should("have.text", "a"); // to wait until loaded
1175
+
1176
+ cy.get(cesc("#\\/_p1")).should("have.text", "25,236,501.35");
1177
+ cy.get(cesc("#\\/_p2")).should("have.text", "25,236,501.35");
1178
+ cy.get(cesc("#\\/_m1"))
1179
+ .find(".mjx-mrow")
1180
+ .eq(0)
1181
+ .invoke("text")
1182
+ .then((text) => {
1183
+ expect(text.trim()).equal("25,236,501.35");
1184
+ });
1185
+ cy.get(cesc("#\\/_m2"))
1186
+ .find(".mjx-mrow")
1187
+ .eq(0)
1188
+ .invoke("text")
1189
+ .then((text) => {
1190
+ expect(text.trim()).equal("25,236,501.35");
1191
+ });
1192
+ });
1193
+
1194
+ it("include blank string children", () => {
1195
+ cy.window().then(async (win) => {
1196
+ win.postMessage(
1197
+ {
1198
+ doenetML: `
1199
+ <text>a</text>
1200
+ <math name="b">beta</math>
1201
+ <math name="s">s</math>
1202
+ <m>$b $s</m>
1203
+ <me>$b $s</me>
1204
+ <md>
1205
+ <mrow>$b $s</mrow>
1206
+ </md>
1207
+ `,
1208
+ },
1209
+ "*",
1210
+ );
1211
+ });
1212
+
1213
+ cy.get(cesc("#\\/_text1")).should("have.text", "a"); // to wait until loaded
1214
+
1215
+ cy.get(cesc("#\\/_m1"))
1216
+ .find(".mjx-mrow")
1217
+ .eq(0)
1218
+ .invoke("text")
1219
+ .then((text) => {
1220
+ expect(text.trim()).equal("βs");
1221
+ });
1222
+ cy.get(cesc("#\\/_me1"))
1223
+ .find(".mjx-mrow")
1224
+ .eq(0)
1225
+ .invoke("text")
1226
+ .then((text) => {
1227
+ expect(text.trim()).equal("βs");
1228
+ });
1229
+ cy.get(cesc("#\\/_md1"))
1230
+ .find(".mjx-mrow")
1231
+ .eq(0)
1232
+ .invoke("text")
1233
+ .then((text) => {
1234
+ expect(text.trim()).equal("βs");
1235
+ });
1236
+ });
1237
+
1238
+ it("aslist inside displayed math", () => {
1239
+ cy.window().then(async (win) => {
1240
+ win.postMessage(
1241
+ {
1242
+ doenetML: `
1243
+ <text>a</text>
1244
+
1245
+ <m>s=<aslist name="al"><sequence from="1" to="3" /></aslist></m>
1246
+ <m>s=$al</m>
1247
+ <me>s = $al</me>
1248
+ <md>
1249
+ <mrow>s \\amp= $al</mrow>
1250
+ </md>
1251
+ `,
1252
+ },
1253
+ "*",
1254
+ );
1255
+ });
1256
+
1257
+ cy.get(cesc("#\\/_text1")).should("have.text", "a"); // to wait until loaded
1258
+
1259
+ cy.get(cesc("#\\/_m1"))
1260
+ .find(".mjx-mrow")
1261
+ .eq(0)
1262
+ .invoke("text")
1263
+ .then((text) => {
1264
+ expect(text.trim()).equal("s=1,2,3");
1265
+ });
1266
+ cy.get(cesc("#\\/_m2"))
1267
+ .find(".mjx-mrow")
1268
+ .eq(0)
1269
+ .invoke("text")
1270
+ .then((text) => {
1271
+ expect(text.trim()).equal("s=1,2,3");
1272
+ });
1273
+ cy.get(cesc("#\\/_me1"))
1274
+ .find(".mjx-mrow")
1275
+ .eq(0)
1276
+ .invoke("text")
1277
+ .then((text) => {
1278
+ expect(text.trim()).equal("s=1,2,3");
1279
+ });
1280
+ cy.get(cesc("#\\/_md1"))
1281
+ .find(".mjx-mrow")
1282
+ .eq(0)
1283
+ .invoke("text")
1284
+ .then((text) => {
1285
+ expect(text.trim()).equal("s=1,2,3");
1286
+ });
1287
+ });
1288
+
1289
+ it("change essential latex", () => {
1290
+ cy.window().then(async (win) => {
1291
+ win.postMessage(
1292
+ {
1293
+ doenetML: `
1294
+ <text>a</text>
1295
+
1296
+ <m name="m" />
1297
+ <p><updateValue name="uv" target="m.latex" type="text" newValue="\\frac{1}{2}" ><label>Change latex</label></updateValue></p>
1298
+ `,
1299
+ },
1300
+ "*",
1301
+ );
1302
+ });
1303
+
1304
+ cy.get(cesc("#\\/_text1")).should("have.text", "a"); // to wait until loaded
1305
+
1306
+ cy.get(cesc("#\\/m"))
1307
+ .find(".mjx-mrow")
1308
+ .eq(0)
1309
+ .invoke("text")
1310
+ .then((text) => {
1311
+ expect(text.trim()).equal("");
1312
+ });
1313
+
1314
+ cy.window().then(async (win) => {
1315
+ let stateVariables = await win.returnAllStateVariables1();
1316
+ expect(stateVariables["/m"].stateValues.latex).eq("");
1317
+ });
1318
+ cy.get(cesc("#\\/uv")).click();
1319
+
1320
+ cy.get(cesc("#\\/m") + " .mjx-mrow").should("contain.text", "12");
1321
+
1322
+ cy.window().then(async (win) => {
1323
+ let stateVariables = await win.returnAllStateVariables1();
1324
+ expect(stateVariables["/m"].stateValues.latex).eq("\\frac{1}{2}");
1325
+ });
1326
+ });
1327
+
1328
+ it("subscripts and superscripts numbers to unicode text", () => {
1329
+ cy.window().then(async (win) => {
1330
+ win.postMessage(
1331
+ {
1332
+ doenetML: `
1333
+ <p><text>a</text></p>
1334
+ <p><m name="m1">2x_1y_{23}+z_{456}-a_{7+8-90}</m></p>
1335
+ <p><m name="m2">2x^1y^{23}+z^{456}-a^{7+8-90}</m></p>
1336
+ <p name="m1t">$m1.text</p>
1337
+ <p name="m2t">$m2.text</p>
1338
+
1339
+ <p><md name="md">
1340
+ <mrow>2x_1y_{23}+z_{456}-a_{7+8-90}</mrow>
1341
+ <mrow>2x^1y^{23}+z^{456}-a^{7+8-90}</mrow>
1342
+ </md>
1343
+ </p>
1344
+ <p name="mdt">$md.text</p>
1345
+
1346
+
1347
+ `,
1348
+ },
1349
+ "*",
1350
+ );
1351
+ });
1352
+
1353
+ cy.get(cesc("#\\/_text1")).should("have.text", "a"); // to wait until loaded
1354
+ cy.get(cesc("#\\/m1t")).should("have.text", "2 x₁ y₂₃ + z₄₅₆ - a₇₊₈₋₉₀");
1355
+ cy.get(cesc("#\\/m2t")).should("have.text", "2 x¹ y²³ + z⁴⁵⁶ - a⁷⁺⁸⁻⁹⁰");
1356
+ cy.get(cesc("#\\/mdt")).should(
1357
+ "have.text",
1358
+ "2 x₁ y₂₃ + z₄₅₆ - a₇₊₈₋₉₀\\\\\n2 x¹ y²³ + z⁴⁵⁶ - a⁷⁺⁸⁻⁹⁰",
1359
+ );
1360
+ });
1361
+
1362
+ it("m in graph", () => {
1363
+ cy.window().then(async (win) => {
1364
+ win.postMessage(
1365
+ {
1366
+ doenetML: `
1367
+ <text>a</text>
1368
+ <graph >
1369
+ <m anchor="$anchorCoords1" name="math1" positionFromAnchor="$positionFromAnchor1" draggable="$draggable1">\\frac{\\partial f}{\\partial x}</m>
1370
+ <m name="math2">\\int_a^b f(x) dx</m>
1371
+ </graph>
1372
+
1373
+ <p name="pAnchor1">Anchor 1 coordinates: $math1.anchor</p>
1374
+ <p name="pAnchor2">Anchor 2 coordinates: $math2.anchor</p>
1375
+ <p name="pChangeAnchor1">Change anchor 1 coordinates: <mathinput name="anchorCoords1" prefill="(1,3)" /></p>
1376
+ <p name="pChangeAnchor2">Change anchor 2 coordinates: <mathinput name="anchorCoords2" bindValueTo="$math2.anchor" /></p>
1377
+ <p name="pPositionFromAnchor1">Position from anchor 1: $math1.positionFromAnchor</p>
1378
+ <p name="pPositionFromAnchor2">Position from anchor 2: $math2.positionFromAnchor</p>
1379
+ <p>Change position from anchor 1
1380
+ <choiceinput inline preselectChoice="1" name="positionFromAnchor1">
1381
+ <choice>upperRight</choice>
1382
+ <choice>upperLeft</choice>
1383
+ <choice>lowerRight</choice>
1384
+ <choice>lowerLeft</choice>
1385
+ <choice>left</choice>
1386
+ <choice>right</choice>
1387
+ <choice>top</choice>
1388
+ <choice>bottom</choice>
1389
+ <choice>center</choice>
1390
+ </choiceinput>
1391
+ </p>
1392
+ <p>Change position from anchor 2
1393
+ <choiceinput inline name="positionFromAnchor2" bindValueTo="$math2.positionFromAnchor">
1394
+ <choice>upperRight</choice>
1395
+ <choice>upperLeft</choice>
1396
+ <choice>lowerRight</choice>
1397
+ <choice>lowerLeft</choice>
1398
+ <choice>left</choice>
1399
+ <choice>right</choice>
1400
+ <choice>top</choice>
1401
+ <choice>bottom</choice>
1402
+ <choice>center</choice>
1403
+ </choiceinput>
1404
+ </p>
1405
+ <p name="pDraggable1">Draggable 1: $draggable1</p>
1406
+ <p name="pDraggable2">Draggable 2: $draggable2</p>
1407
+ <p>Change draggable 1 <booleanInput name="draggable1" prefill="true" /></p>
1408
+ <p>Change draggable 2 <booleanInput name="draggable2" bindValueTo="$math2.draggable" /></p>
1409
+ <p name="pContent1">Content 1: $math1</p>
1410
+ <p name="pContent2">Content 2: $math2</p>
1411
+ <p><booleaninput name="bi" /> <boolean name="b" copySource="bi" /></p>
1412
+
1413
+ `,
1414
+ },
1415
+ "*",
1416
+ );
1417
+ });
1418
+
1419
+ cy.get(cesc("#\\/_text1")).should("have.text", "a"); // to wait until loaded
1420
+
1421
+ cy.get(cesc("#\\/pAnchor1") + " .mjx-mrow")
1422
+ .eq(0)
1423
+ .should("have.text", "(1,3)");
1424
+ cy.get(cesc("#\\/pAnchor2") + " .mjx-mrow")
1425
+ .eq(0)
1426
+ .should("have.text", "(0,0)");
1427
+
1428
+ cy.get(cesc("#\\/pPositionFromAnchor1")).should(
1429
+ "have.text",
1430
+ "Position from anchor 1: upperright",
1431
+ );
1432
+ cy.get(cesc("#\\/pPositionFromAnchor2")).should(
1433
+ "have.text",
1434
+ "Position from anchor 2: center",
1435
+ );
1436
+ cy.get(cesc("#\\/positionFromAnchor1")).should("have.value", "1");
1437
+ cy.get(cesc("#\\/positionFromAnchor2")).should("have.value", "9");
1438
+ cy.get(cesc("#\\/pDraggable1")).should("have.text", "Draggable 1: true");
1439
+ cy.get(cesc("#\\/pDraggable2")).should("have.text", "Draggable 2: true");
1440
+ cy.get(cesc("#\\/pContent1") + " .mjx-mrow")
1441
+ .eq(0)
1442
+ .should("have.text", "∂f∂x");
1443
+ cy.get(cesc("#\\/pContent2") + " .mjx-mrow")
1444
+ .eq(0)
1445
+ .should("have.text", "∫baf(x)dx");
1446
+
1447
+ cy.log("move maths by dragging");
1448
+
1449
+ cy.window().then(async (win) => {
1450
+ win.callAction1({
1451
+ actionName: "moveMath",
1452
+ componentName: "/math1",
1453
+ args: { x: -2, y: 3 },
1454
+ });
1455
+ win.callAction1({
1456
+ actionName: "moveMath",
1457
+ componentName: "/math2",
1458
+ args: { x: 4, y: -5 },
1459
+ });
1460
+ });
1461
+
1462
+ cy.get(cesc("#\\/pAnchor2") + " .mjx-mrow").should(
1463
+ "contain.text",
1464
+ "(4,−5)",
1465
+ );
1466
+
1467
+ cy.get(cesc("#\\/pAnchor1") + " .mjx-mrow")
1468
+ .eq(0)
1469
+ .should("have.text", "(−2,3)");
1470
+ cy.get(cesc("#\\/pAnchor2") + " .mjx-mrow")
1471
+ .eq(0)
1472
+ .should("have.text", "(4,−5)");
1473
+
1474
+ cy.log("move maths by entering coordinates");
1475
+
1476
+ cy.get(cesc("#\\/anchorCoords1") + " textarea").type(
1477
+ "{home}{shift+end}{backspace}(6,7){enter}",
1478
+ { force: true },
1479
+ );
1480
+ cy.get(cesc("#\\/anchorCoords2") + " textarea").type(
1481
+ "{home}{shift+end}{backspace}(8,9){enter}",
1482
+ { force: true },
1483
+ );
1484
+
1485
+ cy.get(cesc("#\\/pAnchor2") + " .mjx-mrow").should("contain.text", "(8,9)");
1486
+
1487
+ cy.get(cesc("#\\/pAnchor1") + " .mjx-mrow")
1488
+ .eq(0)
1489
+ .should("have.text", "(6,7)");
1490
+ cy.get(cesc("#\\/pAnchor2") + " .mjx-mrow")
1491
+ .eq(0)
1492
+ .should("have.text", "(8,9)");
1493
+
1494
+ cy.log("change position from anchor");
1495
+ cy.get(cesc("#\\/positionFromAnchor1")).select("lowerLeft");
1496
+ cy.get(cesc("#\\/positionFromAnchor2")).select("lowerRight");
1497
+
1498
+ cy.get(cesc("#\\/pPositionFromAnchor1")).should(
1499
+ "have.text",
1500
+ "Position from anchor 1: lowerleft",
1501
+ );
1502
+ cy.get(cesc("#\\/pPositionFromAnchor2")).should(
1503
+ "have.text",
1504
+ "Position from anchor 2: lowerright",
1505
+ );
1506
+
1507
+ cy.log("make not draggable");
1508
+
1509
+ cy.get(cesc("#\\/draggable1")).click();
1510
+ cy.get(cesc("#\\/draggable2")).click();
1511
+ cy.get(cesc("#\\/pDraggable1")).should("have.text", "Draggable 1: false");
1512
+ cy.get(cesc("#\\/pDraggable2")).should("have.text", "Draggable 2: false");
1513
+
1514
+ cy.log("cannot move maths by dragging");
1515
+ cy.window().then(async (win) => {
1516
+ win.callAction1({
1517
+ actionName: "moveMath",
1518
+ componentName: "/math1",
1519
+ args: { x: -10, y: -9 },
1520
+ });
1521
+ win.callAction1({
1522
+ actionName: "moveMath",
1523
+ componentName: "/math2",
1524
+ args: { x: -8, y: -7 },
1525
+ });
1526
+ });
1527
+
1528
+ // since nothing will change, wait for boolean input to change to know core has responded
1529
+ cy.get(cesc("#\\/bi")).click();
1530
+ cy.get(cesc("#\\/b")).should("have.text", "true");
1531
+
1532
+ cy.get(cesc("#\\/pAnchor1") + " .mjx-mrow")
1533
+ .eq(0)
1534
+ .should("have.text", "(6,7)");
1535
+ cy.get(cesc("#\\/pAnchor2") + " .mjx-mrow")
1536
+ .eq(0)
1537
+ .should("have.text", "(8,9)");
1538
+ });
1539
+
1540
+ it("m in graph, handle bad anchor coordinates", () => {
1541
+ cy.window().then(async (win) => {
1542
+ win.postMessage(
1543
+ {
1544
+ doenetML: `
1545
+ <text>a</text>
1546
+
1547
+ <graph >
1548
+ <m anchor="$anchorCoords1" name="m1">x^2</m>
1549
+ </graph>
1550
+
1551
+
1552
+ <p name="pAnchor1">Anchor 1 coordinates: $m1.anchor</p>
1553
+ <p name="pChangeAnchor1">Change anchor 1 coordinates: <mathinput name="anchorCoords1" prefill="x" /></p>
1554
+
1555
+
1556
+ `,
1557
+ },
1558
+ "*",
1559
+ );
1560
+ });
1561
+
1562
+ cy.get(cesc("#\\/_text1")).should("have.text", "a"); //wait for page to load
1563
+
1564
+ cy.get(cesc("#\\/pAnchor1") + " .mjx-mrow")
1565
+ .eq(0)
1566
+ .should("have.text", "x");
1567
+
1568
+ cy.log("give good anchor coords");
1569
+
1570
+ cy.get(cesc("#\\/anchorCoords1") + " textarea").type(
1571
+ "{home}{shift+end}{backspace}(6,7){enter}",
1572
+ { force: true },
1573
+ );
1574
+
1575
+ cy.get(cesc("#\\/pAnchor1") + " .mjx-mrow").should("contain.text", "(6,7)");
1576
+
1577
+ cy.get(cesc("#\\/pAnchor1") + " .mjx-mrow")
1578
+ .eq(0)
1579
+ .should("have.text", "(6,7)");
1580
+
1581
+ cy.log("give bad anchor coords again");
1582
+
1583
+ cy.get(cesc("#\\/anchorCoords1") + " textarea").type(
1584
+ "{home}{shift+end}{backspace}q{enter}",
1585
+ { force: true },
1586
+ );
1587
+
1588
+ cy.get(cesc("#\\/pAnchor1") + " .mjx-mrow").should("contain.text", "q");
1589
+
1590
+ cy.get(cesc("#\\/pAnchor1") + " .mjx-mrow")
1591
+ .eq(0)
1592
+ .should("have.text", "q");
1593
+ });
1594
+
1595
+ it("me in graph", () => {
1596
+ cy.window().then(async (win) => {
1597
+ win.postMessage(
1598
+ {
1599
+ doenetML: `
1600
+ <text>a</text>
1601
+ <graph >
1602
+ <me anchor="$anchorCoords1" name="math1" positionFromAnchor="$positionFromAnchor1" draggable="$draggable1">\\frac{\\partial f}{\\partial x}</me>
1603
+ <me name="math2">\\int_a^b f(x) dx</me>
1604
+ </graph>
1605
+
1606
+ <p name="pAnchor1">Anchor 1 coordinates: $math1.anchor</p>
1607
+ <p name="pAnchor2">Anchor 2 coordinates: $math2.anchor</p>
1608
+ <p name="pChangeAnchor1">Change anchor 1 coordinates: <mathinput name="anchorCoords1" prefill="(1,3)" /></p>
1609
+ <p name="pChangeAnchor2">Change anchor 2 coordinates: <mathinput name="anchorCoords2" bindValueTo="$math2.anchor" /></p>
1610
+ <p name="pPositionFromAnchor1">Position from anchor 1: $math1.positionFromAnchor</p>
1611
+ <p name="pPositionFromAnchor2">Position from anchor 2: $math2.positionFromAnchor</p>
1612
+ <p>Change position from anchor 1
1613
+ <choiceinput inline preselectChoice="1" name="positionFromAnchor1">
1614
+ <choice>upperRight</choice>
1615
+ <choice>upperLeft</choice>
1616
+ <choice>lowerRight</choice>
1617
+ <choice>lowerLeft</choice>
1618
+ <choice>left</choice>
1619
+ <choice>right</choice>
1620
+ <choice>top</choice>
1621
+ <choice>bottom</choice>
1622
+ <choice>center</choice>
1623
+ </choiceinput>
1624
+ </p>
1625
+ <p>Change position from anchor 2
1626
+ <choiceinput inline name="positionFromAnchor2" bindValueTo="$math2.positionFromAnchor">
1627
+ <choice>upperRight</choice>
1628
+ <choice>upperLeft</choice>
1629
+ <choice>lowerRight</choice>
1630
+ <choice>lowerLeft</choice>
1631
+ <choice>left</choice>
1632
+ <choice>right</choice>
1633
+ <choice>top</choice>
1634
+ <choice>bottom</choice>
1635
+ <choice>center</choice>
1636
+ </choiceinput>
1637
+ </p>
1638
+ <p name="pDraggable1">Draggable 1: $draggable1</p>
1639
+ <p name="pDraggable2">Draggable 2: $draggable2</p>
1640
+ <p>Change draggable 1 <booleanInput name="draggable1" prefill="true" /></p>
1641
+ <p>Change draggable 2 <booleanInput name="draggable2" bindValueTo="$math2.draggable" /></p>
1642
+ <p name="pContent1">Content 1: $math1</p>
1643
+ <p name="pContent2">Content 2: $math2</p>
1644
+ <p><booleaninput name="bi" /> <boolean name="b" copySource="bi" /></p>
1645
+
1646
+ `,
1647
+ },
1648
+ "*",
1649
+ );
1650
+ });
1651
+
1652
+ cy.get(cesc("#\\/_text1")).should("have.text", "a"); // to wait until loaded
1653
+
1654
+ cy.get(cesc("#\\/pAnchor1") + " .mjx-mrow")
1655
+ .eq(0)
1656
+ .should("have.text", "(1,3)");
1657
+ cy.get(cesc("#\\/pAnchor2") + " .mjx-mrow")
1658
+ .eq(0)
1659
+ .should("have.text", "(0,0)");
1660
+
1661
+ cy.get(cesc("#\\/pPositionFromAnchor1")).should(
1662
+ "have.text",
1663
+ "Position from anchor 1: upperright",
1664
+ );
1665
+ cy.get(cesc("#\\/pPositionFromAnchor2")).should(
1666
+ "have.text",
1667
+ "Position from anchor 2: center",
1668
+ );
1669
+ cy.get(cesc("#\\/positionFromAnchor1")).should("have.value", "1");
1670
+ cy.get(cesc("#\\/positionFromAnchor2")).should("have.value", "9");
1671
+ cy.get(cesc("#\\/pDraggable1")).should("have.text", "Draggable 1: true");
1672
+ cy.get(cesc("#\\/pDraggable2")).should("have.text", "Draggable 2: true");
1673
+ cy.get(cesc("#\\/pContent1") + " .mjx-mrow")
1674
+ .eq(0)
1675
+ .should("have.text", "∂f∂x");
1676
+ cy.get(cesc("#\\/pContent2") + " .mjx-mrow")
1677
+ .eq(0)
1678
+ .should("have.text", "∫baf(x)dx");
1679
+
1680
+ cy.log("move maths by dragging");
1681
+
1682
+ cy.window().then(async (win) => {
1683
+ win.callAction1({
1684
+ actionName: "moveMath",
1685
+ componentName: "/math1",
1686
+ args: { x: -2, y: 3 },
1687
+ });
1688
+ win.callAction1({
1689
+ actionName: "moveMath",
1690
+ componentName: "/math2",
1691
+ args: { x: 4, y: -5 },
1692
+ });
1693
+ });
1694
+
1695
+ cy.get(cesc("#\\/pAnchor2") + " .mjx-mrow").should(
1696
+ "contain.text",
1697
+ "(4,−5)",
1698
+ );
1699
+
1700
+ cy.get(cesc("#\\/pAnchor1") + " .mjx-mrow")
1701
+ .eq(0)
1702
+ .should("have.text", "(−2,3)");
1703
+ cy.get(cesc("#\\/pAnchor2") + " .mjx-mrow")
1704
+ .eq(0)
1705
+ .should("have.text", "(4,−5)");
1706
+
1707
+ cy.log("move maths by entering coordinates");
1708
+
1709
+ cy.get(cesc("#\\/anchorCoords1") + " textarea").type(
1710
+ "{home}{shift+end}{backspace}(6,7){enter}",
1711
+ { force: true },
1712
+ );
1713
+ cy.get(cesc("#\\/anchorCoords2") + " textarea").type(
1714
+ "{home}{shift+end}{backspace}(8,9){enter}",
1715
+ { force: true },
1716
+ );
1717
+
1718
+ cy.get(cesc("#\\/pAnchor2") + " .mjx-mrow").should("contain.text", "(8,9)");
1719
+
1720
+ cy.get(cesc("#\\/pAnchor1") + " .mjx-mrow")
1721
+ .eq(0)
1722
+ .should("have.text", "(6,7)");
1723
+ cy.get(cesc("#\\/pAnchor2") + " .mjx-mrow")
1724
+ .eq(0)
1725
+ .should("have.text", "(8,9)");
1726
+
1727
+ cy.log("change position from anchor");
1728
+ cy.get(cesc("#\\/positionFromAnchor1")).select("lowerLeft");
1729
+ cy.get(cesc("#\\/positionFromAnchor2")).select("lowerRight");
1730
+
1731
+ cy.get(cesc("#\\/pPositionFromAnchor1")).should(
1732
+ "have.text",
1733
+ "Position from anchor 1: lowerleft",
1734
+ );
1735
+ cy.get(cesc("#\\/pPositionFromAnchor2")).should(
1736
+ "have.text",
1737
+ "Position from anchor 2: lowerright",
1738
+ );
1739
+
1740
+ cy.log("make not draggable");
1741
+
1742
+ cy.get(cesc("#\\/draggable1")).click();
1743
+ cy.get(cesc("#\\/draggable2")).click();
1744
+ cy.get(cesc("#\\/pDraggable1")).should("have.text", "Draggable 1: false");
1745
+ cy.get(cesc("#\\/pDraggable2")).should("have.text", "Draggable 2: false");
1746
+
1747
+ cy.log("cannot move maths by dragging");
1748
+ cy.window().then(async (win) => {
1749
+ win.callAction1({
1750
+ actionName: "moveMath",
1751
+ componentName: "/math1",
1752
+ args: { x: -10, y: -9 },
1753
+ });
1754
+ win.callAction1({
1755
+ actionName: "moveMath",
1756
+ componentName: "/math2",
1757
+ args: { x: -8, y: -7 },
1758
+ });
1759
+ });
1760
+
1761
+ // since nothing will change, wait for boolean input to change to know core has responded
1762
+ cy.get(cesc("#\\/bi")).click();
1763
+ cy.get(cesc("#\\/b")).should("have.text", "true");
1764
+
1765
+ cy.get(cesc("#\\/pAnchor1") + " .mjx-mrow")
1766
+ .eq(0)
1767
+ .should("have.text", "(6,7)");
1768
+ cy.get(cesc("#\\/pAnchor2") + " .mjx-mrow")
1769
+ .eq(0)
1770
+ .should("have.text", "(8,9)");
1771
+ });
1772
+
1773
+ it("md in graph", () => {
1774
+ cy.window().then(async (win) => {
1775
+ win.postMessage(
1776
+ {
1777
+ doenetML: `
1778
+ <text>a</text>
1779
+ <graph >
1780
+ <md anchor="$anchorCoords1" name="math1" positionFromAnchor="$positionFromAnchor1" draggable="$draggable1">
1781
+ <mrow>Q \\amp= \\frac{\\partial f}{\\partial x}</mrow>
1782
+ <mrow>R \\amp= \\frac{\\partial g}{\\partial y}</mrow>
1783
+ </md>
1784
+ <md name="math2">
1785
+ <mrow>F \\amp=\\int_a^b f(x) dx</mrow>
1786
+ <mrow>G \\amp=\\int_c^d g(y) dy</mrow>
1787
+ </md>
1788
+ </graph>
1789
+
1790
+ <p name="pAnchor1">Anchor 1 coordinates: $math1.anchor</p>
1791
+ <p name="pAnchor2">Anchor 2 coordinates: $math2.anchor</p>
1792
+ <p name="pChangeAnchor1">Change anchor 1 coordinates: <mathinput name="anchorCoords1" prefill="(1,3)" /></p>
1793
+ <p name="pChangeAnchor2">Change anchor 2 coordinates: <mathinput name="anchorCoords2" bindValueTo="$math2.anchor" /></p>
1794
+ <p name="pPositionFromAnchor1">Position from anchor 1: $math1.positionFromAnchor</p>
1795
+ <p name="pPositionFromAnchor2">Position from anchor 2: $math2.positionFromAnchor</p>
1796
+ <p>Change position from anchor 1
1797
+ <choiceinput inline preselectChoice="1" name="positionFromAnchor1">
1798
+ <choice>upperRight</choice>
1799
+ <choice>upperLeft</choice>
1800
+ <choice>lowerRight</choice>
1801
+ <choice>lowerLeft</choice>
1802
+ <choice>left</choice>
1803
+ <choice>right</choice>
1804
+ <choice>top</choice>
1805
+ <choice>bottom</choice>
1806
+ <choice>center</choice>
1807
+ </choiceinput>
1808
+ </p>
1809
+ <p>Change position from anchor 2
1810
+ <choiceinput inline name="positionFromAnchor2" bindValueTo="$math2.positionFromAnchor">
1811
+ <choice>upperRight</choice>
1812
+ <choice>upperLeft</choice>
1813
+ <choice>lowerRight</choice>
1814
+ <choice>lowerLeft</choice>
1815
+ <choice>left</choice>
1816
+ <choice>right</choice>
1817
+ <choice>top</choice>
1818
+ <choice>bottom</choice>
1819
+ <choice>center</choice>
1820
+ </choiceinput>
1821
+ </p>
1822
+ <p name="pDraggable1">Draggable 1: $draggable1</p>
1823
+ <p name="pDraggable2">Draggable 2: $draggable2</p>
1824
+ <p>Change draggable 1 <booleanInput name="draggable1" prefill="true" /></p>
1825
+ <p>Change draggable 2 <booleanInput name="draggable2" bindValueTo="$math2.draggable" /></p>
1826
+ <p name="pContent1">Content 1: $math1</p>
1827
+ <p name="pContent2">Content 2: $math2</p>
1828
+ <p><booleaninput name="bi" /> <boolean name="b" copySource="bi" /></p>
1829
+
1830
+ `,
1831
+ },
1832
+ "*",
1833
+ );
1834
+ });
1835
+
1836
+ cy.get(cesc("#\\/_text1")).should("have.text", "a"); // to wait until loaded
1837
+
1838
+ cy.get(cesc("#\\/pAnchor1") + " .mjx-mrow")
1839
+ .eq(0)
1840
+ .should("have.text", "(1,3)");
1841
+ cy.get(cesc("#\\/pAnchor2") + " .mjx-mrow")
1842
+ .eq(0)
1843
+ .should("have.text", "(0,0)");
1844
+
1845
+ cy.get(cesc("#\\/pPositionFromAnchor1")).should(
1846
+ "have.text",
1847
+ "Position from anchor 1: upperright",
1848
+ );
1849
+ cy.get(cesc("#\\/pPositionFromAnchor2")).should(
1850
+ "have.text",
1851
+ "Position from anchor 2: center",
1852
+ );
1853
+ cy.get(cesc("#\\/positionFromAnchor1")).should("have.value", "1");
1854
+ cy.get(cesc("#\\/positionFromAnchor2")).should("have.value", "9");
1855
+ cy.get(cesc("#\\/pDraggable1")).should("have.text", "Draggable 1: true");
1856
+ cy.get(cesc("#\\/pDraggable2")).should("have.text", "Draggable 2: true");
1857
+ cy.get(cesc("#\\/pContent1"))
1858
+ .find(".mjx-mtr")
1859
+ .eq(0)
1860
+ .invoke("text")
1861
+ .then((text) => {
1862
+ expect(text.trim()).equal("Q=∂f∂x");
1863
+ });
1864
+ cy.get(cesc("#\\/pContent1"))
1865
+ .find(".mjx-mtr")
1866
+ .eq(1)
1867
+ .invoke("text")
1868
+ .then((text) => {
1869
+ expect(text.trim()).equal("R=∂g∂y");
1870
+ });
1871
+ cy.get(cesc("#\\/pContent2"))
1872
+ .find(".mjx-mtr")
1873
+ .eq(0)
1874
+ .invoke("text")
1875
+ .then((text) => {
1876
+ expect(text.trim()).equal("F=∫baf(x)dx");
1877
+ });
1878
+ cy.get(cesc("#\\/pContent2"))
1879
+ .find(".mjx-mtr")
1880
+ .eq(1)
1881
+ .invoke("text")
1882
+ .then((text) => {
1883
+ expect(text.trim()).equal("G=∫dcg(y)dy");
1884
+ });
1885
+
1886
+ cy.log("move maths by dragging");
1887
+
1888
+ cy.window().then(async (win) => {
1889
+ win.callAction1({
1890
+ actionName: "moveMath",
1891
+ componentName: "/math1",
1892
+ args: { x: -2, y: 3 },
1893
+ });
1894
+ win.callAction1({
1895
+ actionName: "moveMath",
1896
+ componentName: "/math2",
1897
+ args: { x: 4, y: -5 },
1898
+ });
1899
+ });
1900
+
1901
+ cy.get(cesc("#\\/pAnchor2") + " .mjx-mrow").should(
1902
+ "contain.text",
1903
+ "(4,−5)",
1904
+ );
1905
+
1906
+ cy.get(cesc("#\\/pAnchor1") + " .mjx-mrow")
1907
+ .eq(0)
1908
+ .should("have.text", "(−2,3)");
1909
+ cy.get(cesc("#\\/pAnchor2") + " .mjx-mrow")
1910
+ .eq(0)
1911
+ .should("have.text", "(4,−5)");
1912
+
1913
+ cy.log("move maths by entering coordinates");
1914
+
1915
+ cy.get(cesc("#\\/anchorCoords1") + " textarea").type(
1916
+ "{home}{shift+end}{backspace}(6,7){enter}",
1917
+ { force: true },
1918
+ );
1919
+ cy.get(cesc("#\\/anchorCoords2") + " textarea").type(
1920
+ "{home}{shift+end}{backspace}(8,9){enter}",
1921
+ { force: true },
1922
+ );
1923
+
1924
+ cy.get(cesc("#\\/pAnchor2") + " .mjx-mrow").should("contain.text", "(8,9)");
1925
+
1926
+ cy.get(cesc("#\\/pAnchor1") + " .mjx-mrow")
1927
+ .eq(0)
1928
+ .should("have.text", "(6,7)");
1929
+ cy.get(cesc("#\\/pAnchor2") + " .mjx-mrow")
1930
+ .eq(0)
1931
+ .should("have.text", "(8,9)");
1932
+
1933
+ cy.log("change position from anchor");
1934
+ cy.get(cesc("#\\/positionFromAnchor1")).select("lowerLeft");
1935
+ cy.get(cesc("#\\/positionFromAnchor2")).select("lowerRight");
1936
+
1937
+ cy.get(cesc("#\\/pPositionFromAnchor1")).should(
1938
+ "have.text",
1939
+ "Position from anchor 1: lowerleft",
1940
+ );
1941
+ cy.get(cesc("#\\/pPositionFromAnchor2")).should(
1942
+ "have.text",
1943
+ "Position from anchor 2: lowerright",
1944
+ );
1945
+
1946
+ cy.log("make not draggable");
1947
+
1948
+ cy.get(cesc("#\\/draggable1")).click();
1949
+ cy.get(cesc("#\\/draggable2")).click();
1950
+ cy.get(cesc("#\\/pDraggable1")).should("have.text", "Draggable 1: false");
1951
+ cy.get(cesc("#\\/pDraggable2")).should("have.text", "Draggable 2: false");
1952
+
1953
+ cy.log("cannot move maths by dragging");
1954
+ cy.window().then(async (win) => {
1955
+ win.callAction1({
1956
+ actionName: "moveMath",
1957
+ componentName: "/math1",
1958
+ args: { x: -10, y: -9 },
1959
+ });
1960
+ win.callAction1({
1961
+ actionName: "moveMath",
1962
+ componentName: "/math2",
1963
+ args: { x: -8, y: -7 },
1964
+ });
1965
+ });
1966
+
1967
+ // since nothing will change, wait for boolean input to change to know core has responded
1968
+ cy.get(cesc("#\\/bi")).click();
1969
+ cy.get(cesc("#\\/b")).should("have.text", "true");
1970
+
1971
+ cy.get(cesc("#\\/pAnchor1") + " .mjx-mrow")
1972
+ .eq(0)
1973
+ .should("have.text", "(6,7)");
1974
+ cy.get(cesc("#\\/pAnchor2") + " .mjx-mrow")
1975
+ .eq(0)
1976
+ .should("have.text", "(8,9)");
1977
+ });
1978
+
1979
+ it("color m via style", () => {
1980
+ cy.window().then(async (win) => {
1981
+ win.postMessage(
1982
+ {
1983
+ doenetML: `
1984
+ <setup>
1985
+ <styleDefinitions>
1986
+ <styleDefinition styleNumber="2" textColor="green" />
1987
+ <styleDefinition styleNumber="3" textColor="red" backgroundColor="blue" />
1988
+ </styleDefinitions>
1989
+ </setup>
1990
+
1991
+ <p>Style number: <mathinput prefill="1" name="sn" /></p>
1992
+
1993
+ <p><m name="no_style">x^2</m> is <text name="tsd_no_style">$no_style.textStyleDescription</text>, i.e., the text color is <text name="tc_no_style">$no_style.textColor</text> and the background color is <text name="bc_no_style">$no_style.backgroundColor</text>.</p>
1994
+ <p><m name="fixed_style" stylenumber="2">x^3</m> is <text name="tsd_fixed_style">$fixed_style.textStyleDescription</text>, i.e., the text color is <text name="tc_fixed_style">$fixed_style.textColor</text> and the background color is <text name="bc_fixed_style">$fixed_style.backgroundColor</text>.</p>
1995
+ <p><m name="variable_style" stylenumber="$sn">x^4</m> is <text name="tsd_variable_style">$variable_style.textStyleDescription</text>, i.e., the text color is <text name="tc_variable_style">$variable_style.textColor</text> and the background color is <text name="bc_variable_style">$variable_style.backgroundColor</text>.</p>
1996
+
1997
+ <graph>
1998
+ $no_style{anchor="(1,2)"}
1999
+ $fixed_style{anchor="(3,4)"}
2000
+ $variable_style
2001
+ </graph>
2002
+
2003
+ `,
2004
+ },
2005
+ "*",
2006
+ );
2007
+ });
2008
+
2009
+ cy.get(cesc("#\\/tsd_no_style")).should("have.text", "black");
2010
+ cy.get(cesc("#\\/tc_no_style")).should("have.text", "black");
2011
+ cy.get(cesc("#\\/bc_no_style")).should("have.text", "none");
2012
+
2013
+ cy.get(cesc("#\\/tsd_fixed_style")).should("have.text", "green");
2014
+ cy.get(cesc("#\\/tc_fixed_style")).should("have.text", "green");
2015
+ cy.get(cesc("#\\/bc_fixed_style")).should("have.text", "none");
2016
+
2017
+ cy.get(cesc("#\\/tsd_variable_style")).should("have.text", "black");
2018
+ cy.get(cesc("#\\/tc_variable_style")).should("have.text", "black");
2019
+ cy.get(cesc("#\\/bc_variable_style")).should("have.text", "none");
2020
+
2021
+ cy.get(cesc("#\\/no_style")).should("have.css", "color", "rgb(0, 0, 0)");
2022
+ cy.get(cesc("#\\/no_style")).should(
2023
+ "have.css",
2024
+ "background-color",
2025
+ "rgba(0, 0, 0, 0)",
2026
+ );
2027
+
2028
+ cy.get(cesc("#\\/fixed_style")).should(
2029
+ "have.css",
2030
+ "color",
2031
+ "rgb(0, 128, 0)",
2032
+ );
2033
+ cy.get(cesc("#\\/fixed_style")).should(
2034
+ "have.css",
2035
+ "background-color",
2036
+ "rgba(0, 0, 0, 0)",
2037
+ );
2038
+
2039
+ cy.get(cesc("#\\/variable_style")).should(
2040
+ "have.css",
2041
+ "color",
2042
+ "rgb(0, 0, 0)",
2043
+ );
2044
+ cy.get(cesc("#\\/variable_style")).should(
2045
+ "have.css",
2046
+ "background-color",
2047
+ "rgba(0, 0, 0, 0)",
2048
+ );
2049
+
2050
+ // TODO: how to test color in graph
2051
+
2052
+ cy.get(cesc("#\\/sn") + " textarea").type("{end}{backspace}2{enter}", {
2053
+ force: true,
2054
+ });
2055
+
2056
+ cy.get(cesc("#\\/tsd_variable_style")).should("have.text", "green");
2057
+ cy.get(cesc("#\\/tc_variable_style")).should("have.text", "green");
2058
+ cy.get(cesc("#\\/bc_variable_style")).should("have.text", "none");
2059
+
2060
+ cy.get(cesc("#\\/tsd_no_style")).should("have.text", "black");
2061
+ cy.get(cesc("#\\/tc_no_style")).should("have.text", "black");
2062
+ cy.get(cesc("#\\/bc_no_style")).should("have.text", "none");
2063
+
2064
+ cy.get(cesc("#\\/tsd_fixed_style")).should("have.text", "green");
2065
+ cy.get(cesc("#\\/tc_fixed_style")).should("have.text", "green");
2066
+ cy.get(cesc("#\\/bc_fixed_style")).should("have.text", "none");
2067
+
2068
+ cy.get(cesc("#\\/no_style")).should("have.css", "color", "rgb(0, 0, 0)");
2069
+ cy.get(cesc("#\\/no_style")).should(
2070
+ "have.css",
2071
+ "background-color",
2072
+ "rgba(0, 0, 0, 0)",
2073
+ );
2074
+
2075
+ cy.get(cesc("#\\/fixed_style")).should(
2076
+ "have.css",
2077
+ "color",
2078
+ "rgb(0, 128, 0)",
2079
+ );
2080
+ cy.get(cesc("#\\/fixed_style")).should(
2081
+ "have.css",
2082
+ "background-color",
2083
+ "rgba(0, 0, 0, 0)",
2084
+ );
2085
+
2086
+ cy.get(cesc("#\\/variable_style")).should(
2087
+ "have.css",
2088
+ "color",
2089
+ "rgb(0, 128, 0)",
2090
+ );
2091
+ cy.get(cesc("#\\/variable_style")).should(
2092
+ "have.css",
2093
+ "background-color",
2094
+ "rgba(0, 0, 0, 0)",
2095
+ );
2096
+
2097
+ cy.get(cesc("#\\/sn") + " textarea").type("{end}{backspace}3{enter}", {
2098
+ force: true,
2099
+ });
2100
+
2101
+ cy.get(cesc("#\\/tsd_variable_style")).should(
2102
+ "have.text",
2103
+ "red with a blue background",
2104
+ );
2105
+ cy.get(cesc("#\\/tc_variable_style")).should("have.text", "red");
2106
+ cy.get(cesc("#\\/bc_variable_style")).should("have.text", "blue");
2107
+
2108
+ cy.get(cesc("#\\/tsd_no_style")).should("have.text", "black");
2109
+ cy.get(cesc("#\\/tc_no_style")).should("have.text", "black");
2110
+ cy.get(cesc("#\\/bc_no_style")).should("have.text", "none");
2111
+
2112
+ cy.get(cesc("#\\/tsd_fixed_style")).should("have.text", "green");
2113
+ cy.get(cesc("#\\/tc_fixed_style")).should("have.text", "green");
2114
+ cy.get(cesc("#\\/bc_fixed_style")).should("have.text", "none");
2115
+
2116
+ cy.get(cesc("#\\/no_style")).should("have.css", "color", "rgb(0, 0, 0)");
2117
+ cy.get(cesc("#\\/no_style")).should(
2118
+ "have.css",
2119
+ "background-color",
2120
+ "rgba(0, 0, 0, 0)",
2121
+ );
2122
+
2123
+ cy.get(cesc("#\\/fixed_style")).should(
2124
+ "have.css",
2125
+ "color",
2126
+ "rgb(0, 128, 0)",
2127
+ );
2128
+ cy.get(cesc("#\\/fixed_style")).should(
2129
+ "have.css",
2130
+ "background-color",
2131
+ "rgba(0, 0, 0, 0)",
2132
+ );
2133
+
2134
+ cy.get(cesc("#\\/variable_style")).should(
2135
+ "have.css",
2136
+ "color",
2137
+ "rgb(255, 0, 0)",
2138
+ );
2139
+ cy.get(cesc("#\\/variable_style")).should(
2140
+ "have.css",
2141
+ "background-color",
2142
+ "rgb(0, 0, 255)",
2143
+ );
2144
+ });
2145
+
2146
+ it("color me via style", () => {
2147
+ cy.window().then(async (win) => {
2148
+ win.postMessage(
2149
+ {
2150
+ doenetML: `
2151
+ <setup>
2152
+ <styleDefinitions>
2153
+ <styleDefinition styleNumber="2" textColor="green" />
2154
+ <styleDefinition styleNumber="3" textColor="red" backgroundColor="blue" />
2155
+ </styleDefinitions>
2156
+ </setup>
2157
+
2158
+ <p>Style number: <mathinput prefill="1" name="sn" /></p>
2159
+
2160
+ <p><me name="no_style">x^2</me> is <text name="tsd_no_style">$no_style.textStyleDescription</text>, i.e., the text color is <text name="tc_no_style">$no_style.textColor</text> and the background color is <text name="bc_no_style">$no_style.backgroundColor</text>.</p>
2161
+ <p><me name="fixed_style" stylenumber="2">x^3</me> is <text name="tsd_fixed_style">$fixed_style.textStyleDescription</text>, i.e., the text color is <text name="tc_fixed_style">$fixed_style.textColor</text> and the background color is <text name="bc_fixed_style">$fixed_style.backgroundColor</text>.</p>
2162
+ <p><me name="variable_style" stylenumber="$sn">x^4</me> is <text name="tsd_variable_style">$variable_style.textStyleDescription</text>, i.e., the text color is <text name="tc_variable_style">$variable_style.textColor</text> and the background color is <text name="bc_variable_style">$variable_style.backgroundColor</text>.</p>
2163
+
2164
+ <graph>
2165
+ $no_style{anchor="(1,2)"}
2166
+ $fixed_style{anchor="(3,4)"}
2167
+ $variable_style
2168
+ </graph>
2169
+
2170
+ `,
2171
+ },
2172
+ "*",
2173
+ );
2174
+ });
2175
+
2176
+ cy.get(cesc("#\\/tsd_no_style")).should("have.text", "black");
2177
+ cy.get(cesc("#\\/tc_no_style")).should("have.text", "black");
2178
+ cy.get(cesc("#\\/bc_no_style")).should("have.text", "none");
2179
+
2180
+ cy.get(cesc("#\\/tsd_fixed_style")).should("have.text", "green");
2181
+ cy.get(cesc("#\\/tc_fixed_style")).should("have.text", "green");
2182
+ cy.get(cesc("#\\/bc_fixed_style")).should("have.text", "none");
2183
+
2184
+ cy.get(cesc("#\\/tsd_variable_style")).should("have.text", "black");
2185
+ cy.get(cesc("#\\/tc_variable_style")).should("have.text", "black");
2186
+ cy.get(cesc("#\\/bc_variable_style")).should("have.text", "none");
2187
+
2188
+ cy.get(cesc("#\\/no_style")).should("have.css", "color", "rgb(0, 0, 0)");
2189
+ cy.get(cesc("#\\/no_style")).should(
2190
+ "have.css",
2191
+ "background-color",
2192
+ "rgba(0, 0, 0, 0)",
2193
+ );
2194
+
2195
+ cy.get(cesc("#\\/fixed_style")).should(
2196
+ "have.css",
2197
+ "color",
2198
+ "rgb(0, 128, 0)",
2199
+ );
2200
+ cy.get(cesc("#\\/fixed_style")).should(
2201
+ "have.css",
2202
+ "background-color",
2203
+ "rgba(0, 0, 0, 0)",
2204
+ );
2205
+
2206
+ cy.get(cesc("#\\/variable_style")).should(
2207
+ "have.css",
2208
+ "color",
2209
+ "rgb(0, 0, 0)",
2210
+ );
2211
+ cy.get(cesc("#\\/variable_style")).should(
2212
+ "have.css",
2213
+ "background-color",
2214
+ "rgba(0, 0, 0, 0)",
2215
+ );
2216
+
2217
+ // TODO: how to test color in graph
2218
+
2219
+ cy.get(cesc("#\\/sn") + " textarea").type("{end}{backspace}2{enter}", {
2220
+ force: true,
2221
+ });
2222
+
2223
+ cy.get(cesc("#\\/tsd_variable_style")).should("have.text", "green");
2224
+ cy.get(cesc("#\\/tc_variable_style")).should("have.text", "green");
2225
+ cy.get(cesc("#\\/bc_variable_style")).should("have.text", "none");
2226
+
2227
+ cy.get(cesc("#\\/tsd_no_style")).should("have.text", "black");
2228
+ cy.get(cesc("#\\/tc_no_style")).should("have.text", "black");
2229
+ cy.get(cesc("#\\/bc_no_style")).should("have.text", "none");
2230
+
2231
+ cy.get(cesc("#\\/tsd_fixed_style")).should("have.text", "green");
2232
+ cy.get(cesc("#\\/tc_fixed_style")).should("have.text", "green");
2233
+ cy.get(cesc("#\\/bc_fixed_style")).should("have.text", "none");
2234
+
2235
+ cy.get(cesc("#\\/no_style")).should("have.css", "color", "rgb(0, 0, 0)");
2236
+ cy.get(cesc("#\\/no_style")).should(
2237
+ "have.css",
2238
+ "background-color",
2239
+ "rgba(0, 0, 0, 0)",
2240
+ );
2241
+
2242
+ cy.get(cesc("#\\/fixed_style")).should(
2243
+ "have.css",
2244
+ "color",
2245
+ "rgb(0, 128, 0)",
2246
+ );
2247
+ cy.get(cesc("#\\/fixed_style")).should(
2248
+ "have.css",
2249
+ "background-color",
2250
+ "rgba(0, 0, 0, 0)",
2251
+ );
2252
+
2253
+ cy.get(cesc("#\\/variable_style")).should(
2254
+ "have.css",
2255
+ "color",
2256
+ "rgb(0, 128, 0)",
2257
+ );
2258
+ cy.get(cesc("#\\/variable_style")).should(
2259
+ "have.css",
2260
+ "background-color",
2261
+ "rgba(0, 0, 0, 0)",
2262
+ );
2263
+
2264
+ cy.get(cesc("#\\/sn") + " textarea").type("{end}{backspace}3{enter}", {
2265
+ force: true,
2266
+ });
2267
+
2268
+ cy.get(cesc("#\\/tsd_variable_style")).should(
2269
+ "have.text",
2270
+ "red with a blue background",
2271
+ );
2272
+ cy.get(cesc("#\\/tc_variable_style")).should("have.text", "red");
2273
+ cy.get(cesc("#\\/bc_variable_style")).should("have.text", "blue");
2274
+
2275
+ cy.get(cesc("#\\/tsd_no_style")).should("have.text", "black");
2276
+ cy.get(cesc("#\\/tc_no_style")).should("have.text", "black");
2277
+ cy.get(cesc("#\\/bc_no_style")).should("have.text", "none");
2278
+
2279
+ cy.get(cesc("#\\/tsd_fixed_style")).should("have.text", "green");
2280
+ cy.get(cesc("#\\/tc_fixed_style")).should("have.text", "green");
2281
+ cy.get(cesc("#\\/bc_fixed_style")).should("have.text", "none");
2282
+
2283
+ cy.get(cesc("#\\/no_style")).should("have.css", "color", "rgb(0, 0, 0)");
2284
+ cy.get(cesc("#\\/no_style")).should(
2285
+ "have.css",
2286
+ "background-color",
2287
+ "rgba(0, 0, 0, 0)",
2288
+ );
2289
+
2290
+ cy.get(cesc("#\\/fixed_style")).should(
2291
+ "have.css",
2292
+ "color",
2293
+ "rgb(0, 128, 0)",
2294
+ );
2295
+ cy.get(cesc("#\\/fixed_style")).should(
2296
+ "have.css",
2297
+ "background-color",
2298
+ "rgba(0, 0, 0, 0)",
2299
+ );
2300
+
2301
+ cy.get(cesc("#\\/variable_style")).should(
2302
+ "have.css",
2303
+ "color",
2304
+ "rgb(255, 0, 0)",
2305
+ );
2306
+ cy.get(cesc("#\\/variable_style")).should(
2307
+ "have.css",
2308
+ "background-color",
2309
+ "rgb(0, 0, 255)",
2310
+ );
2311
+ });
2312
+
2313
+ it("color md via style", () => {
2314
+ cy.window().then(async (win) => {
2315
+ win.postMessage(
2316
+ {
2317
+ doenetML: `
2318
+ <setup>
2319
+ <styleDefinitions>
2320
+ <styleDefinition styleNumber="2" textColor="green" />
2321
+ <styleDefinition styleNumber="3" textColor="red" backgroundColor="blue" />
2322
+ </styleDefinitions>
2323
+ </setup>
2324
+
2325
+ <p>Style number: <mathinput prefill="1" name="sn" /></p>
2326
+
2327
+ <p><md name="no_style"><mrow>x^2</mrow><mrow>y^2</mrow></md> is <text name="tsd_no_style">$no_style.textStyleDescription</text>, i.e., the text color is <text name="tc_no_style">$no_style.textColor</text> and the background color is <text name="bc_no_style">$no_style.backgroundColor</text>.</p>
2328
+ <p><md name="fixed_style" stylenumber="2"><mrow>x^3</mrow><mrow>y^3</mrow></md> is <text name="tsd_fixed_style">$fixed_style.textStyleDescription</text>, i.e., the text color is <text name="tc_fixed_style">$fixed_style.textColor</text> and the background color is <text name="bc_fixed_style">$fixed_style.backgroundColor</text>.</p>
2329
+ <p><md name="variable_style" stylenumber="$sn"><mrow>x^4</mrow><mrow>y^4</mrow></md> is <text name="tsd_variable_style">$variable_style.textStyleDescription</text>, i.e., the text color is <text name="tc_variable_style">$variable_style.textColor</text> and the background color is <text name="bc_variable_style">$variable_style.backgroundColor</text>.</p>
2330
+
2331
+ <graph>
2332
+ $no_style{anchor="(1,2)"}
2333
+ $fixed_style{anchor="(3,4)"}
2334
+ $variable_style
2335
+ </graph>
2336
+
2337
+ `,
2338
+ },
2339
+ "*",
2340
+ );
2341
+ });
2342
+
2343
+ cy.get(cesc("#\\/tsd_no_style")).should("have.text", "black");
2344
+ cy.get(cesc("#\\/tc_no_style")).should("have.text", "black");
2345
+ cy.get(cesc("#\\/bc_no_style")).should("have.text", "none");
2346
+
2347
+ cy.get(cesc("#\\/tsd_fixed_style")).should("have.text", "green");
2348
+ cy.get(cesc("#\\/tc_fixed_style")).should("have.text", "green");
2349
+ cy.get(cesc("#\\/bc_fixed_style")).should("have.text", "none");
2350
+
2351
+ cy.get(cesc("#\\/tsd_variable_style")).should("have.text", "black");
2352
+ cy.get(cesc("#\\/tc_variable_style")).should("have.text", "black");
2353
+ cy.get(cesc("#\\/bc_variable_style")).should("have.text", "none");
2354
+
2355
+ cy.get(cesc("#\\/no_style")).should("have.css", "color", "rgb(0, 0, 0)");
2356
+ cy.get(cesc("#\\/no_style")).should(
2357
+ "have.css",
2358
+ "background-color",
2359
+ "rgba(0, 0, 0, 0)",
2360
+ );
2361
+
2362
+ cy.get(cesc("#\\/fixed_style")).should(
2363
+ "have.css",
2364
+ "color",
2365
+ "rgb(0, 128, 0)",
2366
+ );
2367
+ cy.get(cesc("#\\/fixed_style")).should(
2368
+ "have.css",
2369
+ "background-color",
2370
+ "rgba(0, 0, 0, 0)",
2371
+ );
2372
+
2373
+ cy.get(cesc("#\\/variable_style")).should(
2374
+ "have.css",
2375
+ "color",
2376
+ "rgb(0, 0, 0)",
2377
+ );
2378
+ cy.get(cesc("#\\/variable_style")).should(
2379
+ "have.css",
2380
+ "background-color",
2381
+ "rgba(0, 0, 0, 0)",
2382
+ );
2383
+
2384
+ // TODO: how to test color in graph
2385
+
2386
+ cy.get(cesc("#\\/sn") + " textarea").type("{end}{backspace}2{enter}", {
2387
+ force: true,
2388
+ });
2389
+
2390
+ cy.get(cesc("#\\/tsd_variable_style")).should("have.text", "green");
2391
+ cy.get(cesc("#\\/tc_variable_style")).should("have.text", "green");
2392
+ cy.get(cesc("#\\/bc_variable_style")).should("have.text", "none");
2393
+
2394
+ cy.get(cesc("#\\/tsd_no_style")).should("have.text", "black");
2395
+ cy.get(cesc("#\\/tc_no_style")).should("have.text", "black");
2396
+ cy.get(cesc("#\\/bc_no_style")).should("have.text", "none");
2397
+
2398
+ cy.get(cesc("#\\/tsd_fixed_style")).should("have.text", "green");
2399
+ cy.get(cesc("#\\/tc_fixed_style")).should("have.text", "green");
2400
+ cy.get(cesc("#\\/bc_fixed_style")).should("have.text", "none");
2401
+
2402
+ cy.get(cesc("#\\/no_style")).should("have.css", "color", "rgb(0, 0, 0)");
2403
+ cy.get(cesc("#\\/no_style")).should(
2404
+ "have.css",
2405
+ "background-color",
2406
+ "rgba(0, 0, 0, 0)",
2407
+ );
2408
+
2409
+ cy.get(cesc("#\\/fixed_style")).should(
2410
+ "have.css",
2411
+ "color",
2412
+ "rgb(0, 128, 0)",
2413
+ );
2414
+ cy.get(cesc("#\\/fixed_style")).should(
2415
+ "have.css",
2416
+ "background-color",
2417
+ "rgba(0, 0, 0, 0)",
2418
+ );
2419
+
2420
+ cy.get(cesc("#\\/variable_style")).should(
2421
+ "have.css",
2422
+ "color",
2423
+ "rgb(0, 128, 0)",
2424
+ );
2425
+ cy.get(cesc("#\\/variable_style")).should(
2426
+ "have.css",
2427
+ "background-color",
2428
+ "rgba(0, 0, 0, 0)",
2429
+ );
2430
+
2431
+ cy.get(cesc("#\\/sn") + " textarea").type("{end}{backspace}3{enter}", {
2432
+ force: true,
2433
+ });
2434
+
2435
+ cy.get(cesc("#\\/tsd_variable_style")).should(
2436
+ "have.text",
2437
+ "red with a blue background",
2438
+ );
2439
+ cy.get(cesc("#\\/tc_variable_style")).should("have.text", "red");
2440
+ cy.get(cesc("#\\/bc_variable_style")).should("have.text", "blue");
2441
+
2442
+ cy.get(cesc("#\\/tsd_no_style")).should("have.text", "black");
2443
+ cy.get(cesc("#\\/tc_no_style")).should("have.text", "black");
2444
+ cy.get(cesc("#\\/bc_no_style")).should("have.text", "none");
2445
+
2446
+ cy.get(cesc("#\\/tsd_fixed_style")).should("have.text", "green");
2447
+ cy.get(cesc("#\\/tc_fixed_style")).should("have.text", "green");
2448
+ cy.get(cesc("#\\/bc_fixed_style")).should("have.text", "none");
2449
+
2450
+ cy.get(cesc("#\\/no_style")).should("have.css", "color", "rgb(0, 0, 0)");
2451
+ cy.get(cesc("#\\/no_style")).should(
2452
+ "have.css",
2453
+ "background-color",
2454
+ "rgba(0, 0, 0, 0)",
2455
+ );
2456
+
2457
+ cy.get(cesc("#\\/fixed_style")).should(
2458
+ "have.css",
2459
+ "color",
2460
+ "rgb(0, 128, 0)",
2461
+ );
2462
+ cy.get(cesc("#\\/fixed_style")).should(
2463
+ "have.css",
2464
+ "background-color",
2465
+ "rgba(0, 0, 0, 0)",
2466
+ );
2467
+
2468
+ cy.get(cesc("#\\/variable_style")).should(
2469
+ "have.css",
2470
+ "color",
2471
+ "rgb(255, 0, 0)",
2472
+ );
2473
+ cy.get(cesc("#\\/variable_style")).should(
2474
+ "have.css",
2475
+ "background-color",
2476
+ "rgb(0, 0, 255)",
2477
+ );
2478
+ });
2479
+
2480
+ it("m copied by plain macro, but not latex, reflects style and anchor position", () => {
2481
+ cy.window().then(async (win) => {
2482
+ win.postMessage(
2483
+ {
2484
+ doenetML: `
2485
+ <setup>
2486
+ <styleDefinitions>
2487
+ <styleDefinition styleNumber="2" textColor="green" />
2488
+ <styleDefinition styleNumber="3" textColor="red" />
2489
+ </styleDefinitions>
2490
+ </setup>
2491
+
2492
+ <text>a</text>
2493
+
2494
+ <graph name="g1">
2495
+ <m styleNumber="2" name="m1">x^2</m>
2496
+ <m styleNumber="3" anchor="(3,4)" name="m2" >x^3</m>
2497
+ </graph>
2498
+
2499
+ <coords copySource="m1.anchor" name="m1coords" />
2500
+ <coords copySource="m2.anchor" name="m2coords" />
2501
+
2502
+ <graph name="g2">
2503
+ $m1
2504
+ $m2
2505
+ </graph>
2506
+
2507
+ <collect componentTypes="m" source="g2" prop="anchor" assignNames="m1acoords m2acoords" />
2508
+
2509
+ <graph name="g3">
2510
+ $m1.latex
2511
+ $m2.latex
2512
+ </graph>
2513
+
2514
+ <collect componentTypes="text" source="g3" prop="anchor" assignNames="m1bcoords m2bcoords" />
2515
+
2516
+ <p name="p1">$m1 $m2</p>
2517
+
2518
+ <p name="p2">$m1.latex $m2.latex</p>
2519
+
2520
+ `,
2521
+ },
2522
+ "*",
2523
+ );
2524
+ });
2525
+
2526
+ cy.get(cesc("#\\/_text1")).should("have.text", "a"); // to wait until loaded
2527
+
2528
+ cy.window().then(async (win) => {
2529
+ let stateVariables = await win.returnAllStateVariables1();
2530
+
2531
+ let m1aName = stateVariables["/g2"].activeChildren[0].componentName;
2532
+ let m2aName = stateVariables["/g2"].activeChildren[1].componentName;
2533
+ let m1bName = stateVariables["/g3"].activeChildren[0].componentName;
2534
+ let m2bName = stateVariables["/g3"].activeChildren[1].componentName;
2535
+ let m1cName = stateVariables["/p1"].activeChildren[0].componentName;
2536
+ let m2cName = stateVariables["/p1"].activeChildren[2].componentName;
2537
+ let m1dName = stateVariables["/p2"].activeChildren[0].componentName;
2538
+ let m2dName = stateVariables["/p2"].activeChildren[2].componentName;
2539
+
2540
+ let m1cAnchor = "#" + cesc2(m1cName) + " .mjx-mrow";
2541
+ let m2cAnchor = "#" + cesc2(m2cName) + " .mjx-mrow";
2542
+ let m1dAnchor = "#" + cesc2(m1dName);
2543
+ let m2dAnchor = "#" + cesc2(m2dName);
2544
+
2545
+ cy.get(m1cAnchor).eq(0).should("have.text", "x2");
2546
+ cy.get(m1dAnchor).should("have.text", "x^2");
2547
+ cy.get(m2cAnchor).eq(0).should("have.text", "x3");
2548
+ cy.get(m2dAnchor).should("have.text", "x^3");
2549
+
2550
+ cy.get(m1cAnchor).should("have.css", "color", "rgb(0, 128, 0)");
2551
+ cy.get(m1dAnchor).should("have.css", "color", "rgb(0, 0, 0)");
2552
+ cy.get(m2cAnchor).should("have.css", "color", "rgb(255, 0, 0)");
2553
+ cy.get(m2dAnchor).should("have.css", "color", "rgb(0, 0, 0)");
2554
+
2555
+ cy.get(cesc("#\\/m1coords") + " .mjx-mrow")
2556
+ .eq(0)
2557
+ .should("have.text", "(0,0)");
2558
+ cy.get(cesc("#\\/m2coords") + " .mjx-mrow")
2559
+ .eq(0)
2560
+ .should("have.text", "(3,4)");
2561
+ cy.get(cesc("#\\/m1acoords") + " .mjx-mrow")
2562
+ .eq(0)
2563
+ .should("have.text", "(0,0)");
2564
+ cy.get(cesc("#\\/m2acoords") + " .mjx-mrow")
2565
+ .eq(0)
2566
+ .should("have.text", "(3,4)");
2567
+ cy.get(cesc("#\\/m1bcoords") + " .mjx-mrow")
2568
+ .eq(0)
2569
+ .should("have.text", "(0,0)");
2570
+ cy.get(cesc("#\\/m2bcoords") + " .mjx-mrow")
2571
+ .eq(0)
2572
+ .should("have.text", "(0,0)");
2573
+
2574
+ cy.log("move first ms");
2575
+ cy.window().then(async (win) => {
2576
+ win.callAction1({
2577
+ actionName: "moveMath",
2578
+ componentName: "/m1",
2579
+ args: { x: -2, y: 3 },
2580
+ });
2581
+ win.callAction1({
2582
+ actionName: "moveMath",
2583
+ componentName: "/m2",
2584
+ args: { x: 4, y: -5 },
2585
+ });
2586
+ });
2587
+
2588
+ cy.get(cesc("#\\/m2coords") + " .mjx-mrow").should(
2589
+ "contain.text",
2590
+ "(4,−5)",
2591
+ );
2592
+
2593
+ cy.get(cesc("#\\/m1coords") + " .mjx-mrow")
2594
+ .eq(0)
2595
+ .should("have.text", "(−2,3)");
2596
+ cy.get(cesc("#\\/m2coords") + " .mjx-mrow")
2597
+ .eq(0)
2598
+ .should("have.text", "(4,−5)");
2599
+ cy.get(cesc("#\\/m1acoords") + " .mjx-mrow")
2600
+ .eq(0)
2601
+ .should("have.text", "(−2,3)");
2602
+ cy.get(cesc("#\\/m2acoords") + " .mjx-mrow")
2603
+ .eq(0)
2604
+ .should("have.text", "(4,−5)");
2605
+ cy.get(cesc("#\\/m1bcoords") + " .mjx-mrow")
2606
+ .eq(0)
2607
+ .should("have.text", "(0,0)");
2608
+ cy.get(cesc("#\\/m2bcoords") + " .mjx-mrow")
2609
+ .eq(0)
2610
+ .should("have.text", "(0,0)");
2611
+
2612
+ cy.log("move second ms");
2613
+ cy.window().then(async (win) => {
2614
+ win.callAction1({
2615
+ actionName: "moveMath",
2616
+ componentName: m1aName,
2617
+ args: { x: 7, y: 1 },
2618
+ });
2619
+ win.callAction1({
2620
+ actionName: "moveMath",
2621
+ componentName: m2aName,
2622
+ args: { x: -8, y: 2 },
2623
+ });
2624
+ });
2625
+
2626
+ cy.get(cesc("#\\/m2coords") + " .mjx-mrow").should(
2627
+ "contain.text",
2628
+ "(−8,2)",
2629
+ );
2630
+
2631
+ cy.get(cesc("#\\/m1coords") + " .mjx-mrow")
2632
+ .eq(0)
2633
+ .should("have.text", "(7,1)");
2634
+ cy.get(cesc("#\\/m2coords") + " .mjx-mrow")
2635
+ .eq(0)
2636
+ .should("have.text", "(−8,2)");
2637
+ cy.get(cesc("#\\/m1acoords") + " .mjx-mrow")
2638
+ .eq(0)
2639
+ .should("have.text", "(7,1)");
2640
+ cy.get(cesc("#\\/m2acoords") + " .mjx-mrow")
2641
+ .eq(0)
2642
+ .should("have.text", "(−8,2)");
2643
+ cy.get(cesc("#\\/m1bcoords") + " .mjx-mrow")
2644
+ .eq(0)
2645
+ .should("have.text", "(0,0)");
2646
+ cy.get(cesc("#\\/m2bcoords") + " .mjx-mrow")
2647
+ .eq(0)
2648
+ .should("have.text", "(0,0)");
2649
+
2650
+ cy.log("move third ms");
2651
+ cy.window().then(async (win) => {
2652
+ win.callAction1({
2653
+ actionName: "moveText",
2654
+ componentName: m1bName,
2655
+ args: { x: -6, y: 3 },
2656
+ });
2657
+ win.callAction1({
2658
+ actionName: "moveText",
2659
+ componentName: m2bName,
2660
+ args: { x: -5, y: -4 },
2661
+ });
2662
+ });
2663
+
2664
+ cy.get(cesc("#\\/m2bcoords") + " .mjx-mrow").should(
2665
+ "contain.text",
2666
+ "(−5,−4)",
2667
+ );
2668
+
2669
+ cy.get(cesc("#\\/m1coords") + " .mjx-mrow")
2670
+ .eq(0)
2671
+ .should("have.text", "(7,1)");
2672
+ cy.get(cesc("#\\/m2coords") + " .mjx-mrow")
2673
+ .eq(0)
2674
+ .should("have.text", "(−8,2)");
2675
+ cy.get(cesc("#\\/m1acoords") + " .mjx-mrow")
2676
+ .eq(0)
2677
+ .should("have.text", "(7,1)");
2678
+ cy.get(cesc("#\\/m2acoords") + " .mjx-mrow")
2679
+ .eq(0)
2680
+ .should("have.text", "(−8,2)");
2681
+ cy.get(cesc("#\\/m1bcoords") + " .mjx-mrow")
2682
+ .eq(0)
2683
+ .should("have.text", "(−6,3)");
2684
+ cy.get(cesc("#\\/m2bcoords") + " .mjx-mrow")
2685
+ .eq(0)
2686
+ .should("have.text", "(−5,−4)");
2687
+ });
2688
+ });
2689
+ });