@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,3989 @@
1
+ import { cesc } from "../../../../src/utils/url";
2
+
3
+ describe("Point location validation tests", function () {
4
+ beforeEach(() => {
5
+ cy.clearIndexedDB();
6
+ cy.visit("/src/Tools/cypressTest/");
7
+ });
8
+
9
+ it("point in first quadrant", () => {
10
+ cy.window().then(async (win) => {
11
+ win.postMessage(
12
+ {
13
+ doenetML: `
14
+ <text>a</text>
15
+ <p>Move point to first quadrant</p>
16
+ <graph><point>(-3.9,4.5)</point></graph>
17
+ <p><answer>
18
+ <award><when>
19
+ <copy prop="x" target="_point1" /> > 0 and
20
+ <copy prop="y" target="_point1" /> > 0
21
+ </when></award>
22
+ <considerAsResponses>$_point1</considerAsResponses>
23
+ </answer></p>
24
+ <p>Credit for answer: <copy prop="creditAchieved" target="_answer1" /></p>
25
+ `,
26
+ },
27
+ "*",
28
+ );
29
+ });
30
+
31
+ cy.get(cesc("#\\/_text1")).should("have.text", "a"); // to wait for page to load
32
+
33
+ cy.get(cesc("#\\/_answer1_submit"))
34
+ .invoke("text")
35
+ .then((text) => {
36
+ expect(text.trim().toLowerCase()).equal("check work");
37
+ });
38
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
39
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
40
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
41
+
42
+ cy.log("Submit answer");
43
+ cy.get(cesc("#\\/_answer1_submit")).click();
44
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
45
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
46
+ cy.get(cesc("#\\/_answer1_incorrect"))
47
+ .invoke("text")
48
+ .then((text) => {
49
+ expect(text.trim().toLowerCase()).equal("incorrect");
50
+ });
51
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
52
+
53
+ cy.window().then(async (win) => {
54
+ let stateVariables = await win.returnAllStateVariables1();
55
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
56
+ });
57
+
58
+ cy.log("Move point to correct quadrant");
59
+ cy.window().then(async (win) => {
60
+ await win.callAction1({
61
+ actionName: "movePoint",
62
+ componentName: "/_point1",
63
+ args: { x: 5.9, y: 3.5 },
64
+ });
65
+ let stateVariables = await win.returnAllStateVariables1();
66
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
67
+ });
68
+
69
+ cy.get(cesc("#\\/_answer1_submit"))
70
+ .invoke("text")
71
+ .then((text) => {
72
+ expect(text.trim().toLowerCase()).equal("check work");
73
+ });
74
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
75
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
76
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
77
+
78
+ cy.log("Submit answer");
79
+ cy.get(cesc("#\\/_answer1_submit")).click();
80
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
81
+ cy.get(cesc("#\\/_answer1_correct"))
82
+ .invoke("text")
83
+ .then((text) => {
84
+ expect(text.trim().toLowerCase()).equal("correct");
85
+ });
86
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
87
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
88
+
89
+ cy.window().then(async (win) => {
90
+ let stateVariables = await win.returnAllStateVariables1();
91
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
92
+ });
93
+
94
+ cy.log("Move point to second quadrant and submit");
95
+ cy.window().then(async (win) => {
96
+ await win.callAction1({
97
+ actionName: "movePoint",
98
+ componentName: "/_point1",
99
+ args: { x: -8.8, y: 1.3 },
100
+ });
101
+ let stateVariables = await win.returnAllStateVariables1();
102
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
103
+ });
104
+
105
+ cy.get(cesc("#\\/_answer1_submit"))
106
+ .invoke("text")
107
+ .then((text) => {
108
+ expect(text.trim().toLowerCase()).equal("check work");
109
+ });
110
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
111
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
112
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
113
+
114
+ cy.get(cesc("#\\/_answer1_submit")).click();
115
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
116
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
117
+ cy.get(cesc("#\\/_answer1_incorrect"))
118
+ .invoke("text")
119
+ .then((text) => {
120
+ expect(text.trim().toLowerCase()).equal("incorrect");
121
+ });
122
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
123
+
124
+ cy.window().then(async (win) => {
125
+ let stateVariables = await win.returnAllStateVariables1();
126
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
127
+ });
128
+
129
+ cy.log("Move point to third quadrant and submit");
130
+ cy.window().then(async (win) => {
131
+ await win.callAction1({
132
+ actionName: "movePoint",
133
+ componentName: "/_point1",
134
+ args: { x: -9.4, y: -5.1 },
135
+ });
136
+ let stateVariables = await win.returnAllStateVariables1();
137
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
138
+ });
139
+
140
+ cy.get(cesc("#\\/_answer1_submit"))
141
+ .invoke("text")
142
+ .then((text) => {
143
+ expect(text.trim().toLowerCase()).equal("check work");
144
+ });
145
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
146
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
147
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
148
+
149
+ cy.get(cesc("#\\/_answer1_submit")).click();
150
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
151
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
152
+ cy.get(cesc("#\\/_answer1_incorrect"))
153
+ .invoke("text")
154
+ .then((text) => {
155
+ expect(text.trim().toLowerCase()).equal("incorrect");
156
+ });
157
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
158
+
159
+ cy.window().then(async (win) => {
160
+ let stateVariables = await win.returnAllStateVariables1();
161
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
162
+ });
163
+
164
+ cy.log("Move point to fourth quadrant and submit");
165
+ cy.window().then(async (win) => {
166
+ await win.callAction1({
167
+ actionName: "movePoint",
168
+ componentName: "/_point1",
169
+ args: { x: 4.2, y: -2.9 },
170
+ });
171
+ let stateVariables = await win.returnAllStateVariables1();
172
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
173
+ });
174
+ cy.get(cesc("#\\/_answer1_submit"))
175
+ .invoke("text")
176
+ .then((text) => {
177
+ expect(text.trim().toLowerCase()).equal("check work");
178
+ });
179
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
180
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
181
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
182
+
183
+ cy.get(cesc("#\\/_answer1_submit")).click();
184
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
185
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
186
+ cy.get(cesc("#\\/_answer1_incorrect"))
187
+ .invoke("text")
188
+ .then((text) => {
189
+ expect(text.trim().toLowerCase()).equal("incorrect");
190
+ });
191
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
192
+
193
+ cy.window().then(async (win) => {
194
+ let stateVariables = await win.returnAllStateVariables1();
195
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
196
+ });
197
+
198
+ cy.log("Move point back to first quadrant and submit");
199
+ cy.window().then(async (win) => {
200
+ await win.callAction1({
201
+ actionName: "movePoint",
202
+ componentName: "/_point1",
203
+ args: { x: 4.6, y: 0.1 },
204
+ });
205
+ let stateVariables = await win.returnAllStateVariables1();
206
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
207
+ });
208
+
209
+ cy.get(cesc("#\\/_answer1_submit"))
210
+ .invoke("text")
211
+ .then((text) => {
212
+ expect(text.trim().toLowerCase()).equal("check work");
213
+ });
214
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
215
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
216
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
217
+
218
+ cy.get(cesc("#\\/_answer1_submit")).click();
219
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
220
+ cy.get(cesc("#\\/_answer1_correct"))
221
+ .invoke("text")
222
+ .then((text) => {
223
+ expect(text.trim().toLowerCase()).equal("correct");
224
+ });
225
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
226
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
227
+
228
+ cy.window().then(async (win) => {
229
+ let stateVariables = await win.returnAllStateVariables1();
230
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
231
+ });
232
+ });
233
+
234
+ it("point in first quadrant, remember submitted on reload", () => {
235
+ let doenetML = `
236
+ <text>a</text>
237
+ <p>Move point to first quadrant</p>
238
+ <graph><point>(-3.9,4.5)</point></graph>
239
+ <p><answer>
240
+ <award><when>
241
+ <copy prop="x" target="_point1" /> > 0 and
242
+ <copy prop="y" target="_point1" /> > 0
243
+ </when></award>
244
+ <considerAsResponses>$_point1</considerAsResponses>
245
+ </answer></p>
246
+ <p>Credit for answer: <copy prop="creditAchieved" target="_answer1" /></p>
247
+ `;
248
+
249
+ cy.get("#testRunner_toggleControls").click();
250
+ cy.get("#testRunner_allowLocalState").click();
251
+ cy.wait(100);
252
+ cy.get("#testRunner_toggleControls").click();
253
+
254
+ cy.window().then(async (win) => {
255
+ win.postMessage(
256
+ {
257
+ doenetML,
258
+ },
259
+ "*",
260
+ );
261
+ });
262
+
263
+ cy.get(cesc("#\\/_text1")).should("have.text", "a"); // to wait for page to load
264
+
265
+ cy.log("Move point to correct quadrant and move again");
266
+ // for some reason, have to move point twice to trigger bug
267
+ // that occurs when expressionWithCodes of math isn't changed
268
+
269
+ cy.window().then(async (win) => {
270
+ await win.callAction1({
271
+ actionName: "movePoint",
272
+ componentName: "/_point1",
273
+ args: { x: 5.9, y: 3.5 },
274
+ });
275
+ await win.callAction1({
276
+ actionName: "movePoint",
277
+ componentName: "/_point1",
278
+ args: { x: 5.9, y: 3.4 },
279
+ });
280
+ });
281
+
282
+ cy.get(cesc("#\\/_answer1_submit"))
283
+ .invoke("text")
284
+ .then((text) => {
285
+ expect(text.trim().toLowerCase()).equal("check work");
286
+ });
287
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
288
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
289
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
290
+
291
+ cy.log("Submit answer");
292
+ cy.get(cesc("#\\/_answer1_submit")).click();
293
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
294
+ cy.get(cesc("#\\/_answer1_correct"))
295
+ .invoke("text")
296
+ .then((text) => {
297
+ expect(text.trim().toLowerCase()).equal("correct");
298
+ });
299
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
300
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
301
+
302
+ cy.window().then(async (win) => {
303
+ let stateVariables = await win.returnAllStateVariables1();
304
+ expect(stateVariables["/_point1"].stateValues.xs).eqls([5.9, 3.4]);
305
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
306
+ });
307
+
308
+ cy.wait(2000); // wait for 1 second debounce
309
+
310
+ cy.log("Reload page");
311
+ cy.reload();
312
+
313
+ cy.window().then(async (win) => {
314
+ win.postMessage(
315
+ {
316
+ doenetML,
317
+ },
318
+ "*",
319
+ );
320
+ });
321
+
322
+ cy.get(cesc("#\\/_text1")).should("have.text", "a"); //wait for page to load
323
+
324
+ // wait until core is loaded
325
+ cy.waitUntil(() =>
326
+ cy.window().then(async (win) => {
327
+ let stateVariables = await win.returnAllStateVariables1();
328
+ return stateVariables["/_answer1"];
329
+ }),
330
+ );
331
+
332
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
333
+ cy.get(cesc("#\\/_answer1_correct"))
334
+ .invoke("text")
335
+ .then((text) => {
336
+ expect(text.trim().toLowerCase()).equal("correct");
337
+ });
338
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
339
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
340
+
341
+ cy.window().then(async (win) => {
342
+ let stateVariables = await win.returnAllStateVariables1();
343
+ expect(stateVariables["/_point1"].stateValues.xs).eqls([5.9, 3.4]);
344
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
345
+ });
346
+
347
+ cy.log("Move point to second quadrant and submit");
348
+ cy.window().then(async (win) => {
349
+ await win.callAction1({
350
+ actionName: "movePoint",
351
+ componentName: "/_point1",
352
+ args: { x: -8.8, y: 1.3 },
353
+ });
354
+ let stateVariables = await win.returnAllStateVariables1();
355
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
356
+ });
357
+
358
+ cy.get(cesc("#\\/_answer1_submit"))
359
+ .invoke("text")
360
+ .then((text) => {
361
+ expect(text.trim().toLowerCase()).equal("check work");
362
+ });
363
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
364
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
365
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
366
+
367
+ cy.get(cesc("#\\/_answer1_submit")).click();
368
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
369
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
370
+ cy.get(cesc("#\\/_answer1_incorrect"))
371
+ .invoke("text")
372
+ .then((text) => {
373
+ expect(text.trim().toLowerCase()).equal("incorrect");
374
+ });
375
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
376
+
377
+ cy.window().then(async (win) => {
378
+ let stateVariables = await win.returnAllStateVariables1();
379
+ expect(stateVariables["/_point1"].stateValues.xs).eqls([-8.8, 1.3]);
380
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
381
+ });
382
+
383
+ cy.wait(2000); // wait for 1 second debounce
384
+
385
+ cy.log("Reload page");
386
+ cy.reload();
387
+
388
+ cy.window().then(async (win) => {
389
+ win.postMessage(
390
+ {
391
+ doenetML,
392
+ },
393
+ "*",
394
+ );
395
+ });
396
+
397
+ cy.get(cesc("#\\/_text1")).should("have.text", "a"); //wait for page to load
398
+
399
+ // wait until core is loaded
400
+ cy.waitUntil(() =>
401
+ cy.window().then(async (win) => {
402
+ let stateVariables = await win.returnAllStateVariables1();
403
+ return stateVariables["/_answer1"];
404
+ }),
405
+ );
406
+
407
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
408
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
409
+ cy.get(cesc("#\\/_answer1_incorrect"))
410
+ .invoke("text")
411
+ .then((text) => {
412
+ expect(text.trim().toLowerCase()).equal("incorrect");
413
+ });
414
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
415
+
416
+ cy.window().then(async (win) => {
417
+ let stateVariables = await win.returnAllStateVariables1();
418
+ expect(stateVariables["/_point1"].stateValues.xs).eqls([-8.8, 1.3]);
419
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
420
+ });
421
+
422
+ cy.log("Move point to third quadrant and submit");
423
+ cy.window().then(async (win) => {
424
+ await win.callAction1({
425
+ actionName: "movePoint",
426
+ componentName: "/_point1",
427
+ args: { x: -9.4, y: -5.1 },
428
+ });
429
+ await win.callAction1({
430
+ actionName: "movePoint",
431
+ componentName: "/_point1",
432
+ args: { x: -9.5, y: -5.1 },
433
+ });
434
+ let stateVariables = await win.returnAllStateVariables1();
435
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
436
+ });
437
+
438
+ cy.get(cesc("#\\/_answer1_submit"))
439
+ .invoke("text")
440
+ .then((text) => {
441
+ expect(text.trim().toLowerCase()).equal("check work");
442
+ });
443
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
444
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
445
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
446
+
447
+ cy.get(cesc("#\\/_answer1_submit")).click();
448
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
449
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
450
+ cy.get(cesc("#\\/_answer1_incorrect"))
451
+ .invoke("text")
452
+ .then((text) => {
453
+ expect(text.trim().toLowerCase()).equal("incorrect");
454
+ });
455
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
456
+
457
+ cy.window().then(async (win) => {
458
+ let stateVariables = await win.returnAllStateVariables1();
459
+ expect(stateVariables["/_point1"].stateValues.xs).eqls([-9.5, -5.1]);
460
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
461
+ });
462
+
463
+ cy.wait(2000); // wait for 1 second debounce
464
+
465
+ cy.log("Reload page");
466
+ cy.reload();
467
+
468
+ cy.window().then(async (win) => {
469
+ win.postMessage(
470
+ {
471
+ doenetML,
472
+ },
473
+ "*",
474
+ );
475
+ });
476
+
477
+ cy.get(cesc("#\\/_text1")).should("have.text", "a"); //wait for page to load
478
+
479
+ // wait until core is loaded
480
+ cy.waitUntil(() =>
481
+ cy.window().then(async (win) => {
482
+ let stateVariables = await win.returnAllStateVariables1();
483
+ return stateVariables["/_answer1"];
484
+ }),
485
+ );
486
+
487
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
488
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
489
+ cy.get(cesc("#\\/_answer1_incorrect"))
490
+ .invoke("text")
491
+ .then((text) => {
492
+ expect(text.trim().toLowerCase()).equal("incorrect");
493
+ });
494
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
495
+
496
+ cy.window().then(async (win) => {
497
+ let stateVariables = await win.returnAllStateVariables1();
498
+ expect(stateVariables["/_point1"].stateValues.xs).eqls([-9.5, -5.1]);
499
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
500
+ });
501
+ });
502
+
503
+ it("point at precise location with attract", () => {
504
+ cy.window().then(async (win) => {
505
+ win.postMessage(
506
+ {
507
+ doenetML: `
508
+ <text>a</text>
509
+ <point name="goal">(-4.1, 7.4)</point>
510
+ <p>Move point to <copy prop="coords" target="goal" /></p>
511
+ <graph>
512
+ <point name="A" x="4.9" y="-1.1">
513
+ <constraints>
514
+ <attractTo><copy target="goal" /></attractTo>
515
+ </constraints>
516
+ </point>
517
+ </graph>
518
+ <p><answer><award><when>
519
+ <copy prop="x" target="A" isResponse /> = <copy prop="x" target="goal" /> and
520
+ <copy prop="y" target="A" isResponse /> = <copy prop="y" target="goal" />
521
+ </when></award></answer></p>
522
+ <p>Credit for answer: <copy prop="creditAchieved" target="_answer1" /></p>
523
+ `,
524
+ },
525
+ "*",
526
+ );
527
+ });
528
+
529
+ cy.get(cesc("#\\/_text1")).should("have.text", "a"); // to wait for page to load
530
+
531
+ cy.get(cesc("#\\/_answer1_submit"))
532
+ .invoke("text")
533
+ .then((text) => {
534
+ expect(text.trim().toLowerCase()).equal("check work");
535
+ });
536
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
537
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
538
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
539
+
540
+ cy.log("Submit answer");
541
+ cy.get(cesc("#\\/_answer1_submit")).click();
542
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
543
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
544
+ cy.get(cesc("#\\/_answer1_incorrect"))
545
+ .invoke("text")
546
+ .then((text) => {
547
+ expect(text.trim().toLowerCase()).equal("incorrect");
548
+ });
549
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
550
+
551
+ cy.window().then(async (win) => {
552
+ let stateVariables = await win.returnAllStateVariables1();
553
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
554
+ });
555
+
556
+ cy.log("Move near correct point");
557
+ cy.window().then(async (win) => {
558
+ await win.callAction1({
559
+ actionName: "movePoint",
560
+ componentName: "/A",
561
+ args: { x: -4, y: 7.6 },
562
+ });
563
+ let stateVariables = await win.returnAllStateVariables1();
564
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
565
+ });
566
+
567
+ cy.get(cesc("#\\/_answer1_submit"))
568
+ .invoke("text")
569
+ .then((text) => {
570
+ expect(text.trim().toLowerCase()).equal("check work");
571
+ });
572
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
573
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
574
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
575
+
576
+ cy.log("Submit answer");
577
+ cy.get(cesc("#\\/_answer1_submit")).click();
578
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
579
+ cy.get(cesc("#\\/_answer1_correct"))
580
+ .invoke("text")
581
+ .then((text) => {
582
+ expect(text.trim().toLowerCase()).equal("correct");
583
+ });
584
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
585
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
586
+
587
+ cy.window().then(async (win) => {
588
+ let stateVariables = await win.returnAllStateVariables1();
589
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
590
+ });
591
+
592
+ cy.log("Move point further away and submit");
593
+ cy.window().then(async (win) => {
594
+ await win.callAction1({
595
+ actionName: "movePoint",
596
+ componentName: "/A",
597
+ args: { x: -3.7, y: 7 },
598
+ });
599
+ let stateVariables = await win.returnAllStateVariables1();
600
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
601
+ });
602
+
603
+ cy.get(cesc("#\\/_answer1_submit"))
604
+ .invoke("text")
605
+ .then((text) => {
606
+ expect(text.trim().toLowerCase()).equal("check work");
607
+ });
608
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
609
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
610
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
611
+
612
+ cy.get(cesc("#\\/_answer1_submit")).click();
613
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
614
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
615
+ cy.get(cesc("#\\/_answer1_incorrect"))
616
+ .invoke("text")
617
+ .then((text) => {
618
+ expect(text.trim().toLowerCase()).equal("incorrect");
619
+ });
620
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
621
+
622
+ cy.window().then(async (win) => {
623
+ let stateVariables = await win.returnAllStateVariables1();
624
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
625
+ });
626
+
627
+ cy.log("Move point close again and submit");
628
+ cy.window().then(async (win) => {
629
+ await win.callAction1({
630
+ actionName: "movePoint",
631
+ componentName: "/A",
632
+ args: { x: -3.8, y: 7.1 },
633
+ });
634
+ let stateVariables = await win.returnAllStateVariables1();
635
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
636
+ });
637
+
638
+ cy.get(cesc("#\\/_answer1_submit"))
639
+ .invoke("text")
640
+ .then((text) => {
641
+ expect(text.trim().toLowerCase()).equal("check work");
642
+ });
643
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
644
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
645
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
646
+
647
+ cy.log("Submit answer");
648
+ cy.get(cesc("#\\/_answer1_submit")).click();
649
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
650
+ cy.get(cesc("#\\/_answer1_correct"))
651
+ .invoke("text")
652
+ .then((text) => {
653
+ expect(text.trim().toLowerCase()).equal("correct");
654
+ });
655
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
656
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
657
+
658
+ cy.window().then(async (win) => {
659
+ let stateVariables = await win.returnAllStateVariables1();
660
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
661
+ });
662
+ });
663
+
664
+ it("point close enough to precise location", () => {
665
+ cy.window().then(async (win) => {
666
+ win.postMessage(
667
+ {
668
+ doenetML: `
669
+ <text>a</text>
670
+ <point name="goal">(-4.1, 7.4)</point>
671
+
672
+ <p>Criterion distance: <mathinput name="criterion" prefill="2"/></p>
673
+ <p>Partial credit distance: <mathinput name="partialcriterion" prefill="3"/></p>
674
+
675
+ <number hide name="criterion2"><copy prop="value" target="criterion" />^2</number>
676
+ <number hide name="partialcriterion2"><copy prop="value" target="partialcriterion" />^2</number>
677
+ <number hide name="distance2">(<copy prop="x" target="A" /> - <copy prop="x" target="goal" />)^2 +
678
+ (<copy prop="y" target="A" /> - <copy prop="y" target="goal" />)^2</number>
679
+
680
+ <p>Move point to within distance of <copy prop="value" target="criterion" /> to <copy prop="coords" target="goal" /></p>
681
+ <graph>
682
+ <point name="A">(4.9, -1.1)</point>
683
+ </graph>
684
+ <p><answer>
685
+ <award><when>
686
+ <copy target="distance2" /> < <copy target="criterion2" />
687
+ </when></award>
688
+ <award credit="0.6"><when>
689
+ <copy target="distance2" /> < <copy target="partialcriterion2" />
690
+ </when></award>
691
+ <considerAsResponses>$A</considerAsResponses>
692
+ </answer></p>
693
+ <p>Credit for answer: <copy prop="creditAchieved" target="_answer1" /></p>
694
+ `,
695
+ },
696
+ "*",
697
+ );
698
+ });
699
+
700
+ cy.get(cesc("#\\/_text1")).should("have.text", "a"); // to wait for page to load
701
+
702
+ cy.get(cesc("#\\/_answer1_submit"))
703
+ .invoke("text")
704
+ .then((text) => {
705
+ expect(text.trim().toLowerCase()).equal("check work");
706
+ });
707
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
708
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
709
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
710
+
711
+ cy.log("Submit answer");
712
+ cy.get(cesc("#\\/_answer1_submit")).click();
713
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
714
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
715
+ cy.get(cesc("#\\/_answer1_incorrect"))
716
+ .invoke("text")
717
+ .then((text) => {
718
+ expect(text.trim().toLowerCase()).equal("incorrect");
719
+ });
720
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
721
+
722
+ cy.window().then(async (win) => {
723
+ let stateVariables = await win.returnAllStateVariables1();
724
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
725
+ });
726
+
727
+ cy.log("Move near correct point");
728
+ cy.window().then(async (win) => {
729
+ await win.callAction1({
730
+ actionName: "movePoint",
731
+ componentName: "/A",
732
+ args: { x: -5, y: 7 },
733
+ });
734
+ let stateVariables = await win.returnAllStateVariables1();
735
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
736
+ });
737
+
738
+ cy.get(cesc("#\\/_answer1_submit"))
739
+ .invoke("text")
740
+ .then((text) => {
741
+ expect(text.trim().toLowerCase()).equal("check work");
742
+ });
743
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
744
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
745
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
746
+
747
+ cy.log("Submit answer");
748
+ cy.get(cesc("#\\/_answer1_submit")).click();
749
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
750
+ cy.get(cesc("#\\/_answer1_correct"))
751
+ .invoke("text")
752
+ .then((text) => {
753
+ expect(text.trim().toLowerCase()).equal("correct");
754
+ });
755
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
756
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
757
+
758
+ cy.window().then(async (win) => {
759
+ let stateVariables = await win.returnAllStateVariables1();
760
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
761
+ });
762
+
763
+ cy.log("change criterion");
764
+ cy.get(cesc("#\\/criterion") + " textarea")
765
+ .type("{ctrl+home}{shift+end}{backspace}1", { force: true })
766
+ .blur();
767
+ cy.get(cesc("#\\/_answer1_submit"))
768
+ .invoke("text")
769
+ .then((text) => {
770
+ expect(text.trim().toLowerCase()).equal("check work");
771
+ });
772
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
773
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
774
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
775
+
776
+ cy.window().then(async (win) => {
777
+ let stateVariables = await win.returnAllStateVariables1();
778
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
779
+ });
780
+
781
+ cy.log("Resubmit answer");
782
+ cy.get(cesc("#\\/_answer1_submit")).click();
783
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
784
+ cy.get(cesc("#\\/_answer1_correct"))
785
+ .invoke("text")
786
+ .then((text) => {
787
+ expect(text.trim().toLowerCase()).equal("correct");
788
+ });
789
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
790
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
791
+
792
+ cy.window().then(async (win) => {
793
+ let stateVariables = await win.returnAllStateVariables1();
794
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
795
+ });
796
+
797
+ cy.log("Move point further away and submit");
798
+ cy.window().then(async (win) => {
799
+ await win.callAction1({
800
+ actionName: "movePoint",
801
+ componentName: "/A",
802
+ args: { x: -2.8, y: 9 },
803
+ });
804
+ let stateVariables = await win.returnAllStateVariables1();
805
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
806
+ });
807
+ cy.get(cesc("#\\/_answer1_submit"))
808
+ .invoke("text")
809
+ .then((text) => {
810
+ expect(text.trim().toLowerCase()).equal("check work");
811
+ });
812
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
813
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
814
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
815
+
816
+ cy.get(cesc("#\\/_answer1_submit")).click();
817
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
818
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
819
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
820
+ cy.get(cesc("#\\/_answer1_partial"))
821
+ .invoke("text")
822
+ .then((text) => {
823
+ expect(text.trim().toLowerCase()).equal("60% correct");
824
+ });
825
+
826
+ cy.window().then(async (win) => {
827
+ let stateVariables = await win.returnAllStateVariables1();
828
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.6);
829
+ });
830
+
831
+ cy.log("change partial criterion");
832
+ cy.get(cesc("#\\/partialcriterion") + " textarea")
833
+ .type("{ctrl+home}{shift+end}{backspace}2", { force: true })
834
+ .blur();
835
+ cy.get(cesc("#\\/_answer1_submit"))
836
+ .invoke("text")
837
+ .then((text) => {
838
+ expect(text.trim().toLowerCase()).equal("check work");
839
+ });
840
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
841
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
842
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
843
+
844
+ cy.window().then(async (win) => {
845
+ let stateVariables = await win.returnAllStateVariables1();
846
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.6);
847
+ });
848
+
849
+ cy.log("Resubmit answer");
850
+ cy.get(cesc("#\\/_answer1_submit")).click();
851
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
852
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
853
+ cy.get(cesc("#\\/_answer1_incorrect"))
854
+ .invoke("text")
855
+ .then((text) => {
856
+ expect(text.trim().toLowerCase()).equal("incorrect");
857
+ });
858
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
859
+
860
+ cy.window().then(async (win) => {
861
+ let stateVariables = await win.returnAllStateVariables1();
862
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
863
+ });
864
+
865
+ cy.log("Move point closer again and submit");
866
+ cy.window().then(async (win) => {
867
+ await win.callAction1({
868
+ actionName: "movePoint",
869
+ componentName: "/A",
870
+ args: { x: -3, y: 9 },
871
+ });
872
+ let stateVariables = await win.returnAllStateVariables1();
873
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
874
+ });
875
+ cy.get(cesc("#\\/_answer1_submit"))
876
+ .invoke("text")
877
+ .then((text) => {
878
+ expect(text.trim().toLowerCase()).equal("check work");
879
+ });
880
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
881
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
882
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
883
+
884
+ cy.get(cesc("#\\/_answer1_submit")).click();
885
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
886
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
887
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
888
+ cy.get(cesc("#\\/_answer1_partial"))
889
+ .invoke("text")
890
+ .then((text) => {
891
+ expect(text.trim().toLowerCase()).equal("60% correct");
892
+ });
893
+
894
+ cy.window().then(async (win) => {
895
+ let stateVariables = await win.returnAllStateVariables1();
896
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.6);
897
+ });
898
+
899
+ cy.log("Move point even closer and submit");
900
+ cy.window().then(async (win) => {
901
+ await win.callAction1({
902
+ actionName: "movePoint",
903
+ componentName: "/A",
904
+ args: { x: -3.5, y: 8 },
905
+ });
906
+ let stateVariables = await win.returnAllStateVariables1();
907
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.6);
908
+ });
909
+ cy.get(cesc("#\\/_answer1_submit"))
910
+ .invoke("text")
911
+ .then((text) => {
912
+ expect(text.trim().toLowerCase()).equal("check work");
913
+ });
914
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
915
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
916
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
917
+
918
+ cy.get(cesc("#\\/_answer1_submit")).click();
919
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
920
+ cy.get(cesc("#\\/_answer1_correct"))
921
+ .invoke("text")
922
+ .then((text) => {
923
+ expect(text.trim().toLowerCase()).equal("correct");
924
+ });
925
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
926
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
927
+
928
+ cy.window().then(async (win) => {
929
+ let stateVariables = await win.returnAllStateVariables1();
930
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
931
+ });
932
+ });
933
+
934
+ it("two points at precise locations, partial match", () => {
935
+ cy.window().then(async (win) => {
936
+ win.postMessage(
937
+ {
938
+ doenetML: `
939
+ <text>a</text>
940
+ <point name="goal1">(-4.1, 7.4)</point>
941
+ <point name="goal2">(6.8, 9.1)</point>
942
+ <p>Move points to <copy prop="coords" target="goal1" /> <copy prop="coords" target="goal2" /></p>
943
+ <graph>
944
+ <point name="A" x="4.9" y="-1.1">
945
+ <constraints>
946
+ <attractTo><copy target="goal1" /></attractTo>
947
+ <attractTo><copy target="goal2" /></attractTo>
948
+ </constraints>
949
+ </point>
950
+ <point name="B" x="-2.3" y="-3.4">
951
+ <constraints>
952
+ <attractTo><copy target="goal1" /></attractTo>
953
+ <attractTo><copy target="goal2" /></attractTo>
954
+ </constraints>
955
+ </point>
956
+ </graph>
957
+ <p><answer>
958
+ <award matchPartial unorderedCompare sourcesAreResponses="A B">
959
+ <when>
960
+ ($A, $B) = ($goal1, $goal2)
961
+ </when>
962
+ </award>
963
+ </answer></p>
964
+ <p>Credit for answer: <copy prop="creditAchieved" target="_answer1" assignNames="ca" /></p>
965
+ <p>Submitted responses: <math name="srs"><copy prop="submittedResponses" target="_answer1" /></math></p>
966
+ `,
967
+ },
968
+ "*",
969
+ );
970
+ });
971
+
972
+ cy.get(cesc("#\\/_text1")).should("have.text", "a"); // to wait for page to load
973
+
974
+ cy.get(cesc("#\\/goal1") + " .mjx-mrow").should(
975
+ "contain.text",
976
+ "(−4.1,7.4)",
977
+ );
978
+
979
+ cy.get(cesc("#\\/_answer1_submit"))
980
+ .invoke("text")
981
+ .then((text) => {
982
+ expect(text.trim().toLowerCase()).equal("check work");
983
+ });
984
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
985
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
986
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
987
+
988
+ cy.log("Submit answer");
989
+ cy.get(cesc("#\\/_answer1_submit")).click();
990
+ cy.get(cesc(`#\\/srs`) + ` .mjx-mrow`).should(
991
+ "contain.text",
992
+ "((4.9,−1.1),(−2.3,−3.4))",
993
+ );
994
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
995
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
996
+ cy.get(cesc("#\\/_answer1_incorrect"))
997
+ .invoke("text")
998
+ .then((text) => {
999
+ expect(text.trim().toLowerCase()).equal("incorrect");
1000
+ });
1001
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
1002
+ cy.get(cesc("#\\/ca")).should("have.text", 0);
1003
+ cy.get(cesc(`#\\/srs`))
1004
+ .find(".mjx-mrow")
1005
+ .eq(0)
1006
+ .invoke("text")
1007
+ .then((text) => {
1008
+ expect(text.trim().replace(/−/g, "-")).equal(
1009
+ "((4.9,-1.1),(-2.3,-3.4))",
1010
+ );
1011
+ });
1012
+
1013
+ cy.window().then(async (win) => {
1014
+ let stateVariables = await win.returnAllStateVariables1();
1015
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
1016
+ });
1017
+
1018
+ cy.log("Move A near correct point");
1019
+ cy.window().then(async (win) => {
1020
+ await win.callAction1({
1021
+ actionName: "movePoint",
1022
+ componentName: "/A",
1023
+ args: { x: -4, y: 7.6 },
1024
+ });
1025
+ let stateVariables = await win.returnAllStateVariables1();
1026
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
1027
+ });
1028
+
1029
+ cy.get(cesc("#\\/_answer1_submit"))
1030
+ .invoke("text")
1031
+ .then((text) => {
1032
+ expect(text.trim().toLowerCase()).equal("check work");
1033
+ });
1034
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
1035
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
1036
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
1037
+
1038
+ cy.log("Submit answer");
1039
+ cy.get(cesc("#\\/_answer1_submit")).click();
1040
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
1041
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
1042
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
1043
+ cy.get(cesc("#\\/_answer1_partial"))
1044
+ .invoke("text")
1045
+ .then((text) => {
1046
+ expect(text.trim().toLowerCase()).equal("50% correct");
1047
+ });
1048
+ cy.get(cesc("#\\/ca")).should("have.text", 0.5);
1049
+ cy.get(cesc(`#\\/srs`))
1050
+ .find(".mjx-mrow")
1051
+ .eq(0)
1052
+ .invoke("text")
1053
+ .then((text) => {
1054
+ expect(text.trim().replace(/−/g, "-")).equal(
1055
+ "((-4.1,7.4),(-2.3,-3.4))",
1056
+ );
1057
+ });
1058
+
1059
+ cy.window().then(async (win) => {
1060
+ let stateVariables = await win.returnAllStateVariables1();
1061
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
1062
+ });
1063
+
1064
+ cy.log("Move point A further away and submit");
1065
+ cy.window().then(async (win) => {
1066
+ await win.callAction1({
1067
+ actionName: "movePoint",
1068
+ componentName: "/A",
1069
+ args: { x: -3.7, y: 7 },
1070
+ });
1071
+ let stateVariables = await win.returnAllStateVariables1();
1072
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
1073
+ });
1074
+
1075
+ cy.get(cesc("#\\/_answer1_submit"))
1076
+ .invoke("text")
1077
+ .then((text) => {
1078
+ expect(text.trim().toLowerCase()).equal("check work");
1079
+ });
1080
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
1081
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
1082
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
1083
+
1084
+ cy.get(cesc("#\\/_answer1_submit")).click();
1085
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
1086
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
1087
+ cy.get(cesc("#\\/_answer1_incorrect"))
1088
+ .invoke("text")
1089
+ .then((text) => {
1090
+ expect(text.trim().toLowerCase()).equal("incorrect");
1091
+ });
1092
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
1093
+ cy.get(cesc("#\\/ca")).should("have.text", 0.0);
1094
+ cy.get(cesc(`#\\/srs`))
1095
+ .find(".mjx-mrow")
1096
+ .eq(0)
1097
+ .invoke("text")
1098
+ .then((text) => {
1099
+ expect(text.trim().replace(/−/g, "-")).equal("((-3.7,7),(-2.3,-3.4))");
1100
+ });
1101
+ cy.window().then(async (win) => {
1102
+ let stateVariables = await win.returnAllStateVariables1();
1103
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
1104
+ });
1105
+
1106
+ cy.log("Move point B close and submit");
1107
+ cy.window().then(async (win) => {
1108
+ await win.callAction1({
1109
+ actionName: "movePoint",
1110
+ componentName: "/B",
1111
+ args: { x: -3.8, y: 7.1 },
1112
+ });
1113
+ let stateVariables = await win.returnAllStateVariables1();
1114
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
1115
+ });
1116
+
1117
+ cy.get(cesc("#\\/_answer1_submit"))
1118
+ .invoke("text")
1119
+ .then((text) => {
1120
+ expect(text.trim().toLowerCase()).equal("check work");
1121
+ });
1122
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
1123
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
1124
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
1125
+
1126
+ cy.log("Submit answer");
1127
+ cy.get(cesc("#\\/_answer1_submit")).click();
1128
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
1129
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
1130
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
1131
+ cy.get(cesc("#\\/_answer1_partial"))
1132
+ .invoke("text")
1133
+ .then((text) => {
1134
+ expect(text.trim().toLowerCase()).equal("50% correct");
1135
+ });
1136
+ cy.get(cesc("#\\/ca")).should("have.text", 0.5);
1137
+ cy.get(cesc(`#\\/srs`))
1138
+ .find(".mjx-mrow")
1139
+ .eq(0)
1140
+ .invoke("text")
1141
+ .then((text) => {
1142
+ expect(text.trim().replace(/−/g, "-")).equal("((-3.7,7),(-4.1,7.4))");
1143
+ });
1144
+
1145
+ cy.window().then(async (win) => {
1146
+ let stateVariables = await win.returnAllStateVariables1();
1147
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
1148
+ });
1149
+
1150
+ cy.log("Move point A close to other goal and submit");
1151
+ cy.window().then(async (win) => {
1152
+ await win.callAction1({
1153
+ actionName: "movePoint",
1154
+ componentName: "/A",
1155
+ args: { x: 6.9, y: 9.0 },
1156
+ });
1157
+ let stateVariables = await win.returnAllStateVariables1();
1158
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
1159
+ });
1160
+
1161
+ cy.get(cesc("#\\/_answer1_submit"))
1162
+ .invoke("text")
1163
+ .then((text) => {
1164
+ expect(text.trim().toLowerCase()).equal("check work");
1165
+ });
1166
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
1167
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
1168
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
1169
+
1170
+ cy.log("Submit answer");
1171
+ cy.get(cesc("#\\/_answer1_submit")).click();
1172
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
1173
+ cy.get(cesc("#\\/_answer1_correct"))
1174
+ .invoke("text")
1175
+ .then((text) => {
1176
+ expect(text.trim().toLowerCase()).equal("correct");
1177
+ });
1178
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
1179
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
1180
+
1181
+ cy.get(cesc("#\\/ca")).should("have.text", 1);
1182
+ cy.get(cesc(`#\\/srs`))
1183
+ .find(".mjx-mrow")
1184
+ .eq(0)
1185
+ .invoke("text")
1186
+ .then((text) => {
1187
+ expect(text.trim().replace(/−/g, "-")).equal("((6.8,9.1),(-4.1,7.4))");
1188
+ });
1189
+
1190
+ cy.window().then(async (win) => {
1191
+ let stateVariables = await win.returnAllStateVariables1();
1192
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
1193
+ });
1194
+
1195
+ cy.log("Move point B away and submit");
1196
+ cy.window().then(async (win) => {
1197
+ await win.callAction1({
1198
+ actionName: "movePoint",
1199
+ componentName: "/B",
1200
+ args: { x: -9.9, y: -8.8 },
1201
+ });
1202
+ let stateVariables = await win.returnAllStateVariables1();
1203
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
1204
+ });
1205
+
1206
+ cy.get(cesc("#\\/_answer1_submit"))
1207
+ .invoke("text")
1208
+ .then((text) => {
1209
+ expect(text.trim().toLowerCase()).equal("check work");
1210
+ });
1211
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
1212
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
1213
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
1214
+
1215
+ cy.log("Submit answer");
1216
+ cy.get(cesc("#\\/_answer1_submit")).click();
1217
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
1218
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
1219
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
1220
+ cy.get(cesc("#\\/_answer1_partial"))
1221
+ .invoke("text")
1222
+ .then((text) => {
1223
+ expect(text.trim().toLowerCase()).equal("50% correct");
1224
+ });
1225
+ cy.get(cesc("#\\/ca")).should("have.text", 0.5);
1226
+ cy.get(cesc(`#\\/srs`))
1227
+ .find(".mjx-mrow")
1228
+ .eq(0)
1229
+ .invoke("text")
1230
+ .then((text) => {
1231
+ expect(text.trim().replace(/−/g, "-")).equal("((6.8,9.1),(-9.9,-8.8))");
1232
+ });
1233
+
1234
+ cy.window().then(async (win) => {
1235
+ let stateVariables = await win.returnAllStateVariables1();
1236
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
1237
+ });
1238
+
1239
+ cy.log("Move point B close to second goal and submit");
1240
+ cy.window().then(async (win) => {
1241
+ await win.callAction1({
1242
+ actionName: "movePoint",
1243
+ componentName: "/B",
1244
+ args: { x: 6.7, y: 9 },
1245
+ });
1246
+ let stateVariables = await win.returnAllStateVariables1();
1247
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
1248
+ });
1249
+
1250
+ cy.get(cesc("#\\/_answer1_submit"))
1251
+ .invoke("text")
1252
+ .then((text) => {
1253
+ expect(text.trim().toLowerCase()).equal("check work");
1254
+ });
1255
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
1256
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
1257
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
1258
+
1259
+ cy.log("Submit answer");
1260
+ cy.get(cesc("#\\/_answer1_submit")).click();
1261
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
1262
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
1263
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
1264
+ cy.get(cesc("#\\/_answer1_partial"))
1265
+ .invoke("text")
1266
+ .then((text) => {
1267
+ expect(text.trim().toLowerCase()).equal("50% correct");
1268
+ });
1269
+ cy.get(cesc("#\\/ca")).should("have.text", 0.5);
1270
+ cy.get(cesc(`#\\/srs`))
1271
+ .find(".mjx-mrow")
1272
+ .eq(0)
1273
+ .invoke("text")
1274
+ .then((text) => {
1275
+ expect(text.trim().replace(/−/g, "-")).equal("((6.8,9.1),(6.8,9.1))");
1276
+ });
1277
+
1278
+ cy.window().then(async (win) => {
1279
+ let stateVariables = await win.returnAllStateVariables1();
1280
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
1281
+ });
1282
+
1283
+ cy.log("Move point A away and submit");
1284
+ cy.window().then(async (win) => {
1285
+ await win.callAction1({
1286
+ actionName: "movePoint",
1287
+ componentName: "/A",
1288
+ args: { x: 0.1, y: -1.1 },
1289
+ });
1290
+ let stateVariables = await win.returnAllStateVariables1();
1291
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
1292
+ });
1293
+
1294
+ cy.get(cesc("#\\/_answer1_submit"))
1295
+ .invoke("text")
1296
+ .then((text) => {
1297
+ expect(text.trim().toLowerCase()).equal("check work");
1298
+ });
1299
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
1300
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
1301
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
1302
+
1303
+ cy.log("Submit answer");
1304
+ cy.get(cesc("#\\/_answer1_submit")).click();
1305
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
1306
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
1307
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
1308
+ cy.get(cesc("#\\/_answer1_partial"))
1309
+ .invoke("text")
1310
+ .then((text) => {
1311
+ expect(text.trim().toLowerCase()).equal("50% correct");
1312
+ });
1313
+ cy.get(cesc("#\\/ca")).should("have.text", 0.5);
1314
+ cy.get(cesc(`#\\/srs`))
1315
+ .find(".mjx-mrow")
1316
+ .eq(0)
1317
+ .invoke("text")
1318
+ .then((text) => {
1319
+ expect(text.trim().replace(/−/g, "-")).equal("((0.1,-1.1),(6.8,9.1))");
1320
+ });
1321
+
1322
+ cy.window().then(async (win) => {
1323
+ let stateVariables = await win.returnAllStateVariables1();
1324
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
1325
+ });
1326
+
1327
+ cy.log("Move point A near first goal and submit");
1328
+ cy.window().then(async (win) => {
1329
+ await win.callAction1({
1330
+ actionName: "movePoint",
1331
+ componentName: "/A",
1332
+ args: { x: -3.8, y: 7.6 },
1333
+ });
1334
+ let stateVariables = await win.returnAllStateVariables1();
1335
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
1336
+ });
1337
+
1338
+ cy.get(cesc("#\\/_answer1_submit"))
1339
+ .invoke("text")
1340
+ .then((text) => {
1341
+ expect(text.trim().toLowerCase()).equal("check work");
1342
+ });
1343
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
1344
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
1345
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
1346
+
1347
+ cy.log("Submit answer");
1348
+ cy.get(cesc("#\\/_answer1_submit")).click();
1349
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
1350
+ cy.get(cesc("#\\/_answer1_correct"))
1351
+ .invoke("text")
1352
+ .then((text) => {
1353
+ expect(text.trim().toLowerCase()).equal("correct");
1354
+ });
1355
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
1356
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
1357
+ cy.get(cesc("#\\/ca")).should("have.text", 1);
1358
+ cy.get(cesc(`#\\/srs`))
1359
+ .find(".mjx-mrow")
1360
+ .eq(0)
1361
+ .invoke("text")
1362
+ .then((text) => {
1363
+ expect(text.trim().replace(/−/g, "-")).equal("((-4.1,7.4),(6.8,9.1))");
1364
+ });
1365
+
1366
+ cy.window().then(async (win) => {
1367
+ let stateVariables = await win.returnAllStateVariables1();
1368
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
1369
+ });
1370
+ });
1371
+
1372
+ it("two points at precise locations, partial match, ordered", () => {
1373
+ cy.window().then(async (win) => {
1374
+ win.postMessage(
1375
+ {
1376
+ doenetML: `
1377
+ <text>a</text>
1378
+ <point name="goal1">(-4.1, 7.4)</point>
1379
+ <point name="goal2">(6.8, 9.1)</point>
1380
+ <p>Move points to <copy prop="coords" target="goal1" /> <copy prop="coords" target="goal2" /></p>
1381
+ <graph>
1382
+ <point name="A" x="4.9" y="-1.1">
1383
+ <constraints>
1384
+ <attractTo><copy target="goal1" /></attractTo>
1385
+ <attractTo><copy target="goal2" /></attractTo>
1386
+ </constraints>
1387
+ </point>
1388
+ <point name="B" x="-2.3" y="-3.4">
1389
+ <constraints>
1390
+ <attractTo><copy target="goal1" /></attractTo>
1391
+ <attractTo><copy target="goal2" /></attractTo>
1392
+ </constraints>
1393
+ </point>
1394
+ </graph>
1395
+ <p><answer>
1396
+ <award matchPartial sourcesAreResponses="A B">
1397
+ <when>
1398
+ ($A, $B) = ($goal1, $goal2)
1399
+ </when>
1400
+ </award>
1401
+ </answer></p>
1402
+ <p>Credit for answer: <copy prop="creditAchieved" target="_answer1" assignNames="ca" /></p>
1403
+ <p>Submitted responses: <math name="srs"><copy prop="submittedResponses" target="_answer1" /></math></p>
1404
+ `,
1405
+ },
1406
+ "*",
1407
+ );
1408
+ });
1409
+
1410
+ cy.get(cesc("#\\/_text1")).should("have.text", "a"); // to wait for page to load
1411
+
1412
+ cy.get(cesc(`#\\/goal1`))
1413
+ .find(".mjx-mrow")
1414
+ .eq(0)
1415
+ .invoke("text")
1416
+ .then((text) => {
1417
+ expect(text.trim().replace(/−/g, "-")).equal("(-4.1,7.4)");
1418
+ });
1419
+ cy.get(cesc(`#\\/goal2`))
1420
+ .find(".mjx-mrow")
1421
+ .eq(0)
1422
+ .invoke("text")
1423
+ .then((text) => {
1424
+ expect(text.trim().replace(/−/g, "-")).equal("(6.8,9.1)");
1425
+ });
1426
+
1427
+ cy.get(cesc("#\\/_answer1_submit"))
1428
+ .invoke("text")
1429
+ .then((text) => {
1430
+ expect(text.trim().toLowerCase()).equal("check work");
1431
+ });
1432
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
1433
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
1434
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
1435
+
1436
+ cy.log("Submit answer");
1437
+ cy.get(cesc("#\\/_answer1_submit")).click();
1438
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
1439
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
1440
+ cy.get(cesc("#\\/_answer1_incorrect"))
1441
+ .invoke("text")
1442
+ .then((text) => {
1443
+ expect(text.trim().toLowerCase()).equal("incorrect");
1444
+ });
1445
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
1446
+ cy.get(cesc("#\\/ca")).should("have.text", 0);
1447
+ cy.get(cesc(`#\\/srs`))
1448
+ .find(".mjx-mrow")
1449
+ .eq(0)
1450
+ .invoke("text")
1451
+ .then((text) => {
1452
+ expect(text.trim().replace(/−/g, "-")).equal(
1453
+ "((4.9,-1.1),(-2.3,-3.4))",
1454
+ );
1455
+ });
1456
+
1457
+ cy.window().then(async (win) => {
1458
+ let stateVariables = await win.returnAllStateVariables1();
1459
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
1460
+ });
1461
+
1462
+ cy.log("Move A near correct point");
1463
+ cy.window().then(async (win) => {
1464
+ await win.callAction1({
1465
+ actionName: "movePoint",
1466
+ componentName: "/A",
1467
+ args: { x: -4, y: 7.6 },
1468
+ });
1469
+ let stateVariables = await win.returnAllStateVariables1();
1470
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
1471
+ });
1472
+
1473
+ cy.get(cesc("#\\/_answer1_submit"))
1474
+ .invoke("text")
1475
+ .then((text) => {
1476
+ expect(text.trim().toLowerCase()).equal("check work");
1477
+ });
1478
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
1479
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
1480
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
1481
+
1482
+ cy.log("Submit answer");
1483
+ cy.get(cesc("#\\/_answer1_submit")).click();
1484
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
1485
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
1486
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
1487
+ cy.get(cesc("#\\/_answer1_partial"))
1488
+ .invoke("text")
1489
+ .then((text) => {
1490
+ expect(text.trim().toLowerCase()).equal("50% correct");
1491
+ });
1492
+ cy.get(cesc("#\\/ca")).should("have.text", 0.5);
1493
+ cy.get(cesc(`#\\/srs`))
1494
+ .find(".mjx-mrow")
1495
+ .eq(0)
1496
+ .invoke("text")
1497
+ .then((text) => {
1498
+ expect(text.trim().replace(/−/g, "-")).equal(
1499
+ "((-4.1,7.4),(-2.3,-3.4))",
1500
+ );
1501
+ });
1502
+
1503
+ cy.window().then(async (win) => {
1504
+ let stateVariables = await win.returnAllStateVariables1();
1505
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
1506
+ });
1507
+
1508
+ cy.log("Move point A further away and submit");
1509
+ cy.window().then(async (win) => {
1510
+ await win.callAction1({
1511
+ actionName: "movePoint",
1512
+ componentName: "/A",
1513
+ args: { x: -3.7, y: 7 },
1514
+ });
1515
+ let stateVariables = await win.returnAllStateVariables1();
1516
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
1517
+ });
1518
+
1519
+ cy.get(cesc("#\\/_answer1_submit"))
1520
+ .invoke("text")
1521
+ .then((text) => {
1522
+ expect(text.trim().toLowerCase()).equal("check work");
1523
+ });
1524
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
1525
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
1526
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
1527
+
1528
+ cy.get(cesc("#\\/_answer1_submit")).click();
1529
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
1530
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
1531
+ cy.get(cesc("#\\/_answer1_incorrect"))
1532
+ .invoke("text")
1533
+ .then((text) => {
1534
+ expect(text.trim().toLowerCase()).equal("incorrect");
1535
+ });
1536
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
1537
+ cy.get(cesc("#\\/ca")).should("have.text", 0.0);
1538
+ cy.get(cesc(`#\\/srs`))
1539
+ .find(".mjx-mrow")
1540
+ .eq(0)
1541
+ .invoke("text")
1542
+ .then((text) => {
1543
+ expect(text.trim().replace(/−/g, "-")).equal("((-3.7,7),(-2.3,-3.4))");
1544
+ });
1545
+ cy.window().then(async (win) => {
1546
+ let stateVariables = await win.returnAllStateVariables1();
1547
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
1548
+ });
1549
+
1550
+ cy.log("Move point B close and submit");
1551
+ cy.window().then(async (win) => {
1552
+ await win.callAction1({
1553
+ actionName: "movePoint",
1554
+ componentName: "/B",
1555
+ args: { x: -3.8, y: 7.1 },
1556
+ });
1557
+ let stateVariables = await win.returnAllStateVariables1();
1558
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
1559
+ });
1560
+
1561
+ cy.get(cesc("#\\/_answer1_submit"))
1562
+ .invoke("text")
1563
+ .then((text) => {
1564
+ expect(text.trim().toLowerCase()).equal("check work");
1565
+ });
1566
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
1567
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
1568
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
1569
+
1570
+ cy.log("Submit answer");
1571
+ cy.get(cesc("#\\/_answer1_submit")).click();
1572
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
1573
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
1574
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
1575
+ cy.get(cesc("#\\/_answer1_partial"))
1576
+ .invoke("text")
1577
+ .then((text) => {
1578
+ expect(text.trim().toLowerCase()).equal("50% correct");
1579
+ });
1580
+ cy.get(cesc("#\\/ca")).should("have.text", 0.5);
1581
+ cy.get(cesc(`#\\/srs`))
1582
+ .find(".mjx-mrow")
1583
+ .eq(0)
1584
+ .invoke("text")
1585
+ .then((text) => {
1586
+ expect(text.trim().replace(/−/g, "-")).equal("((-3.7,7),(-4.1,7.4))");
1587
+ });
1588
+
1589
+ cy.window().then(async (win) => {
1590
+ let stateVariables = await win.returnAllStateVariables1();
1591
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
1592
+ });
1593
+
1594
+ cy.log("Move point A close to other goal and submit");
1595
+ cy.window().then(async (win) => {
1596
+ await win.callAction1({
1597
+ actionName: "movePoint",
1598
+ componentName: "/A",
1599
+ args: { x: 6.9, y: 9.0 },
1600
+ });
1601
+ let stateVariables = await win.returnAllStateVariables1();
1602
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
1603
+ });
1604
+
1605
+ cy.get(cesc("#\\/_answer1_submit"))
1606
+ .invoke("text")
1607
+ .then((text) => {
1608
+ expect(text.trim().toLowerCase()).equal("check work");
1609
+ });
1610
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
1611
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
1612
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
1613
+
1614
+ cy.log("Submit answer");
1615
+ cy.get(cesc("#\\/_answer1_submit")).click();
1616
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
1617
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
1618
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
1619
+ cy.get(cesc("#\\/_answer1_partial"))
1620
+ .invoke("text")
1621
+ .then((text) => {
1622
+ expect(text.trim().toLowerCase()).equal("50% correct");
1623
+ });
1624
+
1625
+ cy.get(cesc("#\\/ca")).should("have.text", 0.5);
1626
+ cy.get(cesc(`#\\/srs`))
1627
+ .find(".mjx-mrow")
1628
+ .eq(0)
1629
+ .invoke("text")
1630
+ .then((text) => {
1631
+ expect(text.trim().replace(/−/g, "-")).equal("((6.8,9.1),(-4.1,7.4))");
1632
+ });
1633
+
1634
+ cy.window().then(async (win) => {
1635
+ let stateVariables = await win.returnAllStateVariables1();
1636
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
1637
+ });
1638
+
1639
+ cy.log("Move point B away and submit");
1640
+ cy.window().then(async (win) => {
1641
+ await win.callAction1({
1642
+ actionName: "movePoint",
1643
+ componentName: "/B",
1644
+ args: { x: -9.9, y: -8.8 },
1645
+ });
1646
+ let stateVariables = await win.returnAllStateVariables1();
1647
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
1648
+ });
1649
+
1650
+ cy.get(cesc("#\\/_answer1_submit"))
1651
+ .invoke("text")
1652
+ .then((text) => {
1653
+ expect(text.trim().toLowerCase()).equal("check work");
1654
+ });
1655
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
1656
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
1657
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
1658
+
1659
+ cy.log("Submit answer");
1660
+ cy.get(cesc("#\\/_answer1_submit")).click();
1661
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
1662
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
1663
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
1664
+ cy.get(cesc("#\\/_answer1_partial"))
1665
+ .invoke("text")
1666
+ .then((text) => {
1667
+ expect(text.trim().toLowerCase()).equal("50% correct");
1668
+ });
1669
+ cy.get(cesc("#\\/ca")).should("have.text", 0.5);
1670
+ cy.get(cesc(`#\\/srs`))
1671
+ .find(".mjx-mrow")
1672
+ .eq(0)
1673
+ .invoke("text")
1674
+ .then((text) => {
1675
+ expect(text.trim().replace(/−/g, "-")).equal("((6.8,9.1),(-9.9,-8.8))");
1676
+ });
1677
+
1678
+ cy.window().then(async (win) => {
1679
+ let stateVariables = await win.returnAllStateVariables1();
1680
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
1681
+ });
1682
+
1683
+ cy.log("Move point B close to second goal and submit");
1684
+ cy.window().then(async (win) => {
1685
+ await win.callAction1({
1686
+ actionName: "movePoint",
1687
+ componentName: "/B",
1688
+ args: { x: 6.7, y: 9 },
1689
+ });
1690
+ let stateVariables = await win.returnAllStateVariables1();
1691
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
1692
+ });
1693
+
1694
+ cy.get(cesc("#\\/_answer1_submit"))
1695
+ .invoke("text")
1696
+ .then((text) => {
1697
+ expect(text.trim().toLowerCase()).equal("check work");
1698
+ });
1699
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
1700
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
1701
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
1702
+
1703
+ cy.log("Submit answer");
1704
+ cy.get(cesc("#\\/_answer1_submit")).click();
1705
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
1706
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
1707
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
1708
+ cy.get(cesc("#\\/_answer1_partial"))
1709
+ .invoke("text")
1710
+ .then((text) => {
1711
+ expect(text.trim().toLowerCase()).equal("50% correct");
1712
+ });
1713
+ cy.get(cesc("#\\/ca")).should("have.text", 0.5);
1714
+ cy.get(cesc(`#\\/srs`))
1715
+ .find(".mjx-mrow")
1716
+ .eq(0)
1717
+ .invoke("text")
1718
+ .then((text) => {
1719
+ expect(text.trim().replace(/−/g, "-")).equal("((6.8,9.1),(6.8,9.1))");
1720
+ });
1721
+
1722
+ cy.window().then(async (win) => {
1723
+ let stateVariables = await win.returnAllStateVariables1();
1724
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
1725
+ });
1726
+
1727
+ cy.log("Move point A away and submit");
1728
+ cy.window().then(async (win) => {
1729
+ await win.callAction1({
1730
+ actionName: "movePoint",
1731
+ componentName: "/A",
1732
+ args: { x: 0.1, y: -1.1 },
1733
+ });
1734
+ let stateVariables = await win.returnAllStateVariables1();
1735
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
1736
+ });
1737
+
1738
+ cy.get(cesc("#\\/_answer1_submit"))
1739
+ .invoke("text")
1740
+ .then((text) => {
1741
+ expect(text.trim().toLowerCase()).equal("check work");
1742
+ });
1743
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
1744
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
1745
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
1746
+
1747
+ cy.log("Submit answer");
1748
+ cy.get(cesc("#\\/_answer1_submit")).click();
1749
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
1750
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
1751
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
1752
+ cy.get(cesc("#\\/_answer1_partial"))
1753
+ .invoke("text")
1754
+ .then((text) => {
1755
+ expect(text.trim().toLowerCase()).equal("50% correct");
1756
+ });
1757
+ cy.get(cesc("#\\/ca")).should("have.text", 0.5);
1758
+ cy.get(cesc(`#\\/srs`))
1759
+ .find(".mjx-mrow")
1760
+ .eq(0)
1761
+ .invoke("text")
1762
+ .then((text) => {
1763
+ expect(text.trim().replace(/−/g, "-")).equal("((0.1,-1.1),(6.8,9.1))");
1764
+ });
1765
+
1766
+ cy.window().then(async (win) => {
1767
+ let stateVariables = await win.returnAllStateVariables1();
1768
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
1769
+ });
1770
+
1771
+ cy.log("Move point A near first goal and submit");
1772
+ cy.window().then(async (win) => {
1773
+ await win.callAction1({
1774
+ actionName: "movePoint",
1775
+ componentName: "/A",
1776
+ args: { x: -3.8, y: 7.6 },
1777
+ });
1778
+ let stateVariables = await win.returnAllStateVariables1();
1779
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
1780
+ });
1781
+
1782
+ cy.get(cesc("#\\/_answer1_submit"))
1783
+ .invoke("text")
1784
+ .then((text) => {
1785
+ expect(text.trim().toLowerCase()).equal("check work");
1786
+ });
1787
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
1788
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
1789
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
1790
+
1791
+ cy.log("Submit answer");
1792
+ cy.get(cesc("#\\/_answer1_submit")).click();
1793
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
1794
+ cy.get(cesc("#\\/_answer1_correct"))
1795
+ .invoke("text")
1796
+ .then((text) => {
1797
+ expect(text.trim().toLowerCase()).equal("correct");
1798
+ });
1799
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
1800
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
1801
+ cy.get(cesc("#\\/ca")).should("have.text", 1);
1802
+ cy.get(cesc(`#\\/srs`))
1803
+ .find(".mjx-mrow")
1804
+ .eq(0)
1805
+ .invoke("text")
1806
+ .then((text) => {
1807
+ expect(text.trim().replace(/−/g, "-")).equal("((-4.1,7.4),(6.8,9.1))");
1808
+ });
1809
+
1810
+ cy.window().then(async (win) => {
1811
+ let stateVariables = await win.returnAllStateVariables1();
1812
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
1813
+ });
1814
+ });
1815
+
1816
+ it("two points at precise locations, award based as string literals, partial match", () => {
1817
+ cy.window().then(async (win) => {
1818
+ win.postMessage(
1819
+ {
1820
+ doenetML: `
1821
+ <text>a</text>
1822
+ <point name="goal1">(-4.1, 7.4)</point>
1823
+ <point name="goal2">(6.8, 9.1)</point>
1824
+ <p>Move points to <copy prop="coords" target="goal1" /> <copy prop="coords" target="goal2" /></p>
1825
+ <graph>
1826
+ <point name="A" x="4.9" y="-1.1">
1827
+ <constraints>
1828
+ <attractTo><copy target="goal1" /></attractTo>
1829
+ <attractTo><copy target="goal2" /></attractTo>
1830
+ </constraints>
1831
+ </point>
1832
+ <point name="B" x="-2.3" y="-3.4">
1833
+ <constraints>
1834
+ <attractTo><copy target="goal1" /></attractTo>
1835
+ <attractTo><copy target="goal2" /></attractTo>
1836
+ </constraints>
1837
+ </point>
1838
+ </graph>
1839
+ <p><answer>
1840
+ <award matchPartial unorderedCompare sourcesAreResponses="A B">
1841
+ <when>
1842
+ ($A, $B) = ((-4.1, 7.4), (6.8, 9.1))
1843
+ </when>
1844
+ </award>
1845
+ </answer></p>
1846
+ <p>Credit for answer: <copy prop="creditAchieved" target="_answer1" assignNames="ca" /></p>
1847
+ <p>Submitted responses: <math name="srs"><copy prop="submittedResponses" target="_answer1" /></math></p>
1848
+ `,
1849
+ },
1850
+ "*",
1851
+ );
1852
+ });
1853
+
1854
+ cy.get(cesc("#\\/_text1")).should("have.text", "a"); // to wait for page to load
1855
+
1856
+ cy.get(cesc("#\\/goal1") + " .mjx-mrow").should(
1857
+ "contain.text",
1858
+ "(−4.1,7.4)",
1859
+ );
1860
+
1861
+ cy.get(cesc("#\\/_answer1_submit"))
1862
+ .invoke("text")
1863
+ .then((text) => {
1864
+ expect(text.trim().toLowerCase()).equal("check work");
1865
+ });
1866
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
1867
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
1868
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
1869
+
1870
+ cy.log("Submit answer");
1871
+ cy.get(cesc("#\\/_answer1_submit")).click();
1872
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
1873
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
1874
+ cy.get(cesc("#\\/_answer1_incorrect"))
1875
+ .invoke("text")
1876
+ .then((text) => {
1877
+ expect(text.trim().toLowerCase()).equal("incorrect");
1878
+ });
1879
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
1880
+ cy.get(cesc("#\\/ca")).should("have.text", 0);
1881
+ cy.get(cesc(`#\\/srs`))
1882
+ .find(".mjx-mrow")
1883
+ .eq(0)
1884
+ .invoke("text")
1885
+ .then((text) => {
1886
+ expect(text.trim().replace(/−/g, "-")).equal(
1887
+ "((4.9,-1.1),(-2.3,-3.4))",
1888
+ );
1889
+ });
1890
+
1891
+ cy.window().then(async (win) => {
1892
+ let stateVariables = await win.returnAllStateVariables1();
1893
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
1894
+ });
1895
+
1896
+ cy.log("Move A near correct point");
1897
+ cy.window().then(async (win) => {
1898
+ await win.callAction1({
1899
+ actionName: "movePoint",
1900
+ componentName: "/A",
1901
+ args: { x: -4, y: 7.6 },
1902
+ });
1903
+ let stateVariables = await win.returnAllStateVariables1();
1904
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
1905
+ });
1906
+
1907
+ cy.get(cesc("#\\/_answer1_submit"))
1908
+ .invoke("text")
1909
+ .then((text) => {
1910
+ expect(text.trim().toLowerCase()).equal("check work");
1911
+ });
1912
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
1913
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
1914
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
1915
+
1916
+ cy.log("Submit answer");
1917
+ cy.get(cesc("#\\/_answer1_submit")).click();
1918
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
1919
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
1920
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
1921
+ cy.get(cesc("#\\/_answer1_partial"))
1922
+ .invoke("text")
1923
+ .then((text) => {
1924
+ expect(text.trim().toLowerCase()).equal("50% correct");
1925
+ });
1926
+ cy.get(cesc("#\\/ca")).should("have.text", 0.5);
1927
+ cy.get(cesc(`#\\/srs`))
1928
+ .find(".mjx-mrow")
1929
+ .eq(0)
1930
+ .invoke("text")
1931
+ .then((text) => {
1932
+ expect(text.trim().replace(/−/g, "-")).equal(
1933
+ "((-4.1,7.4),(-2.3,-3.4))",
1934
+ );
1935
+ });
1936
+
1937
+ cy.window().then(async (win) => {
1938
+ let stateVariables = await win.returnAllStateVariables1();
1939
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
1940
+ });
1941
+
1942
+ cy.log("Move point A further away and submit");
1943
+ cy.window().then(async (win) => {
1944
+ await win.callAction1({
1945
+ actionName: "movePoint",
1946
+ componentName: "/A",
1947
+ args: { x: -3.7, y: 7 },
1948
+ });
1949
+ let stateVariables = await win.returnAllStateVariables1();
1950
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
1951
+ });
1952
+
1953
+ cy.get(cesc("#\\/_answer1_submit"))
1954
+ .invoke("text")
1955
+ .then((text) => {
1956
+ expect(text.trim().toLowerCase()).equal("check work");
1957
+ });
1958
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
1959
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
1960
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
1961
+
1962
+ cy.get(cesc("#\\/_answer1_submit")).click();
1963
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
1964
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
1965
+ cy.get(cesc("#\\/_answer1_incorrect"))
1966
+ .invoke("text")
1967
+ .then((text) => {
1968
+ expect(text.trim().toLowerCase()).equal("incorrect");
1969
+ });
1970
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
1971
+ cy.get(cesc("#\\/ca")).should("have.text", 0.0);
1972
+ cy.get(cesc(`#\\/srs`))
1973
+ .find(".mjx-mrow")
1974
+ .eq(0)
1975
+ .invoke("text")
1976
+ .then((text) => {
1977
+ expect(text.trim().replace(/−/g, "-")).equal("((-3.7,7),(-2.3,-3.4))");
1978
+ });
1979
+ cy.window().then(async (win) => {
1980
+ let stateVariables = await win.returnAllStateVariables1();
1981
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
1982
+ });
1983
+
1984
+ cy.log("Move point B close and submit");
1985
+ cy.window().then(async (win) => {
1986
+ await win.callAction1({
1987
+ actionName: "movePoint",
1988
+ componentName: "/B",
1989
+ args: { x: -3.8, y: 7.1 },
1990
+ });
1991
+ let stateVariables = await win.returnAllStateVariables1();
1992
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
1993
+ });
1994
+
1995
+ cy.get(cesc("#\\/_answer1_submit"))
1996
+ .invoke("text")
1997
+ .then((text) => {
1998
+ expect(text.trim().toLowerCase()).equal("check work");
1999
+ });
2000
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
2001
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
2002
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
2003
+
2004
+ cy.log("Submit answer");
2005
+ cy.get(cesc("#\\/_answer1_submit")).click();
2006
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
2007
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
2008
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
2009
+ cy.get(cesc("#\\/_answer1_partial"))
2010
+ .invoke("text")
2011
+ .then((text) => {
2012
+ expect(text.trim().toLowerCase()).equal("50% correct");
2013
+ });
2014
+ cy.get(cesc("#\\/ca")).should("have.text", 0.5);
2015
+ cy.get(cesc(`#\\/srs`))
2016
+ .find(".mjx-mrow")
2017
+ .eq(0)
2018
+ .invoke("text")
2019
+ .then((text) => {
2020
+ expect(text.trim().replace(/−/g, "-")).equal("((-3.7,7),(-4.1,7.4))");
2021
+ });
2022
+
2023
+ cy.window().then(async (win) => {
2024
+ let stateVariables = await win.returnAllStateVariables1();
2025
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
2026
+ });
2027
+
2028
+ cy.log("Move point A close to other goal and submit");
2029
+ cy.window().then(async (win) => {
2030
+ await win.callAction1({
2031
+ actionName: "movePoint",
2032
+ componentName: "/A",
2033
+ args: { x: 6.9, y: 9.0 },
2034
+ });
2035
+ let stateVariables = await win.returnAllStateVariables1();
2036
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
2037
+ });
2038
+
2039
+ cy.get(cesc("#\\/_answer1_submit"))
2040
+ .invoke("text")
2041
+ .then((text) => {
2042
+ expect(text.trim().toLowerCase()).equal("check work");
2043
+ });
2044
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
2045
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
2046
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
2047
+
2048
+ cy.log("Submit answer");
2049
+ cy.get(cesc("#\\/_answer1_submit")).click();
2050
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
2051
+ cy.get(cesc("#\\/_answer1_correct"))
2052
+ .invoke("text")
2053
+ .then((text) => {
2054
+ expect(text.trim().toLowerCase()).equal("correct");
2055
+ });
2056
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
2057
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
2058
+
2059
+ cy.get(cesc("#\\/ca")).should("have.text", 1);
2060
+ cy.get(cesc(`#\\/srs`))
2061
+ .find(".mjx-mrow")
2062
+ .eq(0)
2063
+ .invoke("text")
2064
+ .then((text) => {
2065
+ expect(text.trim().replace(/−/g, "-")).equal("((6.8,9.1),(-4.1,7.4))");
2066
+ });
2067
+
2068
+ cy.window().then(async (win) => {
2069
+ let stateVariables = await win.returnAllStateVariables1();
2070
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
2071
+ });
2072
+
2073
+ cy.log("Move point B away and submit");
2074
+ cy.window().then(async (win) => {
2075
+ await win.callAction1({
2076
+ actionName: "movePoint",
2077
+ componentName: "/B",
2078
+ args: { x: -9.9, y: -8.8 },
2079
+ });
2080
+ let stateVariables = await win.returnAllStateVariables1();
2081
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
2082
+ });
2083
+
2084
+ cy.get(cesc("#\\/_answer1_submit"))
2085
+ .invoke("text")
2086
+ .then((text) => {
2087
+ expect(text.trim().toLowerCase()).equal("check work");
2088
+ });
2089
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
2090
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
2091
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
2092
+
2093
+ cy.log("Submit answer");
2094
+ cy.get(cesc("#\\/_answer1_submit")).click();
2095
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
2096
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
2097
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
2098
+ cy.get(cesc("#\\/_answer1_partial"))
2099
+ .invoke("text")
2100
+ .then((text) => {
2101
+ expect(text.trim().toLowerCase()).equal("50% correct");
2102
+ });
2103
+ cy.get(cesc("#\\/ca")).should("have.text", 0.5);
2104
+ cy.get(cesc(`#\\/srs`))
2105
+ .find(".mjx-mrow")
2106
+ .eq(0)
2107
+ .invoke("text")
2108
+ .then((text) => {
2109
+ expect(text.trim().replace(/−/g, "-")).equal("((6.8,9.1),(-9.9,-8.8))");
2110
+ });
2111
+
2112
+ cy.window().then(async (win) => {
2113
+ let stateVariables = await win.returnAllStateVariables1();
2114
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
2115
+ });
2116
+
2117
+ cy.log("Move point B close to second goal and submit");
2118
+ cy.window().then(async (win) => {
2119
+ await win.callAction1({
2120
+ actionName: "movePoint",
2121
+ componentName: "/B",
2122
+ args: { x: 6.7, y: 9 },
2123
+ });
2124
+ let stateVariables = await win.returnAllStateVariables1();
2125
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
2126
+ });
2127
+
2128
+ cy.get(cesc("#\\/_answer1_submit"))
2129
+ .invoke("text")
2130
+ .then((text) => {
2131
+ expect(text.trim().toLowerCase()).equal("check work");
2132
+ });
2133
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
2134
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
2135
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
2136
+
2137
+ cy.log("Submit answer");
2138
+ cy.get(cesc("#\\/_answer1_submit")).click();
2139
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
2140
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
2141
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
2142
+ cy.get(cesc("#\\/_answer1_partial"))
2143
+ .invoke("text")
2144
+ .then((text) => {
2145
+ expect(text.trim().toLowerCase()).equal("50% correct");
2146
+ });
2147
+ cy.get(cesc("#\\/ca")).should("have.text", 0.5);
2148
+ cy.get(cesc(`#\\/srs`))
2149
+ .find(".mjx-mrow")
2150
+ .eq(0)
2151
+ .invoke("text")
2152
+ .then((text) => {
2153
+ expect(text.trim().replace(/−/g, "-")).equal("((6.8,9.1),(6.8,9.1))");
2154
+ });
2155
+
2156
+ cy.window().then(async (win) => {
2157
+ let stateVariables = await win.returnAllStateVariables1();
2158
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
2159
+ });
2160
+
2161
+ cy.log("Move point A away and submit");
2162
+ cy.window().then(async (win) => {
2163
+ await win.callAction1({
2164
+ actionName: "movePoint",
2165
+ componentName: "/A",
2166
+ args: { x: 0.1, y: -1.1 },
2167
+ });
2168
+ let stateVariables = await win.returnAllStateVariables1();
2169
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
2170
+ });
2171
+
2172
+ cy.get(cesc("#\\/_answer1_submit"))
2173
+ .invoke("text")
2174
+ .then((text) => {
2175
+ expect(text.trim().toLowerCase()).equal("check work");
2176
+ });
2177
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
2178
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
2179
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
2180
+
2181
+ cy.log("Submit answer");
2182
+ cy.get(cesc("#\\/_answer1_submit")).click();
2183
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
2184
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
2185
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
2186
+ cy.get(cesc("#\\/_answer1_partial"))
2187
+ .invoke("text")
2188
+ .then((text) => {
2189
+ expect(text.trim().toLowerCase()).equal("50% correct");
2190
+ });
2191
+ cy.get(cesc("#\\/ca")).should("have.text", 0.5);
2192
+ cy.get(cesc(`#\\/srs`))
2193
+ .find(".mjx-mrow")
2194
+ .eq(0)
2195
+ .invoke("text")
2196
+ .then((text) => {
2197
+ expect(text.trim().replace(/−/g, "-")).equal("((0.1,-1.1),(6.8,9.1))");
2198
+ });
2199
+
2200
+ cy.window().then(async (win) => {
2201
+ let stateVariables = await win.returnAllStateVariables1();
2202
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
2203
+ });
2204
+
2205
+ cy.log("Move point A near first goal and submit");
2206
+ cy.window().then(async (win) => {
2207
+ await win.callAction1({
2208
+ actionName: "movePoint",
2209
+ componentName: "/A",
2210
+ args: { x: -3.8, y: 7.6 },
2211
+ });
2212
+ let stateVariables = await win.returnAllStateVariables1();
2213
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
2214
+ });
2215
+
2216
+ cy.get(cesc("#\\/_answer1_submit"))
2217
+ .invoke("text")
2218
+ .then((text) => {
2219
+ expect(text.trim().toLowerCase()).equal("check work");
2220
+ });
2221
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
2222
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
2223
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
2224
+
2225
+ cy.log("Submit answer");
2226
+ cy.get(cesc("#\\/_answer1_submit")).click();
2227
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
2228
+ cy.get(cesc("#\\/_answer1_correct"))
2229
+ .invoke("text")
2230
+ .then((text) => {
2231
+ expect(text.trim().toLowerCase()).equal("correct");
2232
+ });
2233
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
2234
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
2235
+ cy.get(cesc("#\\/ca")).should("have.text", 1);
2236
+ cy.get(cesc(`#\\/srs`))
2237
+ .find(".mjx-mrow")
2238
+ .eq(0)
2239
+ .invoke("text")
2240
+ .then((text) => {
2241
+ expect(text.trim().replace(/−/g, "-")).equal("((-4.1,7.4),(6.8,9.1))");
2242
+ });
2243
+
2244
+ cy.window().then(async (win) => {
2245
+ let stateVariables = await win.returnAllStateVariables1();
2246
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
2247
+ });
2248
+ });
2249
+
2250
+ it("two points at precise locations, award based as string literals, partial match, ordered", () => {
2251
+ cy.window().then(async (win) => {
2252
+ win.postMessage(
2253
+ {
2254
+ doenetML: `
2255
+ <text>a</text>
2256
+ <point name="goal1">(-4.1, 7.4)</point>
2257
+ <point name="goal2">(6.8, 9.1)</point>
2258
+ <p>Move points to <copy prop="coords" target="goal1" /> <copy prop="coords" target="goal2" /></p>
2259
+ <graph>
2260
+ <point name="A" x="4.9" y="-1.1">
2261
+ <constraints>
2262
+ <attractTo><copy target="goal1" /></attractTo>
2263
+ <attractTo><copy target="goal2" /></attractTo>
2264
+ </constraints>
2265
+ </point>
2266
+ <point name="B" x="-2.3" y="-3.4">
2267
+ <constraints>
2268
+ <attractTo><copy target="goal1" /></attractTo>
2269
+ <attractTo><copy target="goal2" /></attractTo>
2270
+ </constraints>
2271
+ </point>
2272
+ </graph>
2273
+ <p><answer>
2274
+ <award matchPartial sourcesAreResponses="A B">
2275
+ <when>
2276
+ ($A, $B) = ((-4.1, 7.4), (6.8, 9.1))
2277
+ </when>
2278
+ </award>
2279
+ </answer></p>
2280
+ <p>Credit for answer: <copy prop="creditAchieved" target="_answer1" assignNames="ca" /></p>
2281
+ <p>Submitted responses: <math name="srs"><copy prop="submittedResponses" target="_answer1" /></math></p>
2282
+ `,
2283
+ },
2284
+ "*",
2285
+ );
2286
+ });
2287
+
2288
+ cy.get(cesc("#\\/_text1")).should("have.text", "a"); // to wait for page to load
2289
+
2290
+ cy.get(cesc("#\\/goal1") + " .mjx-mrow").should(
2291
+ "contain.text",
2292
+ "(−4.1,7.4)",
2293
+ );
2294
+
2295
+ cy.get(cesc("#\\/_answer1_submit"))
2296
+ .invoke("text")
2297
+ .then((text) => {
2298
+ expect(text.trim().toLowerCase()).equal("check work");
2299
+ });
2300
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
2301
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
2302
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
2303
+
2304
+ cy.log("Submit answer");
2305
+ cy.get(cesc("#\\/_answer1_submit")).click();
2306
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
2307
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
2308
+ cy.get(cesc("#\\/_answer1_incorrect"))
2309
+ .invoke("text")
2310
+ .then((text) => {
2311
+ expect(text.trim().toLowerCase()).equal("incorrect");
2312
+ });
2313
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
2314
+ cy.get(cesc("#\\/ca")).should("have.text", 0);
2315
+ cy.get(cesc(`#\\/srs`))
2316
+ .find(".mjx-mrow")
2317
+ .eq(0)
2318
+ .invoke("text")
2319
+ .then((text) => {
2320
+ expect(text.trim().replace(/−/g, "-")).equal(
2321
+ "((4.9,-1.1),(-2.3,-3.4))",
2322
+ );
2323
+ });
2324
+
2325
+ cy.window().then(async (win) => {
2326
+ let stateVariables = await win.returnAllStateVariables1();
2327
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
2328
+ });
2329
+
2330
+ cy.log("Move A near correct point");
2331
+ cy.window().then(async (win) => {
2332
+ await win.callAction1({
2333
+ actionName: "movePoint",
2334
+ componentName: "/A",
2335
+ args: { x: -4, y: 7.6 },
2336
+ });
2337
+ let stateVariables = await win.returnAllStateVariables1();
2338
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
2339
+ });
2340
+
2341
+ cy.get(cesc("#\\/_answer1_submit"))
2342
+ .invoke("text")
2343
+ .then((text) => {
2344
+ expect(text.trim().toLowerCase()).equal("check work");
2345
+ });
2346
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
2347
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
2348
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
2349
+
2350
+ cy.log("Submit answer");
2351
+ cy.get(cesc("#\\/_answer1_submit")).click();
2352
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
2353
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
2354
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
2355
+ cy.get(cesc("#\\/_answer1_partial"))
2356
+ .invoke("text")
2357
+ .then((text) => {
2358
+ expect(text.trim().toLowerCase()).equal("50% correct");
2359
+ });
2360
+ cy.get(cesc("#\\/ca")).should("have.text", 0.5);
2361
+ cy.get(cesc(`#\\/srs`))
2362
+ .find(".mjx-mrow")
2363
+ .eq(0)
2364
+ .invoke("text")
2365
+ .then((text) => {
2366
+ expect(text.trim().replace(/−/g, "-")).equal(
2367
+ "((-4.1,7.4),(-2.3,-3.4))",
2368
+ );
2369
+ });
2370
+
2371
+ cy.window().then(async (win) => {
2372
+ let stateVariables = await win.returnAllStateVariables1();
2373
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
2374
+ });
2375
+
2376
+ cy.log("Move point A further away and submit");
2377
+ cy.window().then(async (win) => {
2378
+ await win.callAction1({
2379
+ actionName: "movePoint",
2380
+ componentName: "/A",
2381
+ args: { x: -3.7, y: 7 },
2382
+ });
2383
+ let stateVariables = await win.returnAllStateVariables1();
2384
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
2385
+ });
2386
+
2387
+ cy.get(cesc("#\\/_answer1_submit"))
2388
+ .invoke("text")
2389
+ .then((text) => {
2390
+ expect(text.trim().toLowerCase()).equal("check work");
2391
+ });
2392
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
2393
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
2394
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
2395
+
2396
+ cy.get(cesc("#\\/_answer1_submit")).click();
2397
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
2398
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
2399
+ cy.get(cesc("#\\/_answer1_incorrect"))
2400
+ .invoke("text")
2401
+ .then((text) => {
2402
+ expect(text.trim().toLowerCase()).equal("incorrect");
2403
+ });
2404
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
2405
+ cy.get(cesc("#\\/ca")).should("have.text", 0.0);
2406
+ cy.get(cesc(`#\\/srs`))
2407
+ .find(".mjx-mrow")
2408
+ .eq(0)
2409
+ .invoke("text")
2410
+ .then((text) => {
2411
+ expect(text.trim().replace(/−/g, "-")).equal("((-3.7,7),(-2.3,-3.4))");
2412
+ });
2413
+ cy.window().then(async (win) => {
2414
+ let stateVariables = await win.returnAllStateVariables1();
2415
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
2416
+ });
2417
+
2418
+ cy.log("Move point B close and submit");
2419
+ cy.window().then(async (win) => {
2420
+ await win.callAction1({
2421
+ actionName: "movePoint",
2422
+ componentName: "/B",
2423
+ args: { x: -3.8, y: 7.1 },
2424
+ });
2425
+ let stateVariables = await win.returnAllStateVariables1();
2426
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
2427
+ });
2428
+
2429
+ cy.get(cesc("#\\/_answer1_submit"))
2430
+ .invoke("text")
2431
+ .then((text) => {
2432
+ expect(text.trim().toLowerCase()).equal("check work");
2433
+ });
2434
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
2435
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
2436
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
2437
+
2438
+ cy.log("Submit answer");
2439
+ cy.get(cesc("#\\/_answer1_submit")).click();
2440
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
2441
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
2442
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
2443
+ cy.get(cesc("#\\/_answer1_partial"))
2444
+ .invoke("text")
2445
+ .then((text) => {
2446
+ expect(text.trim().toLowerCase()).equal("50% correct");
2447
+ });
2448
+ cy.get(cesc("#\\/ca")).should("have.text", 0.5);
2449
+ cy.get(cesc(`#\\/srs`))
2450
+ .find(".mjx-mrow")
2451
+ .eq(0)
2452
+ .invoke("text")
2453
+ .then((text) => {
2454
+ expect(text.trim().replace(/−/g, "-")).equal("((-3.7,7),(-4.1,7.4))");
2455
+ });
2456
+
2457
+ cy.window().then(async (win) => {
2458
+ let stateVariables = await win.returnAllStateVariables1();
2459
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
2460
+ });
2461
+
2462
+ cy.log("Move point A close to other goal and submit");
2463
+ cy.window().then(async (win) => {
2464
+ await win.callAction1({
2465
+ actionName: "movePoint",
2466
+ componentName: "/A",
2467
+ args: { x: 6.9, y: 9.0 },
2468
+ });
2469
+ let stateVariables = await win.returnAllStateVariables1();
2470
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
2471
+ });
2472
+
2473
+ cy.get(cesc("#\\/_answer1_submit"))
2474
+ .invoke("text")
2475
+ .then((text) => {
2476
+ expect(text.trim().toLowerCase()).equal("check work");
2477
+ });
2478
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
2479
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
2480
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
2481
+
2482
+ cy.log("Submit answer");
2483
+ cy.get(cesc("#\\/_answer1_submit")).click();
2484
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
2485
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
2486
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
2487
+ cy.get(cesc("#\\/_answer1_partial"))
2488
+ .invoke("text")
2489
+ .then((text) => {
2490
+ expect(text.trim().toLowerCase()).equal("50% correct");
2491
+ });
2492
+
2493
+ cy.get(cesc("#\\/ca")).should("have.text", 0.5);
2494
+ cy.get(cesc(`#\\/srs`))
2495
+ .find(".mjx-mrow")
2496
+ .eq(0)
2497
+ .invoke("text")
2498
+ .then((text) => {
2499
+ expect(text.trim().replace(/−/g, "-")).equal("((6.8,9.1),(-4.1,7.4))");
2500
+ });
2501
+
2502
+ cy.window().then(async (win) => {
2503
+ let stateVariables = await win.returnAllStateVariables1();
2504
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
2505
+ });
2506
+
2507
+ cy.log("Move point B away and submit");
2508
+ cy.window().then(async (win) => {
2509
+ await win.callAction1({
2510
+ actionName: "movePoint",
2511
+ componentName: "/B",
2512
+ args: { x: -9.9, y: -8.8 },
2513
+ });
2514
+ let stateVariables = await win.returnAllStateVariables1();
2515
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
2516
+ });
2517
+
2518
+ cy.get(cesc("#\\/_answer1_submit"))
2519
+ .invoke("text")
2520
+ .then((text) => {
2521
+ expect(text.trim().toLowerCase()).equal("check work");
2522
+ });
2523
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
2524
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
2525
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
2526
+
2527
+ cy.log("Submit answer");
2528
+ cy.get(cesc("#\\/_answer1_submit")).click();
2529
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
2530
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
2531
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
2532
+ cy.get(cesc("#\\/_answer1_partial"))
2533
+ .invoke("text")
2534
+ .then((text) => {
2535
+ expect(text.trim().toLowerCase()).equal("50% correct");
2536
+ });
2537
+ cy.get(cesc("#\\/ca")).should("have.text", 0.5);
2538
+ cy.get(cesc(`#\\/srs`))
2539
+ .find(".mjx-mrow")
2540
+ .eq(0)
2541
+ .invoke("text")
2542
+ .then((text) => {
2543
+ expect(text.trim().replace(/−/g, "-")).equal("((6.8,9.1),(-9.9,-8.8))");
2544
+ });
2545
+
2546
+ cy.window().then(async (win) => {
2547
+ let stateVariables = await win.returnAllStateVariables1();
2548
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
2549
+ });
2550
+
2551
+ cy.log("Move point B close to second goal and submit");
2552
+ cy.window().then(async (win) => {
2553
+ await win.callAction1({
2554
+ actionName: "movePoint",
2555
+ componentName: "/B",
2556
+ args: { x: 6.7, y: 9 },
2557
+ });
2558
+ let stateVariables = await win.returnAllStateVariables1();
2559
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
2560
+ });
2561
+
2562
+ cy.get(cesc("#\\/_answer1_submit"))
2563
+ .invoke("text")
2564
+ .then((text) => {
2565
+ expect(text.trim().toLowerCase()).equal("check work");
2566
+ });
2567
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
2568
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
2569
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
2570
+
2571
+ cy.log("Submit answer");
2572
+ cy.get(cesc("#\\/_answer1_submit")).click();
2573
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
2574
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
2575
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
2576
+ cy.get(cesc("#\\/_answer1_partial"))
2577
+ .invoke("text")
2578
+ .then((text) => {
2579
+ expect(text.trim().toLowerCase()).equal("50% correct");
2580
+ });
2581
+ cy.get(cesc("#\\/ca")).should("have.text", 0.5);
2582
+ cy.get(cesc(`#\\/srs`))
2583
+ .find(".mjx-mrow")
2584
+ .eq(0)
2585
+ .invoke("text")
2586
+ .then((text) => {
2587
+ expect(text.trim().replace(/−/g, "-")).equal("((6.8,9.1),(6.8,9.1))");
2588
+ });
2589
+
2590
+ cy.window().then(async (win) => {
2591
+ let stateVariables = await win.returnAllStateVariables1();
2592
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
2593
+ });
2594
+
2595
+ cy.log("Move point A away and submit");
2596
+ cy.window().then(async (win) => {
2597
+ await win.callAction1({
2598
+ actionName: "movePoint",
2599
+ componentName: "/A",
2600
+ args: { x: 0.1, y: -1.1 },
2601
+ });
2602
+ let stateVariables = await win.returnAllStateVariables1();
2603
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
2604
+ });
2605
+
2606
+ cy.get(cesc("#\\/_answer1_submit"))
2607
+ .invoke("text")
2608
+ .then((text) => {
2609
+ expect(text.trim().toLowerCase()).equal("check work");
2610
+ });
2611
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
2612
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
2613
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
2614
+
2615
+ cy.log("Submit answer");
2616
+ cy.get(cesc("#\\/_answer1_submit")).click();
2617
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
2618
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
2619
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
2620
+ cy.get(cesc("#\\/_answer1_partial"))
2621
+ .invoke("text")
2622
+ .then((text) => {
2623
+ expect(text.trim().toLowerCase()).equal("50% correct");
2624
+ });
2625
+ cy.get(cesc("#\\/ca")).should("have.text", 0.5);
2626
+ cy.get(cesc(`#\\/srs`))
2627
+ .find(".mjx-mrow")
2628
+ .eq(0)
2629
+ .invoke("text")
2630
+ .then((text) => {
2631
+ expect(text.trim().replace(/−/g, "-")).equal("((0.1,-1.1),(6.8,9.1))");
2632
+ });
2633
+
2634
+ cy.window().then(async (win) => {
2635
+ let stateVariables = await win.returnAllStateVariables1();
2636
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
2637
+ });
2638
+
2639
+ cy.log("Move point A near first goal and submit");
2640
+ cy.window().then(async (win) => {
2641
+ await win.callAction1({
2642
+ actionName: "movePoint",
2643
+ componentName: "/A",
2644
+ args: { x: -3.8, y: 7.6 },
2645
+ });
2646
+ let stateVariables = await win.returnAllStateVariables1();
2647
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
2648
+ });
2649
+
2650
+ cy.get(cesc("#\\/_answer1_submit"))
2651
+ .invoke("text")
2652
+ .then((text) => {
2653
+ expect(text.trim().toLowerCase()).equal("check work");
2654
+ });
2655
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
2656
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
2657
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
2658
+
2659
+ cy.log("Submit answer");
2660
+ cy.get(cesc("#\\/_answer1_submit")).click();
2661
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
2662
+ cy.get(cesc("#\\/_answer1_correct"))
2663
+ .invoke("text")
2664
+ .then((text) => {
2665
+ expect(text.trim().toLowerCase()).equal("correct");
2666
+ });
2667
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
2668
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
2669
+ cy.get(cesc("#\\/ca")).should("have.text", 1);
2670
+ cy.get(cesc(`#\\/srs`))
2671
+ .find(".mjx-mrow")
2672
+ .eq(0)
2673
+ .invoke("text")
2674
+ .then((text) => {
2675
+ expect(text.trim().replace(/−/g, "-")).equal("((-4.1,7.4),(6.8,9.1))");
2676
+ });
2677
+
2678
+ cy.window().then(async (win) => {
2679
+ let stateVariables = await win.returnAllStateVariables1();
2680
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
2681
+ });
2682
+ });
2683
+
2684
+ it("two points at precise locations, partial match, as mathlists", () => {
2685
+ cy.window().then(async (win) => {
2686
+ win.postMessage(
2687
+ {
2688
+ doenetML: `
2689
+ <text>a</text>
2690
+ <point name="goal1">(-4.1, 7.4)</point>
2691
+ <point name="goal2">(6.8, 9.1)</point>
2692
+ <p>Move points to <copy prop="coords" target="goal1" /> <copy prop="coords" target="goal2" /></p>
2693
+ <graph>
2694
+ <point name="A" x="4.9" y="-1.1">
2695
+ <constraints>
2696
+ <attractTo><copy target="goal1" /></attractTo>
2697
+ <attractTo><copy target="goal2" /></attractTo>
2698
+ </constraints>
2699
+ </point>
2700
+ <point name="B" x="-2.3" y="-3.4">
2701
+ <constraints>
2702
+ <attractTo><copy target="goal1" /></attractTo>
2703
+ <attractTo><copy target="goal2" /></attractTo>
2704
+ </constraints>
2705
+ </point>
2706
+ </graph>
2707
+ <p><answer>
2708
+ <award matchPartial unorderedCompare sourcesAreResponses="A B">
2709
+ <when>
2710
+ <mathlist>$A $B</mathlist> = <mathlist>$goal1 $goal2</mathlist>
2711
+ </when>
2712
+ </award>
2713
+ </answer></p>
2714
+ <p>Credit for answer: <copy prop="creditAchieved" target="_answer1" assignNames="ca" /></p>
2715
+ <p>Submitted responses: <math name="srs"><copy prop="submittedResponses" target="_answer1" /></math></p>
2716
+ `,
2717
+ },
2718
+ "*",
2719
+ );
2720
+ });
2721
+
2722
+ cy.get(cesc("#\\/_text1")).should("have.text", "a"); // to wait for page to load
2723
+
2724
+ cy.get(cesc("#\\/goal1") + " .mjx-mrow").should(
2725
+ "contain.text",
2726
+ "(−4.1,7.4)",
2727
+ );
2728
+
2729
+ cy.get(cesc("#\\/_answer1_submit"))
2730
+ .invoke("text")
2731
+ .then((text) => {
2732
+ expect(text.trim().toLowerCase()).equal("check work");
2733
+ });
2734
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
2735
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
2736
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
2737
+
2738
+ cy.log("Submit answer");
2739
+ cy.get(cesc("#\\/_answer1_submit")).click();
2740
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
2741
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
2742
+ cy.get(cesc("#\\/_answer1_incorrect"))
2743
+ .invoke("text")
2744
+ .then((text) => {
2745
+ expect(text.trim().toLowerCase()).equal("incorrect");
2746
+ });
2747
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
2748
+ cy.get(cesc("#\\/ca")).should("have.text", 0);
2749
+ cy.get(cesc(`#\\/srs`))
2750
+ .find(".mjx-mrow")
2751
+ .eq(0)
2752
+ .invoke("text")
2753
+ .then((text) => {
2754
+ expect(text.trim().replace(/−/g, "-")).equal(
2755
+ "((4.9,-1.1),(-2.3,-3.4))",
2756
+ );
2757
+ });
2758
+
2759
+ cy.window().then(async (win) => {
2760
+ let stateVariables = await win.returnAllStateVariables1();
2761
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
2762
+ });
2763
+
2764
+ cy.log("Move A near correct point");
2765
+ cy.window().then(async (win) => {
2766
+ await win.callAction1({
2767
+ actionName: "movePoint",
2768
+ componentName: "/A",
2769
+ args: { x: -4, y: 7.6 },
2770
+ });
2771
+ let stateVariables = await win.returnAllStateVariables1();
2772
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
2773
+ });
2774
+
2775
+ cy.get(cesc("#\\/_answer1_submit"))
2776
+ .invoke("text")
2777
+ .then((text) => {
2778
+ expect(text.trim().toLowerCase()).equal("check work");
2779
+ });
2780
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
2781
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
2782
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
2783
+
2784
+ cy.log("Submit answer");
2785
+ cy.get(cesc("#\\/_answer1_submit")).click();
2786
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
2787
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
2788
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
2789
+ cy.get(cesc("#\\/_answer1_partial"))
2790
+ .invoke("text")
2791
+ .then((text) => {
2792
+ expect(text.trim().toLowerCase()).equal("50% correct");
2793
+ });
2794
+ cy.get(cesc("#\\/ca")).should("have.text", 0.5);
2795
+ cy.get(cesc(`#\\/srs`))
2796
+ .find(".mjx-mrow")
2797
+ .eq(0)
2798
+ .invoke("text")
2799
+ .then((text) => {
2800
+ expect(text.trim().replace(/−/g, "-")).equal(
2801
+ "((-4.1,7.4),(-2.3,-3.4))",
2802
+ );
2803
+ });
2804
+
2805
+ cy.window().then(async (win) => {
2806
+ let stateVariables = await win.returnAllStateVariables1();
2807
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
2808
+ });
2809
+
2810
+ cy.log("Move point A further away and submit");
2811
+ cy.window().then(async (win) => {
2812
+ await win.callAction1({
2813
+ actionName: "movePoint",
2814
+ componentName: "/A",
2815
+ args: { x: -3.7, y: 7 },
2816
+ });
2817
+ let stateVariables = await win.returnAllStateVariables1();
2818
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
2819
+ });
2820
+
2821
+ cy.get(cesc("#\\/_answer1_submit"))
2822
+ .invoke("text")
2823
+ .then((text) => {
2824
+ expect(text.trim().toLowerCase()).equal("check work");
2825
+ });
2826
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
2827
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
2828
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
2829
+
2830
+ cy.get(cesc("#\\/_answer1_submit")).click();
2831
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
2832
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
2833
+ cy.get(cesc("#\\/_answer1_incorrect"))
2834
+ .invoke("text")
2835
+ .then((text) => {
2836
+ expect(text.trim().toLowerCase()).equal("incorrect");
2837
+ });
2838
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
2839
+ cy.get(cesc("#\\/ca")).should("have.text", 0.0);
2840
+ cy.get(cesc(`#\\/srs`))
2841
+ .find(".mjx-mrow")
2842
+ .eq(0)
2843
+ .invoke("text")
2844
+ .then((text) => {
2845
+ expect(text.trim().replace(/−/g, "-")).equal("((-3.7,7),(-2.3,-3.4))");
2846
+ });
2847
+ cy.window().then(async (win) => {
2848
+ let stateVariables = await win.returnAllStateVariables1();
2849
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
2850
+ });
2851
+
2852
+ cy.log("Move point B close and submit");
2853
+ cy.window().then(async (win) => {
2854
+ await win.callAction1({
2855
+ actionName: "movePoint",
2856
+ componentName: "/B",
2857
+ args: { x: -3.8, y: 7.1 },
2858
+ });
2859
+ let stateVariables = await win.returnAllStateVariables1();
2860
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
2861
+ });
2862
+
2863
+ cy.get(cesc("#\\/_answer1_submit"))
2864
+ .invoke("text")
2865
+ .then((text) => {
2866
+ expect(text.trim().toLowerCase()).equal("check work");
2867
+ });
2868
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
2869
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
2870
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
2871
+
2872
+ cy.log("Submit answer");
2873
+ cy.get(cesc("#\\/_answer1_submit")).click();
2874
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
2875
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
2876
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
2877
+ cy.get(cesc("#\\/_answer1_partial"))
2878
+ .invoke("text")
2879
+ .then((text) => {
2880
+ expect(text.trim().toLowerCase()).equal("50% correct");
2881
+ });
2882
+ cy.get(cesc("#\\/ca")).should("have.text", 0.5);
2883
+ cy.get(cesc(`#\\/srs`))
2884
+ .find(".mjx-mrow")
2885
+ .eq(0)
2886
+ .invoke("text")
2887
+ .then((text) => {
2888
+ expect(text.trim().replace(/−/g, "-")).equal("((-3.7,7),(-4.1,7.4))");
2889
+ });
2890
+
2891
+ cy.window().then(async (win) => {
2892
+ let stateVariables = await win.returnAllStateVariables1();
2893
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
2894
+ });
2895
+
2896
+ cy.log("Move point A close to other goal and submit");
2897
+ cy.window().then(async (win) => {
2898
+ await win.callAction1({
2899
+ actionName: "movePoint",
2900
+ componentName: "/A",
2901
+ args: { x: 6.9, y: 9.0 },
2902
+ });
2903
+ let stateVariables = await win.returnAllStateVariables1();
2904
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
2905
+ });
2906
+
2907
+ cy.get(cesc("#\\/_answer1_submit"))
2908
+ .invoke("text")
2909
+ .then((text) => {
2910
+ expect(text.trim().toLowerCase()).equal("check work");
2911
+ });
2912
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
2913
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
2914
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
2915
+
2916
+ cy.log("Submit answer");
2917
+ cy.get(cesc("#\\/_answer1_submit")).click();
2918
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
2919
+ cy.get(cesc("#\\/_answer1_correct"))
2920
+ .invoke("text")
2921
+ .then((text) => {
2922
+ expect(text.trim().toLowerCase()).equal("correct");
2923
+ });
2924
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
2925
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
2926
+
2927
+ cy.get(cesc("#\\/ca")).should("have.text", 1);
2928
+ cy.get(cesc(`#\\/srs`))
2929
+ .find(".mjx-mrow")
2930
+ .eq(0)
2931
+ .invoke("text")
2932
+ .then((text) => {
2933
+ expect(text.trim().replace(/−/g, "-")).equal("((6.8,9.1),(-4.1,7.4))");
2934
+ });
2935
+
2936
+ cy.window().then(async (win) => {
2937
+ let stateVariables = await win.returnAllStateVariables1();
2938
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
2939
+ });
2940
+
2941
+ cy.log("Move point B away and submit");
2942
+ cy.window().then(async (win) => {
2943
+ await win.callAction1({
2944
+ actionName: "movePoint",
2945
+ componentName: "/B",
2946
+ args: { x: -9.9, y: -8.8 },
2947
+ });
2948
+ let stateVariables = await win.returnAllStateVariables1();
2949
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
2950
+ });
2951
+
2952
+ cy.get(cesc("#\\/_answer1_submit"))
2953
+ .invoke("text")
2954
+ .then((text) => {
2955
+ expect(text.trim().toLowerCase()).equal("check work");
2956
+ });
2957
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
2958
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
2959
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
2960
+
2961
+ cy.log("Submit answer");
2962
+ cy.get(cesc("#\\/_answer1_submit")).click();
2963
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
2964
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
2965
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
2966
+ cy.get(cesc("#\\/_answer1_partial"))
2967
+ .invoke("text")
2968
+ .then((text) => {
2969
+ expect(text.trim().toLowerCase()).equal("50% correct");
2970
+ });
2971
+ cy.get(cesc("#\\/ca")).should("have.text", 0.5);
2972
+ cy.get(cesc(`#\\/srs`))
2973
+ .find(".mjx-mrow")
2974
+ .eq(0)
2975
+ .invoke("text")
2976
+ .then((text) => {
2977
+ expect(text.trim().replace(/−/g, "-")).equal("((6.8,9.1),(-9.9,-8.8))");
2978
+ });
2979
+
2980
+ cy.window().then(async (win) => {
2981
+ let stateVariables = await win.returnAllStateVariables1();
2982
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
2983
+ });
2984
+
2985
+ cy.log("Move point B close to second goal and submit");
2986
+ cy.window().then(async (win) => {
2987
+ await win.callAction1({
2988
+ actionName: "movePoint",
2989
+ componentName: "/B",
2990
+ args: { x: 6.7, y: 9 },
2991
+ });
2992
+ let stateVariables = await win.returnAllStateVariables1();
2993
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
2994
+ });
2995
+
2996
+ cy.get(cesc("#\\/_answer1_submit"))
2997
+ .invoke("text")
2998
+ .then((text) => {
2999
+ expect(text.trim().toLowerCase()).equal("check work");
3000
+ });
3001
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
3002
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
3003
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
3004
+
3005
+ cy.log("Submit answer");
3006
+ cy.get(cesc("#\\/_answer1_submit")).click();
3007
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
3008
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
3009
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
3010
+ cy.get(cesc("#\\/_answer1_partial"))
3011
+ .invoke("text")
3012
+ .then((text) => {
3013
+ expect(text.trim().toLowerCase()).equal("50% correct");
3014
+ });
3015
+ cy.get(cesc("#\\/ca")).should("have.text", 0.5);
3016
+ cy.get(cesc(`#\\/srs`))
3017
+ .find(".mjx-mrow")
3018
+ .eq(0)
3019
+ .invoke("text")
3020
+ .then((text) => {
3021
+ expect(text.trim().replace(/−/g, "-")).equal("((6.8,9.1),(6.8,9.1))");
3022
+ });
3023
+
3024
+ cy.window().then(async (win) => {
3025
+ let stateVariables = await win.returnAllStateVariables1();
3026
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
3027
+ });
3028
+
3029
+ cy.log("Move point A away and submit");
3030
+ cy.window().then(async (win) => {
3031
+ await win.callAction1({
3032
+ actionName: "movePoint",
3033
+ componentName: "/A",
3034
+ args: { x: 0.1, y: -1.1 },
3035
+ });
3036
+ let stateVariables = await win.returnAllStateVariables1();
3037
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
3038
+ });
3039
+
3040
+ cy.get(cesc("#\\/_answer1_submit"))
3041
+ .invoke("text")
3042
+ .then((text) => {
3043
+ expect(text.trim().toLowerCase()).equal("check work");
3044
+ });
3045
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
3046
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
3047
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
3048
+
3049
+ cy.log("Submit answer");
3050
+ cy.get(cesc("#\\/_answer1_submit")).click();
3051
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
3052
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
3053
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
3054
+ cy.get(cesc("#\\/_answer1_partial"))
3055
+ .invoke("text")
3056
+ .then((text) => {
3057
+ expect(text.trim().toLowerCase()).equal("50% correct");
3058
+ });
3059
+ cy.get(cesc("#\\/ca")).should("have.text", 0.5);
3060
+ cy.get(cesc(`#\\/srs`))
3061
+ .find(".mjx-mrow")
3062
+ .eq(0)
3063
+ .invoke("text")
3064
+ .then((text) => {
3065
+ expect(text.trim().replace(/−/g, "-")).equal("((0.1,-1.1),(6.8,9.1))");
3066
+ });
3067
+
3068
+ cy.window().then(async (win) => {
3069
+ let stateVariables = await win.returnAllStateVariables1();
3070
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
3071
+ });
3072
+
3073
+ cy.log("Move point A near first goal and submit");
3074
+ cy.window().then(async (win) => {
3075
+ await win.callAction1({
3076
+ actionName: "movePoint",
3077
+ componentName: "/A",
3078
+ args: { x: -3.8, y: 7.6 },
3079
+ });
3080
+ let stateVariables = await win.returnAllStateVariables1();
3081
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
3082
+ });
3083
+
3084
+ cy.get(cesc("#\\/_answer1_submit"))
3085
+ .invoke("text")
3086
+ .then((text) => {
3087
+ expect(text.trim().toLowerCase()).equal("check work");
3088
+ });
3089
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
3090
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
3091
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
3092
+
3093
+ cy.log("Submit answer");
3094
+ cy.get(cesc("#\\/_answer1_submit")).click();
3095
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
3096
+ cy.get(cesc("#\\/_answer1_correct"))
3097
+ .invoke("text")
3098
+ .then((text) => {
3099
+ expect(text.trim().toLowerCase()).equal("correct");
3100
+ });
3101
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
3102
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
3103
+ cy.get(cesc("#\\/ca")).should("have.text", 1);
3104
+ cy.get(cesc(`#\\/srs`))
3105
+ .find(".mjx-mrow")
3106
+ .eq(0)
3107
+ .invoke("text")
3108
+ .then((text) => {
3109
+ expect(text.trim().replace(/−/g, "-")).equal("((-4.1,7.4),(6.8,9.1))");
3110
+ });
3111
+
3112
+ cy.window().then(async (win) => {
3113
+ let stateVariables = await win.returnAllStateVariables1();
3114
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
3115
+ });
3116
+ });
3117
+
3118
+ it("dynamical number of points, partial match, as mathlists", () => {
3119
+ cy.window().then(async (win) => {
3120
+ win.postMessage(
3121
+ {
3122
+ doenetML: `
3123
+ <text>a</text>
3124
+ <point name="goal1">(-4.1, 7.4)</point>
3125
+ <point name="goal2">(6.8, 9.1)</point>
3126
+ <p>Move points to <copy prop="coords" target="goal1" /> <copy prop="coords" target="goal2" /></p>
3127
+ <p>Number of points: <mathinput prefill="0" name="n" /></p>
3128
+ <graph>
3129
+ <map name="map1" assignNames="(A) (B) (C)">
3130
+ <template>
3131
+ <point x='$i' y='1'>
3132
+ <constraints>
3133
+ <attractTo><copy target="goal1" /></attractTo>
3134
+ <attractTo><copy target="goal2" /></attractTo>
3135
+ </constraints>
3136
+ </point>
3137
+ </template>
3138
+ <sources alias="i"><sequence fixed='false' from="1" to="$n" /></sources>
3139
+ </map>
3140
+ </graph>
3141
+ <p><answer>
3142
+ <award matchPartial unorderedCompare sourcesAreResponses="map1">
3143
+ <when>
3144
+ <mathlist>$map1</mathlist> = <mathlist>$goal1 $goal2</mathlist>
3145
+ </when>
3146
+ </award>
3147
+ </answer></p>
3148
+ <p>Credit for answer: <copy prop="creditAchieved" target="_answer1" assignNames="ca" /></p>
3149
+ <p>Submitted responses: <math name="srs"><copy prop="submittedResponses" target="_answer1" /></math></p>
3150
+ `,
3151
+ },
3152
+ "*",
3153
+ );
3154
+ });
3155
+
3156
+ cy.get(cesc("#\\/_text1")).should("have.text", "a"); // to wait for page to load
3157
+
3158
+ cy.get(cesc("#\\/goal1") + " .mjx-mrow").should(
3159
+ "contain.text",
3160
+ "(−4.1,7.4)",
3161
+ );
3162
+
3163
+ cy.get(cesc("#\\/_answer1_submit"))
3164
+ .invoke("text")
3165
+ .then((text) => {
3166
+ expect(text.trim().toLowerCase()).equal("check work");
3167
+ });
3168
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
3169
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
3170
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
3171
+
3172
+ cy.log("Submit answer");
3173
+ cy.get(cesc("#\\/_answer1_submit")).click();
3174
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
3175
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
3176
+ cy.get(cesc("#\\/_answer1_incorrect"))
3177
+ .invoke("text")
3178
+ .then((text) => {
3179
+ expect(text.trim().toLowerCase()).equal("incorrect");
3180
+ });
3181
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
3182
+ cy.get(cesc("#\\/ca")).should("have.text", 0);
3183
+ cy.get(cesc(`#\\/srs`))
3184
+ .find(".mjx-mrow")
3185
+ .eq(0)
3186
+ .invoke("text")
3187
+ .then((text) => {
3188
+ expect(text.trim().replace(/−/g, "-")).equal("_");
3189
+ });
3190
+
3191
+ cy.window().then(async (win) => {
3192
+ let stateVariables = await win.returnAllStateVariables1();
3193
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
3194
+ });
3195
+
3196
+ cy.log("Create point A and submit");
3197
+ cy.get(cesc("#\\/n") + " textarea").type("{end}{backspace}1{enter}", {
3198
+ force: true,
3199
+ });
3200
+ cy.get(cesc("#\\/_answer1_submit")).click();
3201
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
3202
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
3203
+ cy.get(cesc("#\\/_answer1_incorrect"))
3204
+ .invoke("text")
3205
+ .then((text) => {
3206
+ expect(text.trim().toLowerCase()).equal("incorrect");
3207
+ });
3208
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
3209
+ cy.get(cesc("#\\/ca")).should("have.text", 0);
3210
+ cy.get(cesc(`#\\/srs`))
3211
+ .find(".mjx-mrow")
3212
+ .eq(0)
3213
+ .invoke("text")
3214
+ .then((text) => {
3215
+ expect(text.trim().replace(/−/g, "-")).equal("(1,1)");
3216
+ });
3217
+
3218
+ cy.log("Move A near correct point");
3219
+ cy.window().then(async (win) => {
3220
+ await win.callAction1({
3221
+ actionName: "movePoint",
3222
+ componentName: "/A",
3223
+ args: { x: -4, y: 7.6 },
3224
+ });
3225
+ let stateVariables = await win.returnAllStateVariables1();
3226
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
3227
+ });
3228
+
3229
+ cy.get(cesc("#\\/_answer1_submit"))
3230
+ .invoke("text")
3231
+ .then((text) => {
3232
+ expect(text.trim().toLowerCase()).equal("check work");
3233
+ });
3234
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
3235
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
3236
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
3237
+
3238
+ cy.log("Submit answer");
3239
+ cy.get(cesc("#\\/_answer1_submit")).click();
3240
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
3241
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
3242
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
3243
+ cy.get(cesc("#\\/_answer1_partial"))
3244
+ .invoke("text")
3245
+ .then((text) => {
3246
+ expect(text.trim().toLowerCase()).equal("50% correct");
3247
+ });
3248
+ cy.get(cesc("#\\/ca")).should("have.text", 0.5);
3249
+ cy.get(cesc(`#\\/srs`))
3250
+ .find(".mjx-mrow")
3251
+ .eq(0)
3252
+ .invoke("text")
3253
+ .then((text) => {
3254
+ expect(text.trim().replace(/−/g, "-")).equal("(-4.1,7.4)");
3255
+ });
3256
+
3257
+ cy.log("Move point A further away and submit");
3258
+ cy.window().then(async (win) => {
3259
+ await win.callAction1({
3260
+ actionName: "movePoint",
3261
+ componentName: "/A",
3262
+ args: { x: -3.7, y: 7 },
3263
+ });
3264
+ });
3265
+
3266
+ cy.get(cesc("#\\/_answer1_submit")).click();
3267
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
3268
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
3269
+ cy.get(cesc("#\\/_answer1_incorrect"))
3270
+ .invoke("text")
3271
+ .then((text) => {
3272
+ expect(text.trim().toLowerCase()).equal("incorrect");
3273
+ });
3274
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
3275
+ cy.get(cesc("#\\/ca")).should("have.text", 0.0);
3276
+ cy.get(cesc(`#\\/srs`))
3277
+ .find(".mjx-mrow")
3278
+ .eq(0)
3279
+ .invoke("text")
3280
+ .then((text) => {
3281
+ expect(text.trim().replace(/−/g, "-")).equal("(-3.7,7)");
3282
+ });
3283
+
3284
+ cy.log("create point B and submit");
3285
+ cy.get(cesc("#\\/n") + " textarea").type("{end}{backspace}2{enter}", {
3286
+ force: true,
3287
+ });
3288
+ cy.get(cesc("#\\/_answer1_submit")).click();
3289
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
3290
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
3291
+ cy.get(cesc("#\\/_answer1_incorrect"))
3292
+ .invoke("text")
3293
+ .then((text) => {
3294
+ expect(text.trim().toLowerCase()).equal("incorrect");
3295
+ });
3296
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
3297
+ cy.get(cesc("#\\/ca")).should("have.text", 0);
3298
+ cy.get(cesc(`#\\/srs`))
3299
+ .find(".mjx-mrow")
3300
+ .eq(0)
3301
+ .invoke("text")
3302
+ .then((text) => {
3303
+ expect(text.trim().replace(/−/g, "-")).equal("((-3.7,7),(2,1))");
3304
+ });
3305
+
3306
+ cy.log("Move point B close and submit");
3307
+ cy.window().then(async (win) => {
3308
+ await win.callAction1({
3309
+ actionName: "movePoint",
3310
+ componentName: "/B",
3311
+ args: { x: -3.8, y: 7.1 },
3312
+ });
3313
+ });
3314
+
3315
+ cy.get(cesc("#\\/_answer1_submit")).click();
3316
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
3317
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
3318
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
3319
+ cy.get(cesc("#\\/_answer1_partial"))
3320
+ .invoke("text")
3321
+ .then((text) => {
3322
+ expect(text.trim().toLowerCase()).equal("50% correct");
3323
+ });
3324
+ cy.get(cesc("#\\/ca")).should("have.text", 0.5);
3325
+ cy.get(cesc(`#\\/srs`))
3326
+ .find(".mjx-mrow")
3327
+ .eq(0)
3328
+ .invoke("text")
3329
+ .then((text) => {
3330
+ expect(text.trim().replace(/−/g, "-")).equal("((-3.7,7),(-4.1,7.4))");
3331
+ });
3332
+
3333
+ cy.log("Move point A close to other goal and submit");
3334
+ cy.window().then(async (win) => {
3335
+ await win.callAction1({
3336
+ actionName: "movePoint",
3337
+ componentName: "/A",
3338
+ args: { x: 6.9, y: 9.0 },
3339
+ });
3340
+ });
3341
+
3342
+ cy.log("Submit answer");
3343
+ cy.get(cesc("#\\/_answer1_submit")).click();
3344
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
3345
+ cy.get(cesc("#\\/_answer1_correct"))
3346
+ .invoke("text")
3347
+ .then((text) => {
3348
+ expect(text.trim().toLowerCase()).equal("correct");
3349
+ });
3350
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
3351
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
3352
+
3353
+ cy.get(cesc("#\\/ca")).should("have.text", 1);
3354
+ cy.get(cesc(`#\\/srs`))
3355
+ .find(".mjx-mrow")
3356
+ .eq(0)
3357
+ .invoke("text")
3358
+ .then((text) => {
3359
+ expect(text.trim().replace(/−/g, "-")).equal("((6.8,9.1),(-4.1,7.4))");
3360
+ });
3361
+
3362
+ cy.log("Move point B away and submit");
3363
+ cy.window().then(async (win) => {
3364
+ await win.callAction1({
3365
+ actionName: "movePoint",
3366
+ componentName: "/B",
3367
+ args: { x: -9.9, y: -8.8 },
3368
+ });
3369
+ });
3370
+
3371
+ cy.get(cesc("#\\/_answer1_submit")).click();
3372
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
3373
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
3374
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
3375
+ cy.get(cesc("#\\/_answer1_partial"))
3376
+ .invoke("text")
3377
+ .then((text) => {
3378
+ expect(text.trim().toLowerCase()).equal("50% correct");
3379
+ });
3380
+ cy.get(cesc("#\\/ca")).should("have.text", 0.5);
3381
+ cy.get(cesc(`#\\/srs`))
3382
+ .find(".mjx-mrow")
3383
+ .eq(0)
3384
+ .invoke("text")
3385
+ .then((text) => {
3386
+ expect(text.trim().replace(/−/g, "-")).equal("((6.8,9.1),(-9.9,-8.8))");
3387
+ });
3388
+
3389
+ cy.log("Move point B close to second goal and submit");
3390
+ cy.window().then(async (win) => {
3391
+ await win.callAction1({
3392
+ actionName: "movePoint",
3393
+ componentName: "/B",
3394
+ args: { x: 6.7, y: 9 },
3395
+ });
3396
+ });
3397
+
3398
+ cy.log("Submit answer");
3399
+ cy.get(cesc("#\\/_answer1_submit")).click();
3400
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
3401
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
3402
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
3403
+ cy.get(cesc("#\\/_answer1_partial"))
3404
+ .invoke("text")
3405
+ .then((text) => {
3406
+ expect(text.trim().toLowerCase()).equal("50% correct");
3407
+ });
3408
+ cy.get(cesc("#\\/ca")).should("have.text", 0.5);
3409
+ cy.get(cesc(`#\\/srs`))
3410
+ .find(".mjx-mrow")
3411
+ .eq(0)
3412
+ .invoke("text")
3413
+ .then((text) => {
3414
+ expect(text.trim().replace(/−/g, "-")).equal("((6.8,9.1),(6.8,9.1))");
3415
+ });
3416
+
3417
+ cy.log("Move point A away and submit");
3418
+ cy.window().then(async (win) => {
3419
+ await win.callAction1({
3420
+ actionName: "movePoint",
3421
+ componentName: "/A",
3422
+ args: { x: 0.1, y: -1.1 },
3423
+ });
3424
+ });
3425
+
3426
+ cy.log("Submit answer");
3427
+ cy.get(cesc("#\\/_answer1_submit")).click();
3428
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
3429
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
3430
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
3431
+ cy.get(cesc("#\\/_answer1_partial"))
3432
+ .invoke("text")
3433
+ .then((text) => {
3434
+ expect(text.trim().toLowerCase()).equal("50% correct");
3435
+ });
3436
+ cy.get(cesc("#\\/ca")).should("have.text", 0.5);
3437
+ cy.get(cesc(`#\\/srs`))
3438
+ .find(".mjx-mrow")
3439
+ .eq(0)
3440
+ .invoke("text")
3441
+ .then((text) => {
3442
+ expect(text.trim().replace(/−/g, "-")).equal("((0.1,-1.1),(6.8,9.1))");
3443
+ });
3444
+
3445
+ cy.log("Move point A near first goal and submit");
3446
+ cy.window().then(async (win) => {
3447
+ await win.callAction1({
3448
+ actionName: "movePoint",
3449
+ componentName: "/A",
3450
+ args: { x: -3.8, y: 7.6 },
3451
+ });
3452
+ });
3453
+
3454
+ cy.get(cesc("#\\/_answer1_submit")).click();
3455
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
3456
+ cy.get(cesc("#\\/_answer1_correct"))
3457
+ .invoke("text")
3458
+ .then((text) => {
3459
+ expect(text.trim().toLowerCase()).equal("correct");
3460
+ });
3461
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
3462
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
3463
+ cy.get(cesc("#\\/ca")).should("have.text", 1);
3464
+ cy.get(cesc(`#\\/srs`))
3465
+ .find(".mjx-mrow")
3466
+ .eq(0)
3467
+ .invoke("text")
3468
+ .then((text) => {
3469
+ expect(text.trim().replace(/−/g, "-")).equal("((-4.1,7.4),(6.8,9.1))");
3470
+ });
3471
+
3472
+ cy.log("create point C and submit");
3473
+ cy.get(cesc("#\\/n") + " textarea").type("{end}{backspace}3{enter}", {
3474
+ force: true,
3475
+ });
3476
+ cy.get(cesc("#\\/_answer1_submit")).click();
3477
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
3478
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
3479
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
3480
+ cy.get(cesc("#\\/_answer1_partial"))
3481
+ .invoke("text")
3482
+ .then((text) => {
3483
+ expect(text.trim().toLowerCase()).equal("67% correct");
3484
+ });
3485
+ cy.get(cesc("#\\/ca")).should("have.text", 0.667);
3486
+ cy.get(cesc(`#\\/srs`))
3487
+ .find(".mjx-mrow")
3488
+ .eq(0)
3489
+ .invoke("text")
3490
+ .then((text) => {
3491
+ expect(text.trim().replace(/−/g, "-")).equal(
3492
+ "((-4.1,7.4),(6.8,9.1),(3,1))",
3493
+ );
3494
+ });
3495
+
3496
+ cy.log("Move point C near first goal and submit");
3497
+ cy.window().then(async (win) => {
3498
+ await win.callAction1({
3499
+ actionName: "movePoint",
3500
+ componentName: "/C",
3501
+ args: { x: -3.8, y: 7.6 },
3502
+ });
3503
+ });
3504
+
3505
+ cy.get(cesc("#\\/_answer1_submit")).click();
3506
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
3507
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
3508
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
3509
+ cy.get(cesc("#\\/_answer1_partial"))
3510
+ .invoke("text")
3511
+ .then((text) => {
3512
+ expect(text.trim().toLowerCase()).equal("67% correct");
3513
+ });
3514
+ cy.get(cesc("#\\/ca")).should("have.text", 0.667);
3515
+ cy.get(cesc(`#\\/srs`))
3516
+ .find(".mjx-mrow")
3517
+ .eq(0)
3518
+ .invoke("text")
3519
+ .then((text) => {
3520
+ expect(text.trim().replace(/−/g, "-")).equal(
3521
+ "((-4.1,7.4),(6.8,9.1),(-4.1,7.4))",
3522
+ );
3523
+ });
3524
+
3525
+ cy.log("remove point C and submit");
3526
+ cy.get(cesc("#\\/n") + " textarea").type("{end}{backspace}2{enter}", {
3527
+ force: true,
3528
+ });
3529
+ cy.get(cesc("#\\/_answer1_submit")).click();
3530
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
3531
+ cy.get(cesc("#\\/_answer1_correct"))
3532
+ .invoke("text")
3533
+ .then((text) => {
3534
+ expect(text.trim().toLowerCase()).equal("correct");
3535
+ });
3536
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
3537
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
3538
+ cy.get(cesc("#\\/ca")).should("have.text", 1);
3539
+ cy.get(cesc(`#\\/srs`))
3540
+ .find(".mjx-mrow")
3541
+ .eq(0)
3542
+ .invoke("text")
3543
+ .then((text) => {
3544
+ expect(text.trim().replace(/−/g, "-")).equal("((-4.1,7.4),(6.8,9.1))");
3545
+ });
3546
+ });
3547
+
3548
+ it("dynamical number of points, double map, partial match", () => {
3549
+ cy.window().then(async (win) => {
3550
+ win.postMessage(
3551
+ {
3552
+ doenetML: `
3553
+ <text>a</text>
3554
+ <point name="goal1">(-4.1, 7.4)</point>
3555
+ <point name="goal2">(6.8, 9.1)</point>
3556
+ <p>Move points to <copy prop="coords" target="goal1" /> <copy prop="coords" target="goal2" /></p>
3557
+ <p>Number of points: <mathinput prefill="0" name="n" /></p>
3558
+ <p>Number of points 2: <mathinput prefill="0" name="m" /></p>
3559
+ <graph>
3560
+ <map name="map1" assignNames="(A1 ((A2))) (B1 ((B2)))">
3561
+ <template>
3562
+ <point x='$i' y='1'>
3563
+ <constraints>
3564
+ <attractTo><copy target="goal1" /></attractTo>
3565
+ <attractTo><copy target="goal2" /></attractTo>
3566
+ </constraints>
3567
+ </point>
3568
+ <map>
3569
+ <template>
3570
+ <point x='$j' y='2'>
3571
+ <constraints>
3572
+ <attractTo><copy target="goal1" /></attractTo>
3573
+ <attractTo><copy target="goal2" /></attractTo>
3574
+ </constraints>
3575
+ </point>
3576
+ </template>
3577
+ <sources alias="j"><sequence fixed='false' from="1" to="$m" /></sources>
3578
+ </map>
3579
+ </template>
3580
+ <sources alias="i"><sequence fixed='false' from="1" to="$n" /></sources>
3581
+ </map>
3582
+ </graph>
3583
+ <p><answer>
3584
+ <award matchPartial unorderedCompare sourcesAreResponses="map1">
3585
+ <when>
3586
+ <mathlist>$map1</mathlist> = <mathlist>$goal1 $goal2</mathlist>
3587
+ </when>
3588
+ </award>
3589
+ </answer></p>
3590
+ <p>Credit for answer: <copy prop="creditAchieved" target="_answer1" assignNames="ca" /></p>
3591
+ <p>Submitted responses: <math name="srs"><copy prop="submittedResponses" target="_answer1" /></math></p>
3592
+ `,
3593
+ },
3594
+ "*",
3595
+ );
3596
+ });
3597
+
3598
+ cy.get(cesc("#\\/_text1")).should("have.text", "a"); // to wait for page to load
3599
+
3600
+ cy.get(cesc("#\\/goal1") + " .mjx-mrow").should(
3601
+ "contain.text",
3602
+ "(−4.1,7.4)",
3603
+ );
3604
+
3605
+ cy.get(cesc("#\\/_answer1_submit"))
3606
+ .invoke("text")
3607
+ .then((text) => {
3608
+ expect(text.trim().toLowerCase()).equal("check work");
3609
+ });
3610
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
3611
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
3612
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
3613
+
3614
+ cy.log("Submit answer");
3615
+ cy.get(cesc("#\\/_answer1_submit")).click();
3616
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
3617
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
3618
+ cy.get(cesc("#\\/_answer1_incorrect"))
3619
+ .invoke("text")
3620
+ .then((text) => {
3621
+ expect(text.trim().toLowerCase()).equal("incorrect");
3622
+ });
3623
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
3624
+ cy.get(cesc("#\\/ca")).should("have.text", 0);
3625
+ cy.get(cesc(`#\\/srs`))
3626
+ .find(".mjx-mrow")
3627
+ .eq(0)
3628
+ .invoke("text")
3629
+ .then((text) => {
3630
+ expect(text.trim().replace(/−/g, "-")).equal("_");
3631
+ });
3632
+
3633
+ cy.window().then(async (win) => {
3634
+ let stateVariables = await win.returnAllStateVariables1();
3635
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
3636
+ });
3637
+
3638
+ cy.log("Create point A1 and submit");
3639
+ cy.get(cesc("#\\/n") + " textarea").type("{end}{backspace}1{enter}", {
3640
+ force: true,
3641
+ });
3642
+ cy.get(cesc("#\\/_answer1_submit")).click();
3643
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
3644
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
3645
+ cy.get(cesc("#\\/_answer1_incorrect"))
3646
+ .invoke("text")
3647
+ .then((text) => {
3648
+ expect(text.trim().toLowerCase()).equal("incorrect");
3649
+ });
3650
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
3651
+ cy.get(cesc("#\\/ca")).should("have.text", 0);
3652
+ cy.get(cesc(`#\\/srs`))
3653
+ .find(".mjx-mrow")
3654
+ .eq(0)
3655
+ .invoke("text")
3656
+ .then((text) => {
3657
+ expect(text.trim().replace(/−/g, "-")).equal("(1,1)");
3658
+ });
3659
+
3660
+ cy.log("Move A1 near correct point");
3661
+ cy.window().then(async (win) => {
3662
+ await win.callAction1({
3663
+ actionName: "movePoint",
3664
+ componentName: "/A1",
3665
+ args: { x: -4, y: 7.6 },
3666
+ });
3667
+ let stateVariables = await win.returnAllStateVariables1();
3668
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
3669
+ });
3670
+
3671
+ cy.get(cesc("#\\/_answer1_submit"))
3672
+ .invoke("text")
3673
+ .then((text) => {
3674
+ expect(text.trim().toLowerCase()).equal("check work");
3675
+ });
3676
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
3677
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
3678
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
3679
+
3680
+ cy.log("Submit answer");
3681
+ cy.get(cesc("#\\/_answer1_submit")).click();
3682
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
3683
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
3684
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
3685
+ cy.get(cesc("#\\/_answer1_partial"))
3686
+ .invoke("text")
3687
+ .then((text) => {
3688
+ expect(text.trim().toLowerCase()).equal("50% correct");
3689
+ });
3690
+ cy.get(cesc("#\\/ca")).should("have.text", 0.5);
3691
+ cy.get(cesc(`#\\/srs`))
3692
+ .find(".mjx-mrow")
3693
+ .eq(0)
3694
+ .invoke("text")
3695
+ .then((text) => {
3696
+ expect(text.trim().replace(/−/g, "-")).equal("(-4.1,7.4)");
3697
+ });
3698
+
3699
+ cy.log("Move point A1 further away and submit");
3700
+ cy.window().then(async (win) => {
3701
+ await win.callAction1({
3702
+ actionName: "movePoint",
3703
+ componentName: "/A1",
3704
+ args: { x: -3.7, y: 7 },
3705
+ });
3706
+ });
3707
+
3708
+ cy.get(cesc("#\\/_answer1_submit")).click();
3709
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
3710
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
3711
+ cy.get(cesc("#\\/_answer1_incorrect"))
3712
+ .invoke("text")
3713
+ .then((text) => {
3714
+ expect(text.trim().toLowerCase()).equal("incorrect");
3715
+ });
3716
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
3717
+ cy.get(cesc("#\\/ca")).should("have.text", 0.0);
3718
+ cy.get(cesc(`#\\/srs`))
3719
+ .find(".mjx-mrow")
3720
+ .eq(0)
3721
+ .invoke("text")
3722
+ .then((text) => {
3723
+ expect(text.trim().replace(/−/g, "-")).equal("(-3.7,7)");
3724
+ });
3725
+
3726
+ cy.log("create point A2 and submit");
3727
+ cy.get(cesc("#\\/m") + " textarea").type("{end}{backspace}1{enter}", {
3728
+ force: true,
3729
+ });
3730
+ cy.get(cesc("#\\/_answer1_submit")).click();
3731
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
3732
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
3733
+ cy.get(cesc("#\\/_answer1_incorrect"))
3734
+ .invoke("text")
3735
+ .then((text) => {
3736
+ expect(text.trim().toLowerCase()).equal("incorrect");
3737
+ });
3738
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
3739
+ cy.get(cesc("#\\/ca")).should("have.text", 0);
3740
+ cy.get(cesc(`#\\/srs`))
3741
+ .find(".mjx-mrow")
3742
+ .eq(0)
3743
+ .invoke("text")
3744
+ .then((text) => {
3745
+ expect(text.trim().replace(/−/g, "-")).equal("((-3.7,7),(1,2))");
3746
+ });
3747
+
3748
+ cy.log("Move point A2 close and submit");
3749
+ cy.window().then(async (win) => {
3750
+ await win.callAction1({
3751
+ actionName: "movePoint",
3752
+ componentName: "/A2",
3753
+ args: { x: -3.8, y: 7.1 },
3754
+ });
3755
+ });
3756
+
3757
+ cy.get(cesc("#\\/_answer1_submit")).click();
3758
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
3759
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
3760
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
3761
+ cy.get(cesc("#\\/_answer1_partial"))
3762
+ .invoke("text")
3763
+ .then((text) => {
3764
+ expect(text.trim().toLowerCase()).equal("50% correct");
3765
+ });
3766
+ cy.get(cesc("#\\/ca")).should("have.text", 0.5);
3767
+ cy.get(cesc(`#\\/srs`))
3768
+ .find(".mjx-mrow")
3769
+ .eq(0)
3770
+ .invoke("text")
3771
+ .then((text) => {
3772
+ expect(text.trim().replace(/−/g, "-")).equal("((-3.7,7),(-4.1,7.4))");
3773
+ });
3774
+
3775
+ cy.log("Move point A1 close to other goal and submit");
3776
+ cy.window().then(async (win) => {
3777
+ await win.callAction1({
3778
+ actionName: "movePoint",
3779
+ componentName: "/A1",
3780
+ args: { x: 6.9, y: 9.0 },
3781
+ });
3782
+ });
3783
+
3784
+ cy.log("Submit answer");
3785
+ cy.get(cesc("#\\/_answer1_submit")).click();
3786
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
3787
+ cy.get(cesc("#\\/_answer1_correct"))
3788
+ .invoke("text")
3789
+ .then((text) => {
3790
+ expect(text.trim().toLowerCase()).equal("correct");
3791
+ });
3792
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
3793
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
3794
+
3795
+ cy.get(cesc("#\\/ca")).should("have.text", 1);
3796
+ cy.get(cesc(`#\\/srs`))
3797
+ .find(".mjx-mrow")
3798
+ .eq(0)
3799
+ .invoke("text")
3800
+ .then((text) => {
3801
+ expect(text.trim().replace(/−/g, "-")).equal("((6.8,9.1),(-4.1,7.4))");
3802
+ });
3803
+
3804
+ cy.log("Move point A2 away and submit");
3805
+ cy.window().then(async (win) => {
3806
+ await win.callAction1({
3807
+ actionName: "movePoint",
3808
+ componentName: "/A2",
3809
+ args: { x: -9.9, y: -8.8 },
3810
+ });
3811
+ });
3812
+
3813
+ cy.get(cesc("#\\/_answer1_submit")).click();
3814
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
3815
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
3816
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
3817
+ cy.get(cesc("#\\/_answer1_partial"))
3818
+ .invoke("text")
3819
+ .then((text) => {
3820
+ expect(text.trim().toLowerCase()).equal("50% correct");
3821
+ });
3822
+ cy.get(cesc("#\\/ca")).should("have.text", 0.5);
3823
+ cy.get(cesc(`#\\/srs`))
3824
+ .find(".mjx-mrow")
3825
+ .eq(0)
3826
+ .invoke("text")
3827
+ .then((text) => {
3828
+ expect(text.trim().replace(/−/g, "-")).equal("((6.8,9.1),(-9.9,-8.8))");
3829
+ });
3830
+
3831
+ cy.log("Move point A2 close to second goal and submit");
3832
+ cy.window().then(async (win) => {
3833
+ await win.callAction1({
3834
+ actionName: "movePoint",
3835
+ componentName: "/A2",
3836
+ args: { x: 6.7, y: 9 },
3837
+ });
3838
+ });
3839
+
3840
+ cy.log("Submit answer");
3841
+ cy.get(cesc("#\\/_answer1_submit")).click();
3842
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
3843
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
3844
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
3845
+ cy.get(cesc("#\\/_answer1_partial"))
3846
+ .invoke("text")
3847
+ .then((text) => {
3848
+ expect(text.trim().toLowerCase()).equal("50% correct");
3849
+ });
3850
+ cy.get(cesc("#\\/ca")).should("have.text", 0.5);
3851
+ cy.get(cesc(`#\\/srs`))
3852
+ .find(".mjx-mrow")
3853
+ .eq(0)
3854
+ .invoke("text")
3855
+ .then((text) => {
3856
+ expect(text.trim().replace(/−/g, "-")).equal("((6.8,9.1),(6.8,9.1))");
3857
+ });
3858
+
3859
+ cy.log("Move point A1 away and submit");
3860
+ cy.window().then(async (win) => {
3861
+ await win.callAction1({
3862
+ actionName: "movePoint",
3863
+ componentName: "/A1",
3864
+ args: { x: 0.1, y: -1.1 },
3865
+ });
3866
+ });
3867
+
3868
+ cy.log("Submit answer");
3869
+ cy.get(cesc("#\\/_answer1_submit")).click();
3870
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
3871
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
3872
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
3873
+ cy.get(cesc("#\\/_answer1_partial"))
3874
+ .invoke("text")
3875
+ .then((text) => {
3876
+ expect(text.trim().toLowerCase()).equal("50% correct");
3877
+ });
3878
+ cy.get(cesc("#\\/ca")).should("have.text", 0.5);
3879
+ cy.get(cesc(`#\\/srs`))
3880
+ .find(".mjx-mrow")
3881
+ .eq(0)
3882
+ .invoke("text")
3883
+ .then((text) => {
3884
+ expect(text.trim().replace(/−/g, "-")).equal("((0.1,-1.1),(6.8,9.1))");
3885
+ });
3886
+
3887
+ cy.log("Move point A1 near first goal and submit");
3888
+ cy.window().then(async (win) => {
3889
+ await win.callAction1({
3890
+ actionName: "movePoint",
3891
+ componentName: "/A1",
3892
+ args: { x: -3.8, y: 7.6 },
3893
+ });
3894
+ });
3895
+
3896
+ cy.get(cesc("#\\/_answer1_submit")).click();
3897
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
3898
+ cy.get(cesc("#\\/_answer1_correct"))
3899
+ .invoke("text")
3900
+ .then((text) => {
3901
+ expect(text.trim().toLowerCase()).equal("correct");
3902
+ });
3903
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
3904
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
3905
+ cy.get(cesc("#\\/ca")).should("have.text", 1);
3906
+ cy.get(cesc(`#\\/srs`))
3907
+ .find(".mjx-mrow")
3908
+ .eq(0)
3909
+ .invoke("text")
3910
+ .then((text) => {
3911
+ expect(text.trim().replace(/−/g, "-")).equal("((-4.1,7.4),(6.8,9.1))");
3912
+ });
3913
+
3914
+ cy.log("create point B1 and B2 and submit");
3915
+ cy.get(cesc("#\\/n") + " textarea").type("{end}{backspace}2{enter}", {
3916
+ force: true,
3917
+ });
3918
+ cy.get(cesc("#\\/_answer1_submit")).click();
3919
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
3920
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
3921
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
3922
+ cy.get(cesc("#\\/_answer1_partial"))
3923
+ .invoke("text")
3924
+ .then((text) => {
3925
+ expect(text.trim().toLowerCase()).equal("50% correct");
3926
+ });
3927
+ cy.get(cesc("#\\/ca")).should("have.text", 0.5);
3928
+ cy.get(cesc(`#\\/srs`))
3929
+ .find(".mjx-mrow")
3930
+ .eq(0)
3931
+ .invoke("text")
3932
+ .then((text) => {
3933
+ expect(text.trim().replace(/−/g, "-")).equal(
3934
+ "((-4.1,7.4),(6.8,9.1),(2,1),(1,2))",
3935
+ );
3936
+ });
3937
+
3938
+ cy.log("Move point B1 near second goal and submit");
3939
+ cy.window().then(async (win) => {
3940
+ await win.callAction1({
3941
+ actionName: "movePoint",
3942
+ componentName: "/B1",
3943
+ args: { x: 7, y: 9 },
3944
+ });
3945
+ });
3946
+
3947
+ cy.get(cesc("#\\/_answer1_submit")).click();
3948
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
3949
+ cy.get(cesc("#\\/_answer1_correct")).should("not.exist");
3950
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
3951
+ cy.get(cesc("#\\/_answer1_partial"))
3952
+ .invoke("text")
3953
+ .then((text) => {
3954
+ expect(text.trim().toLowerCase()).equal("50% correct");
3955
+ });
3956
+ cy.get(cesc("#\\/ca")).should("have.text", 0.5);
3957
+ cy.get(cesc(`#\\/srs`))
3958
+ .find(".mjx-mrow")
3959
+ .eq(0)
3960
+ .invoke("text")
3961
+ .then((text) => {
3962
+ expect(text.trim().replace(/−/g, "-")).equal(
3963
+ "((-4.1,7.4),(6.8,9.1),(6.8,9.1),(1,2))",
3964
+ );
3965
+ });
3966
+
3967
+ cy.log("remove points A2 and B2 and submit");
3968
+ cy.get(cesc("#\\/m") + " textarea").type("{end}{backspace}0{enter}", {
3969
+ force: true,
3970
+ });
3971
+ cy.get(cesc("#\\/_answer1_submit")).click();
3972
+ cy.get(cesc("#\\/_answer1_submit")).should("not.exist");
3973
+ cy.get(cesc("#\\/_answer1_correct"))
3974
+ .invoke("text")
3975
+ .then((text) => {
3976
+ expect(text.trim().toLowerCase()).equal("correct");
3977
+ });
3978
+ cy.get(cesc("#\\/_answer1_incorrect")).should("not.exist");
3979
+ cy.get(cesc("#\\/_answer1_partial")).should("not.exist");
3980
+ cy.get(cesc("#\\/ca")).should("have.text", 1);
3981
+ cy.get(cesc(`#\\/srs`))
3982
+ .find(".mjx-mrow")
3983
+ .eq(0)
3984
+ .invoke("text")
3985
+ .then((text) => {
3986
+ expect(text.trim().replace(/−/g, "-")).equal("((-4.1,7.4),(6.8,9.1))");
3987
+ });
3988
+ });
3989
+ });