@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,3530 @@
1
+ import { cesc, cesc2 } from "../../../../src/utils/url";
2
+
3
+ describe("Sectioning Tag Tests", function () {
4
+ beforeEach(() => {
5
+ cy.clearIndexedDB();
6
+ cy.visit("/src/Tools/cypressTest/");
7
+ });
8
+
9
+ it("sections default to not aggregating scores", () => {
10
+ cy.window().then(async (win) => {
11
+ win.postMessage(
12
+ {
13
+ doenetML: `
14
+ <title>Activity</title>
15
+ <p>Credit achieved for <copy prop="title" target="_document1" />:
16
+ <copy name="docCa" prop="creditAchieved" target="_document1" />, or <copy name="docPca" prop="percentCreditAchieved" target="_document1" />%</p>
17
+
18
+ <p>Enter <m>u</m>: <answer>u</answer></p>
19
+
20
+ <section name="section1"><title>Section 1</title>
21
+ <p>Credit achieved for <copy prop="title" target="section1" />:
22
+ <copy name="s1Ca" prop="creditAchieved" target="section1" />, or <copy name="s1Pca" prop="percentCreditAchieved" target="section1" />%</p>
23
+
24
+ <p>Enter <m>x</m>: <answer>x</answer></p>
25
+ <p>Enter <m>y</m>: <answer weight="2">y</answer></p>
26
+
27
+
28
+ </section>
29
+ <section name="section2"><title>Section 2</title>
30
+ <p>Credit achieved for <copy prop="title" target="section2" />:
31
+ <copy name="s2Ca" prop="creditAchieved" target="section2" />, or <copy name="s2Pca" prop="percentCreditAchieved" target="section2" />%</p>
32
+
33
+ <p>Enter <m>z</m>: <answer>z</answer></p>
34
+
35
+ <subsection name="section21"><title>Section 2.1</title>
36
+ <p>Credit achieved for <copy prop="title" target="section21" />:
37
+ <copy name="s21Ca" prop="creditAchieved" target="section21" />, or <copy name="s21Pca" prop="percentCreditAchieved" target="section21" />%</p>
38
+
39
+
40
+ <p>Enter <m>v</m>: <answer weight="0.5">v</answer></p>
41
+ <p>Enter <m>w</m>: <answer>w</answer></p>
42
+
43
+ </subsection>
44
+ <subsection name="section22"><title>Section 2.2</title>
45
+ <p>Credit achieved for <copy prop="title" target="section22" />:
46
+ <copy name="s22Ca" prop="creditAchieved" target="section22" />, or <copy name="s22Pca" prop="percentCreditAchieved" target="section22" />%</p>
47
+
48
+ <p>Enter <m>q</m>: <answer>q</answer></p>
49
+
50
+ <subsubsection name="section221"><title>Section 2.2.1</title>
51
+ <p>Credit achieved for <copy prop="title" target="section221" />:
52
+ <copy name="s221Ca" prop="creditAchieved" target="section221" />, or <copy name="s221Pca" prop="percentCreditAchieved" target="section221" />%</p>
53
+
54
+ <p>Enter <m>r</m>: <answer>r</answer></p>
55
+
56
+ </subsubsection>
57
+ <subsubsection name="section222"><title>Section 2.2.2</title>
58
+ <p>Credit achieved for <copy prop="title" target="section222" />:
59
+ <copy name="s222Ca" prop="creditAchieved" target="section222" />, or <copy name="s222Pca" prop="percentCreditAchieved" target="section222" />%</p>
60
+
61
+ <p>Enter <m>s</m>: <answer weight="3">s</answer></p>
62
+
63
+ </subsubsection>
64
+ </subsection>
65
+
66
+ </section>
67
+ `,
68
+ },
69
+ "*",
70
+ );
71
+ });
72
+
73
+ // to wait for page to load
74
+ cy.get(cesc("#\\/_document1_title")).should("have.text", "Activity");
75
+
76
+ cy.window().then(async (win) => {
77
+ let stateVariables = await win.returnAllStateVariables1();
78
+
79
+ let docCaAnchor = cesc2(
80
+ "#" + stateVariables["/docCa"].replacements[0].componentName,
81
+ );
82
+ let docPcaAnchor = cesc2(
83
+ "#" + stateVariables["/docPca"].replacements[0].componentName,
84
+ );
85
+ let s1CaAnchor = cesc2(
86
+ "#" + stateVariables["/s1Ca"].replacements[0].componentName,
87
+ );
88
+ let s1PcaAnchor = cesc2(
89
+ "#" + stateVariables["/s1Pca"].replacements[0].componentName,
90
+ );
91
+ let s2CaAnchor = cesc2(
92
+ "#" + stateVariables["/s2Ca"].replacements[0].componentName,
93
+ );
94
+ let s2PcaAnchor = cesc2(
95
+ "#" + stateVariables["/s2Pca"].replacements[0].componentName,
96
+ );
97
+ let s21CaAnchor = cesc2(
98
+ "#" + stateVariables["/s21Ca"].replacements[0].componentName,
99
+ );
100
+ let s21PcaAnchor = cesc2(
101
+ "#" + stateVariables["/s21Pca"].replacements[0].componentName,
102
+ );
103
+ let s22CaAnchor = cesc2(
104
+ "#" + stateVariables["/s22Ca"].replacements[0].componentName,
105
+ );
106
+ let s22PcaAnchor = cesc2(
107
+ "#" + stateVariables["/s22Pca"].replacements[0].componentName,
108
+ );
109
+ let s221CaAnchor = cesc2(
110
+ "#" + stateVariables["/s221Ca"].replacements[0].componentName,
111
+ );
112
+ let s221PcaAnchor = cesc2(
113
+ "#" + stateVariables["/s221Pca"].replacements[0].componentName,
114
+ );
115
+ let s222CaAnchor = cesc2(
116
+ "#" + stateVariables["/s222Ca"].replacements[0].componentName,
117
+ );
118
+ let s222PcaAnchor = cesc2(
119
+ "#" + stateVariables["/s222Pca"].replacements[0].componentName,
120
+ );
121
+ let mathinput1Anchor =
122
+ cesc2(
123
+ "#" +
124
+ stateVariables["/_answer1"].stateValues.inputChildren[0]
125
+ .componentName,
126
+ ) + " textarea";
127
+ let mathinput2Anchor =
128
+ cesc2(
129
+ "#" +
130
+ stateVariables["/_answer2"].stateValues.inputChildren[0]
131
+ .componentName,
132
+ ) + " textarea";
133
+ let mathinput3Anchor =
134
+ cesc2(
135
+ "#" +
136
+ stateVariables["/_answer3"].stateValues.inputChildren[0]
137
+ .componentName,
138
+ ) + " textarea";
139
+ let mathinput4Anchor =
140
+ cesc2(
141
+ "#" +
142
+ stateVariables["/_answer4"].stateValues.inputChildren[0]
143
+ .componentName,
144
+ ) + " textarea";
145
+ let mathinput5Anchor =
146
+ cesc2(
147
+ "#" +
148
+ stateVariables["/_answer5"].stateValues.inputChildren[0]
149
+ .componentName,
150
+ ) + " textarea";
151
+ let mathinput6Anchor =
152
+ cesc2(
153
+ "#" +
154
+ stateVariables["/_answer6"].stateValues.inputChildren[0]
155
+ .componentName,
156
+ ) + " textarea";
157
+ let mathinput7Anchor =
158
+ cesc2(
159
+ "#" +
160
+ stateVariables["/_answer7"].stateValues.inputChildren[0]
161
+ .componentName,
162
+ ) + " textarea";
163
+ let mathinput8Anchor =
164
+ cesc2(
165
+ "#" +
166
+ stateVariables["/_answer8"].stateValues.inputChildren[0]
167
+ .componentName,
168
+ ) + " textarea";
169
+ let mathinput9Anchor =
170
+ cesc2(
171
+ "#" +
172
+ stateVariables["/_answer9"].stateValues.inputChildren[0]
173
+ .componentName,
174
+ ) + " textarea";
175
+
176
+ let weight = [1, 1, 2, 1, 0.5, 1, 1, 1, 3];
177
+ let totWeight = weight.reduce((a, b) => a + b);
178
+
179
+ cy.get(docCaAnchor).should("have.text", "0");
180
+ cy.get(docPcaAnchor).should("have.text", "0");
181
+ cy.get(s1CaAnchor).should("have.text", "0");
182
+ cy.get(s1PcaAnchor).should("have.text", "0");
183
+ cy.get(s2CaAnchor).should("have.text", "0");
184
+ cy.get(s2PcaAnchor).should("have.text", "0");
185
+ cy.get(s21CaAnchor).should("have.text", "0");
186
+ cy.get(s21PcaAnchor).should("have.text", "0");
187
+ cy.get(s22CaAnchor).should("have.text", "0");
188
+ cy.get(s22PcaAnchor).should("have.text", "0");
189
+ cy.get(s221CaAnchor).should("have.text", "0");
190
+ cy.get(s221PcaAnchor).should("have.text", "0");
191
+ cy.get(s222CaAnchor).should("have.text", "0");
192
+ cy.get(s222PcaAnchor).should("have.text", "0");
193
+
194
+ cy.window().then(async (win) => {
195
+ let stateVariables = await win.returnAllStateVariables1();
196
+ expect(stateVariables["/_document1"].stateValues.creditAchieved).eq(0);
197
+ expect(
198
+ stateVariables["/_document1"].stateValues.percentCreditAchieved,
199
+ ).eq(0);
200
+ expect(stateVariables["/section1"].stateValues.creditAchieved).eq(0);
201
+ expect(
202
+ stateVariables["/section1"].stateValues.percentCreditAchieved,
203
+ ).eq(0);
204
+ expect(stateVariables["/section2"].stateValues.creditAchieved).eq(0);
205
+ expect(
206
+ stateVariables["/section2"].stateValues.percentCreditAchieved,
207
+ ).eq(0);
208
+ expect(stateVariables["/section21"].stateValues.creditAchieved).eq(0);
209
+ expect(
210
+ stateVariables["/section21"].stateValues.percentCreditAchieved,
211
+ ).eq(0);
212
+ expect(stateVariables["/section22"].stateValues.creditAchieved).eq(0);
213
+ expect(
214
+ stateVariables["/section22"].stateValues.percentCreditAchieved,
215
+ ).eq(0);
216
+ expect(stateVariables["/section221"].stateValues.creditAchieved).eq(0);
217
+ expect(
218
+ stateVariables["/section221"].stateValues.percentCreditAchieved,
219
+ ).eq(0);
220
+ expect(stateVariables["/section222"].stateValues.creditAchieved).eq(0);
221
+ expect(
222
+ stateVariables["/section222"].stateValues.percentCreditAchieved,
223
+ ).eq(0);
224
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
225
+ expect(stateVariables["/_answer2"].stateValues.creditAchieved).eq(0);
226
+ expect(stateVariables["/_answer3"].stateValues.creditAchieved).eq(0);
227
+ expect(stateVariables["/_answer4"].stateValues.creditAchieved).eq(0);
228
+ expect(stateVariables["/_answer5"].stateValues.creditAchieved).eq(0);
229
+ expect(stateVariables["/_answer6"].stateValues.creditAchieved).eq(0);
230
+ expect(stateVariables["/_answer7"].stateValues.creditAchieved).eq(0);
231
+ expect(stateVariables["/_answer8"].stateValues.creditAchieved).eq(0);
232
+ expect(stateVariables["/_answer9"].stateValues.creditAchieved).eq(0);
233
+ });
234
+
235
+ cy.log("enter first correct answer");
236
+ cy.get(mathinput1Anchor).type(`u{enter}`, { force: true });
237
+
238
+ let credit1 = weight[0] / totWeight;
239
+ let credit1Round = Math.round(10000 * credit1) / 10000;
240
+ let percentCredit1 = credit1 * 100;
241
+ let percentCredit1Round = credit1Round * 100;
242
+
243
+ cy.get(docCaAnchor).should("have.text", credit1Round.toString());
244
+ cy.get(docPcaAnchor).should("have.text", percentCredit1Round.toString());
245
+ cy.get(s1CaAnchor).should("have.text", "0");
246
+ cy.get(s1PcaAnchor).should("have.text", "0");
247
+ cy.get(s2CaAnchor).should("have.text", "0");
248
+ cy.get(s2PcaAnchor).should("have.text", "0");
249
+ cy.get(s21CaAnchor).should("have.text", "0");
250
+ cy.get(s21PcaAnchor).should("have.text", "0");
251
+ cy.get(s22CaAnchor).should("have.text", "0");
252
+ cy.get(s22PcaAnchor).should("have.text", "0");
253
+ cy.get(s221CaAnchor).should("have.text", "0");
254
+ cy.get(s221PcaAnchor).should("have.text", "0");
255
+ cy.get(s222CaAnchor).should("have.text", "0");
256
+ cy.get(s222PcaAnchor).should("have.text", "0");
257
+
258
+ cy.window().then(async (win) => {
259
+ let stateVariables = await win.returnAllStateVariables1();
260
+ expect(
261
+ stateVariables["/_document1"].stateValues.creditAchieved,
262
+ ).closeTo(credit1, 1e-12);
263
+ expect(
264
+ stateVariables["/_document1"].stateValues.percentCreditAchieved,
265
+ ).closeTo(percentCredit1, 1e-12);
266
+ expect(stateVariables["/section1"].stateValues.creditAchieved).eq(0);
267
+ expect(
268
+ stateVariables["/section1"].stateValues.percentCreditAchieved,
269
+ ).eq(0);
270
+ expect(stateVariables["/section2"].stateValues.creditAchieved).eq(0);
271
+ expect(
272
+ stateVariables["/section2"].stateValues.percentCreditAchieved,
273
+ ).eq(0);
274
+ expect(stateVariables["/section21"].stateValues.creditAchieved).eq(0);
275
+ expect(
276
+ stateVariables["/section21"].stateValues.percentCreditAchieved,
277
+ ).eq(0);
278
+ expect(stateVariables["/section22"].stateValues.creditAchieved).eq(0);
279
+ expect(
280
+ stateVariables["/section22"].stateValues.percentCreditAchieved,
281
+ ).eq(0);
282
+ expect(stateVariables["/section221"].stateValues.creditAchieved).eq(0);
283
+ expect(
284
+ stateVariables["/section221"].stateValues.percentCreditAchieved,
285
+ ).eq(0);
286
+ expect(stateVariables["/section222"].stateValues.creditAchieved).eq(0);
287
+ expect(
288
+ stateVariables["/section222"].stateValues.percentCreditAchieved,
289
+ ).eq(0);
290
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
291
+ expect(stateVariables["/_answer2"].stateValues.creditAchieved).eq(0);
292
+ expect(stateVariables["/_answer3"].stateValues.creditAchieved).eq(0);
293
+ expect(stateVariables["/_answer4"].stateValues.creditAchieved).eq(0);
294
+ expect(stateVariables["/_answer5"].stateValues.creditAchieved).eq(0);
295
+ expect(stateVariables["/_answer6"].stateValues.creditAchieved).eq(0);
296
+ expect(stateVariables["/_answer7"].stateValues.creditAchieved).eq(0);
297
+ expect(stateVariables["/_answer8"].stateValues.creditAchieved).eq(0);
298
+ expect(stateVariables["/_answer9"].stateValues.creditAchieved).eq(0);
299
+ });
300
+
301
+ cy.log("enter additional correct answers");
302
+ cy.get(mathinput3Anchor).type(`y{enter}`, { force: true });
303
+ cy.get(mathinput5Anchor).type(`v{enter}`, { force: true });
304
+ cy.get(mathinput7Anchor).type(`q{enter}`, { force: true });
305
+
306
+ let credit2 = (weight[0] + weight[2] + weight[4] + weight[6]) / totWeight;
307
+ let credit2Round = Math.round(1000 * credit2) / 1000;
308
+ let percentCredit2 = credit2 * 100;
309
+ let percentCredit2Round = credit2Round * 100;
310
+
311
+ cy.get(docCaAnchor).should("have.text", credit2Round.toString());
312
+ cy.get(docPcaAnchor).should("have.text", percentCredit2Round.toString());
313
+ cy.get(s1CaAnchor).should("have.text", "0");
314
+ cy.get(s1PcaAnchor).should("have.text", "0");
315
+ cy.get(s2CaAnchor).should("have.text", "0");
316
+ cy.get(s2PcaAnchor).should("have.text", "0");
317
+ cy.get(s21CaAnchor).should("have.text", "0");
318
+ cy.get(s21PcaAnchor).should("have.text", "0");
319
+ cy.get(s22CaAnchor).should("have.text", "0");
320
+ cy.get(s22PcaAnchor).should("have.text", "0");
321
+ cy.get(s221CaAnchor).should("have.text", "0");
322
+ cy.get(s221PcaAnchor).should("have.text", "0");
323
+ cy.get(s222CaAnchor).should("have.text", "0");
324
+ cy.get(s222PcaAnchor).should("have.text", "0");
325
+
326
+ cy.window().then(async (win) => {
327
+ let stateVariables = await win.returnAllStateVariables1();
328
+ expect(
329
+ stateVariables["/_document1"].stateValues.creditAchieved,
330
+ ).closeTo(credit2, 1e-12);
331
+ expect(
332
+ stateVariables["/_document1"].stateValues.percentCreditAchieved,
333
+ ).closeTo(percentCredit2, 1e-12);
334
+ expect(stateVariables["/section1"].stateValues.creditAchieved).eq(0);
335
+ expect(
336
+ stateVariables["/section1"].stateValues.percentCreditAchieved,
337
+ ).eq(0);
338
+ expect(stateVariables["/section2"].stateValues.creditAchieved).eq(0);
339
+ expect(
340
+ stateVariables["/section2"].stateValues.percentCreditAchieved,
341
+ ).eq(0);
342
+ expect(stateVariables["/section21"].stateValues.creditAchieved).eq(0);
343
+ expect(
344
+ stateVariables["/section21"].stateValues.percentCreditAchieved,
345
+ ).eq(0);
346
+ expect(stateVariables["/section22"].stateValues.creditAchieved).eq(0);
347
+ expect(
348
+ stateVariables["/section22"].stateValues.percentCreditAchieved,
349
+ ).eq(0);
350
+ expect(stateVariables["/section221"].stateValues.creditAchieved).eq(0);
351
+ expect(
352
+ stateVariables["/section221"].stateValues.percentCreditAchieved,
353
+ ).eq(0);
354
+ expect(stateVariables["/section222"].stateValues.creditAchieved).eq(0);
355
+ expect(
356
+ stateVariables["/section222"].stateValues.percentCreditAchieved,
357
+ ).eq(0);
358
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
359
+ expect(stateVariables["/_answer2"].stateValues.creditAchieved).eq(0);
360
+ expect(stateVariables["/_answer3"].stateValues.creditAchieved).eq(1);
361
+ expect(stateVariables["/_answer4"].stateValues.creditAchieved).eq(0);
362
+ expect(stateVariables["/_answer5"].stateValues.creditAchieved).eq(1);
363
+ expect(stateVariables["/_answer6"].stateValues.creditAchieved).eq(0);
364
+ expect(stateVariables["/_answer7"].stateValues.creditAchieved).eq(1);
365
+ expect(stateVariables["/_answer8"].stateValues.creditAchieved).eq(0);
366
+ expect(stateVariables["/_answer9"].stateValues.creditAchieved).eq(0);
367
+ });
368
+
369
+ cy.log("enter most other correct answers");
370
+ cy.get(mathinput2Anchor).type(`x{enter}`, { force: true });
371
+ cy.get(mathinput4Anchor).type(`z{enter}`, { force: true });
372
+ cy.get(mathinput6Anchor).type(`w{enter}`, { force: true });
373
+ cy.get(mathinput8Anchor).type(`r{enter}`, { force: true });
374
+
375
+ let credit3 = 1 - weight[8] / totWeight;
376
+ let credit3Round = Math.round(1000 * credit3) / 1000;
377
+ let percentCredit3 = credit3 * 100;
378
+ let percentCredit3Round = credit3Round * 100;
379
+
380
+ cy.get(docCaAnchor).should("have.text", credit3Round.toString());
381
+ cy.get(docPcaAnchor).should("have.text", percentCredit3Round.toString());
382
+ cy.get(s1CaAnchor).should("have.text", "0");
383
+ cy.get(s1PcaAnchor).should("have.text", "0");
384
+ cy.get(s2CaAnchor).should("have.text", "0");
385
+ cy.get(s2PcaAnchor).should("have.text", "0");
386
+ cy.get(s21CaAnchor).should("have.text", "0");
387
+ cy.get(s21PcaAnchor).should("have.text", "0");
388
+ cy.get(s22CaAnchor).should("have.text", "0");
389
+ cy.get(s22PcaAnchor).should("have.text", "0");
390
+ cy.get(s221CaAnchor).should("have.text", "0");
391
+ cy.get(s221PcaAnchor).should("have.text", "0");
392
+ cy.get(s222CaAnchor).should("have.text", "0");
393
+ cy.get(s222PcaAnchor).should("have.text", "0");
394
+
395
+ cy.window().then(async (win) => {
396
+ let stateVariables = await win.returnAllStateVariables1();
397
+ expect(
398
+ stateVariables["/_document1"].stateValues.creditAchieved,
399
+ ).closeTo(credit3, 1e-12);
400
+ expect(
401
+ stateVariables["/_document1"].stateValues.percentCreditAchieved,
402
+ ).closeTo(percentCredit3, 1e-12);
403
+ expect(stateVariables["/section1"].stateValues.creditAchieved).eq(0);
404
+ expect(
405
+ stateVariables["/section1"].stateValues.percentCreditAchieved,
406
+ ).eq(0);
407
+ expect(stateVariables["/section2"].stateValues.creditAchieved).eq(0);
408
+ expect(
409
+ stateVariables["/section2"].stateValues.percentCreditAchieved,
410
+ ).eq(0);
411
+ expect(stateVariables["/section21"].stateValues.creditAchieved).eq(0);
412
+ expect(
413
+ stateVariables["/section21"].stateValues.percentCreditAchieved,
414
+ ).eq(0);
415
+ expect(stateVariables["/section22"].stateValues.creditAchieved).eq(0);
416
+ expect(
417
+ stateVariables["/section22"].stateValues.percentCreditAchieved,
418
+ ).eq(0);
419
+ expect(stateVariables["/section221"].stateValues.creditAchieved).eq(0);
420
+ expect(
421
+ stateVariables["/section221"].stateValues.percentCreditAchieved,
422
+ ).eq(0);
423
+ expect(stateVariables["/section222"].stateValues.creditAchieved).eq(0);
424
+ expect(
425
+ stateVariables["/section222"].stateValues.percentCreditAchieved,
426
+ ).eq(0);
427
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
428
+ expect(stateVariables["/_answer2"].stateValues.creditAchieved).eq(1);
429
+ expect(stateVariables["/_answer3"].stateValues.creditAchieved).eq(1);
430
+ expect(stateVariables["/_answer4"].stateValues.creditAchieved).eq(1);
431
+ expect(stateVariables["/_answer5"].stateValues.creditAchieved).eq(1);
432
+ expect(stateVariables["/_answer6"].stateValues.creditAchieved).eq(1);
433
+ expect(stateVariables["/_answer7"].stateValues.creditAchieved).eq(1);
434
+ expect(stateVariables["/_answer8"].stateValues.creditAchieved).eq(1);
435
+ expect(stateVariables["/_answer9"].stateValues.creditAchieved).eq(0);
436
+ });
437
+
438
+ cy.log("enter last correct answer");
439
+ cy.get(mathinput9Anchor).type(`s{enter}`, { force: true });
440
+
441
+ let credit4 = 1;
442
+ let credit4Round = Math.round(1000 * credit4) / 1000;
443
+ let percentCredit4 = credit4 * 100;
444
+ let percentCredit4Round = credit4Round * 100;
445
+
446
+ cy.get(docCaAnchor).should("have.text", credit4Round.toString());
447
+ cy.get(docPcaAnchor).should("have.text", percentCredit4Round.toString());
448
+ cy.get(s1CaAnchor).should("have.text", "0");
449
+ cy.get(s1PcaAnchor).should("have.text", "0");
450
+ cy.get(s2CaAnchor).should("have.text", "0");
451
+ cy.get(s2PcaAnchor).should("have.text", "0");
452
+ cy.get(s21CaAnchor).should("have.text", "0");
453
+ cy.get(s21PcaAnchor).should("have.text", "0");
454
+ cy.get(s22CaAnchor).should("have.text", "0");
455
+ cy.get(s22PcaAnchor).should("have.text", "0");
456
+ cy.get(s221CaAnchor).should("have.text", "0");
457
+ cy.get(s221PcaAnchor).should("have.text", "0");
458
+ cy.get(s222CaAnchor).should("have.text", "0");
459
+ cy.get(s222PcaAnchor).should("have.text", "0");
460
+
461
+ cy.window().then(async (win) => {
462
+ let stateVariables = await win.returnAllStateVariables1();
463
+ expect(
464
+ stateVariables["/_document1"].stateValues.creditAchieved,
465
+ ).closeTo(credit4, 1e-12);
466
+ expect(
467
+ stateVariables["/_document1"].stateValues.percentCreditAchieved,
468
+ ).closeTo(percentCredit4, 1e-12);
469
+ expect(stateVariables["/section1"].stateValues.creditAchieved).eq(0);
470
+ expect(
471
+ stateVariables["/section1"].stateValues.percentCreditAchieved,
472
+ ).eq(0);
473
+ expect(stateVariables["/section2"].stateValues.creditAchieved).eq(0);
474
+ expect(
475
+ stateVariables["/section2"].stateValues.percentCreditAchieved,
476
+ ).eq(0);
477
+ expect(stateVariables["/section21"].stateValues.creditAchieved).eq(0);
478
+ expect(
479
+ stateVariables["/section21"].stateValues.percentCreditAchieved,
480
+ ).eq(0);
481
+ expect(stateVariables["/section22"].stateValues.creditAchieved).eq(0);
482
+ expect(
483
+ stateVariables["/section22"].stateValues.percentCreditAchieved,
484
+ ).eq(0);
485
+ expect(stateVariables["/section221"].stateValues.creditAchieved).eq(0);
486
+ expect(
487
+ stateVariables["/section221"].stateValues.percentCreditAchieved,
488
+ ).eq(0);
489
+ expect(stateVariables["/section222"].stateValues.creditAchieved).eq(0);
490
+ expect(
491
+ stateVariables["/section222"].stateValues.percentCreditAchieved,
492
+ ).eq(0);
493
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
494
+ expect(stateVariables["/_answer2"].stateValues.creditAchieved).eq(1);
495
+ expect(stateVariables["/_answer3"].stateValues.creditAchieved).eq(1);
496
+ expect(stateVariables["/_answer4"].stateValues.creditAchieved).eq(1);
497
+ expect(stateVariables["/_answer5"].stateValues.creditAchieved).eq(1);
498
+ expect(stateVariables["/_answer6"].stateValues.creditAchieved).eq(1);
499
+ expect(stateVariables["/_answer7"].stateValues.creditAchieved).eq(1);
500
+ expect(stateVariables["/_answer8"].stateValues.creditAchieved).eq(1);
501
+ expect(stateVariables["/_answer9"].stateValues.creditAchieved).eq(1);
502
+ });
503
+ });
504
+ });
505
+
506
+ it("sections aggregating scores default to weight 1", () => {
507
+ cy.window().then(async (win) => {
508
+ win.postMessage(
509
+ {
510
+ doenetML: `
511
+ <title>Activity</title>
512
+ <p>Credit achieved for <copy prop="title" target="_document1" />:
513
+ <copy name="docCa" prop="creditAchieved" target="_document1" />, or <copy name="docPca" prop="percentCreditAchieved" target="_document1" />%</p>
514
+
515
+ <p>Enter <m>u</m>: <answer>u</answer></p>
516
+
517
+ <section name="section1" aggregatescores><title>Section 1</title>
518
+ <p>Credit achieved for <copy prop="title" target="section1" />:
519
+ <copy name="s1Ca" prop="creditAchieved" target="section1" />, or <copy name="s1Pca" prop="percentCreditAchieved" target="section1" />%</p>
520
+
521
+ <p>Enter <m>x</m>: <answer>x</answer></p>
522
+ <p>Enter <m>y</m>: <answer weight="2">y</answer></p>
523
+
524
+
525
+ </section>
526
+ <section name="section2" aggregatescores><title>Section 2</title>
527
+ <p>Credit achieved for <copy prop="title" target="section2" />:
528
+ <copy name="s2Ca" prop="creditAchieved" target="section2" />, or <copy name="s2Pca" prop="percentCreditAchieved" target="section2" />%</p>
529
+
530
+ <p>Enter <m>z</m>: <answer>z</answer></p>
531
+
532
+ <subsection name="section21" aggregatescores><title>Section 2.1</title>
533
+ <p>Credit achieved for <copy prop="title" target="section21" />:
534
+ <copy name="s21Ca" prop="creditAchieved" target="section21" />, or <copy name="s21Pca" prop="percentCreditAchieved" target="section21" />%</p>
535
+
536
+
537
+ <p>Enter <m>v</m>: <answer weight="0.5">v</answer></p>
538
+ <p>Enter <m>w</m>: <answer>w</answer></p>
539
+
540
+ </subsection>
541
+ <subsection name="section22"><title>Section 2.2</title>
542
+ <p>Credit achieved for <copy prop="title" target="section22" />:
543
+ <copy name="s22Ca" prop="creditAchieved" target="section22" />, or <copy name="s22Pca" prop="percentCreditAchieved" target="section22" />%</p>
544
+
545
+ <p>Enter <m>q</m>: <answer>q</answer></p>
546
+
547
+ <subsubsection name="section221" aggregatescores><title>Section 2.2.1</title>
548
+ <p>Credit achieved for <copy prop="title" target="section221" />:
549
+ <copy name="s221Ca" prop="creditAchieved" target="section221" />, or <copy name="s221Pca" prop="percentCreditAchieved" target="section221" />%</p>
550
+
551
+ <p>Enter <m>r</m>: <answer>r</answer></p>
552
+
553
+ </subsubsection>
554
+ <subsubsection name="section222" aggregatescores><title>Section 2.2.2</title>
555
+ <p>Credit achieved for <copy prop="title" target="section222" />:
556
+ <copy name="s222Ca" prop="creditAchieved" target="section222" />, or <copy name="s222Pca" prop="percentCreditAchieved" target="section222" />%</p>
557
+
558
+ <p>Enter <m>s</m>: <answer weight="3">s</answer></p>
559
+
560
+ </subsubsection>
561
+ </subsection>
562
+
563
+ </section>
564
+ `,
565
+ },
566
+ "*",
567
+ );
568
+ });
569
+
570
+ // to wait for page to load
571
+ cy.get(cesc("#\\/_document1_title")).should("have.text", "Activity");
572
+
573
+ cy.window().then(async (win) => {
574
+ let stateVariables = await win.returnAllStateVariables1();
575
+
576
+ let docCaAnchor = cesc2(
577
+ "#" + stateVariables["/docCa"].replacements[0].componentName,
578
+ );
579
+ let docPcaAnchor = cesc2(
580
+ "#" + stateVariables["/docPca"].replacements[0].componentName,
581
+ );
582
+ let s1CaAnchor = cesc2(
583
+ "#" + stateVariables["/s1Ca"].replacements[0].componentName,
584
+ );
585
+ let s1PcaAnchor = cesc2(
586
+ "#" + stateVariables["/s1Pca"].replacements[0].componentName,
587
+ );
588
+ let s2CaAnchor = cesc2(
589
+ "#" + stateVariables["/s2Ca"].replacements[0].componentName,
590
+ );
591
+ let s2PcaAnchor = cesc2(
592
+ "#" + stateVariables["/s2Pca"].replacements[0].componentName,
593
+ );
594
+ let s21CaAnchor = cesc2(
595
+ "#" + stateVariables["/s21Ca"].replacements[0].componentName,
596
+ );
597
+ let s21PcaAnchor = cesc2(
598
+ "#" + stateVariables["/s21Pca"].replacements[0].componentName,
599
+ );
600
+ let s22CaAnchor = cesc2(
601
+ "#" + stateVariables["/s22Ca"].replacements[0].componentName,
602
+ );
603
+ let s22PcaAnchor = cesc2(
604
+ "#" + stateVariables["/s22Pca"].replacements[0].componentName,
605
+ );
606
+ let s221CaAnchor = cesc2(
607
+ "#" + stateVariables["/s221Ca"].replacements[0].componentName,
608
+ );
609
+ let s221PcaAnchor = cesc2(
610
+ "#" + stateVariables["/s221Pca"].replacements[0].componentName,
611
+ );
612
+ let s222CaAnchor = cesc2(
613
+ "#" + stateVariables["/s222Ca"].replacements[0].componentName,
614
+ );
615
+ let s222PcaAnchor = cesc2(
616
+ "#" + stateVariables["/s222Pca"].replacements[0].componentName,
617
+ );
618
+ let mathinput1Anchor =
619
+ cesc2(
620
+ "#" +
621
+ stateVariables["/_answer1"].stateValues.inputChildren[0]
622
+ .componentName,
623
+ ) + " textarea";
624
+ let mathinput2Anchor =
625
+ cesc2(
626
+ "#" +
627
+ stateVariables["/_answer2"].stateValues.inputChildren[0]
628
+ .componentName,
629
+ ) + " textarea";
630
+ let mathinput3Anchor =
631
+ cesc2(
632
+ "#" +
633
+ stateVariables["/_answer3"].stateValues.inputChildren[0]
634
+ .componentName,
635
+ ) + " textarea";
636
+ let mathinput4Anchor =
637
+ cesc2(
638
+ "#" +
639
+ stateVariables["/_answer4"].stateValues.inputChildren[0]
640
+ .componentName,
641
+ ) + " textarea";
642
+ let mathinput5Anchor =
643
+ cesc2(
644
+ "#" +
645
+ stateVariables["/_answer5"].stateValues.inputChildren[0]
646
+ .componentName,
647
+ ) + " textarea";
648
+ let mathinput6Anchor =
649
+ cesc2(
650
+ "#" +
651
+ stateVariables["/_answer6"].stateValues.inputChildren[0]
652
+ .componentName,
653
+ ) + " textarea";
654
+ let mathinput7Anchor =
655
+ cesc2(
656
+ "#" +
657
+ stateVariables["/_answer7"].stateValues.inputChildren[0]
658
+ .componentName,
659
+ ) + " textarea";
660
+ let mathinput8Anchor =
661
+ cesc2(
662
+ "#" +
663
+ stateVariables["/_answer8"].stateValues.inputChildren[0]
664
+ .componentName,
665
+ ) + " textarea";
666
+ let mathinput9Anchor =
667
+ cesc2(
668
+ "#" +
669
+ stateVariables["/_answer9"].stateValues.inputChildren[0]
670
+ .componentName,
671
+ ) + " textarea";
672
+
673
+ cy.get(docCaAnchor).should("have.text", "0");
674
+ cy.get(docPcaAnchor).should("have.text", "0");
675
+ cy.get(s1CaAnchor).should("have.text", "0");
676
+ cy.get(s1PcaAnchor).should("have.text", "0");
677
+ cy.get(s2CaAnchor).should("have.text", "0");
678
+ cy.get(s2PcaAnchor).should("have.text", "0");
679
+ cy.get(s21CaAnchor).should("have.text", "0");
680
+ cy.get(s21PcaAnchor).should("have.text", "0");
681
+ cy.get(s22CaAnchor).should("have.text", "0");
682
+ cy.get(s22PcaAnchor).should("have.text", "0");
683
+ cy.get(s221CaAnchor).should("have.text", "0");
684
+ cy.get(s221PcaAnchor).should("have.text", "0");
685
+ cy.get(s222CaAnchor).should("have.text", "0");
686
+ cy.get(s222PcaAnchor).should("have.text", "0");
687
+
688
+ cy.window().then(async (win) => {
689
+ let stateVariables = await win.returnAllStateVariables1();
690
+ expect(stateVariables["/_document1"].stateValues.creditAchieved).eq(0);
691
+ expect(
692
+ stateVariables["/_document1"].stateValues.percentCreditAchieved,
693
+ ).eq(0);
694
+ expect(stateVariables["/section1"].stateValues.creditAchieved).eq(0);
695
+ expect(
696
+ stateVariables["/section1"].stateValues.percentCreditAchieved,
697
+ ).eq(0);
698
+ expect(stateVariables["/section2"].stateValues.creditAchieved).eq(0);
699
+ expect(
700
+ stateVariables["/section2"].stateValues.percentCreditAchieved,
701
+ ).eq(0);
702
+ expect(stateVariables["/section21"].stateValues.creditAchieved).eq(0);
703
+ expect(
704
+ stateVariables["/section21"].stateValues.percentCreditAchieved,
705
+ ).eq(0);
706
+ expect(stateVariables["/section22"].stateValues.creditAchieved).eq(0);
707
+ expect(
708
+ stateVariables["/section22"].stateValues.percentCreditAchieved,
709
+ ).eq(0);
710
+ expect(stateVariables["/section221"].stateValues.creditAchieved).eq(0);
711
+ expect(
712
+ stateVariables["/section221"].stateValues.percentCreditAchieved,
713
+ ).eq(0);
714
+ expect(stateVariables["/section222"].stateValues.creditAchieved).eq(0);
715
+ expect(
716
+ stateVariables["/section222"].stateValues.percentCreditAchieved,
717
+ ).eq(0);
718
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
719
+ expect(stateVariables["/_answer2"].stateValues.creditAchieved).eq(0);
720
+ expect(stateVariables["/_answer3"].stateValues.creditAchieved).eq(0);
721
+ expect(stateVariables["/_answer4"].stateValues.creditAchieved).eq(0);
722
+ expect(stateVariables["/_answer5"].stateValues.creditAchieved).eq(0);
723
+ expect(stateVariables["/_answer6"].stateValues.creditAchieved).eq(0);
724
+ expect(stateVariables["/_answer7"].stateValues.creditAchieved).eq(0);
725
+ expect(stateVariables["/_answer8"].stateValues.creditAchieved).eq(0);
726
+ expect(stateVariables["/_answer9"].stateValues.creditAchieved).eq(0);
727
+ });
728
+
729
+ cy.log("enter first correct answer");
730
+ cy.get(mathinput1Anchor).type(`u{enter}`, { force: true });
731
+
732
+ let credit1 = 1 / 3;
733
+ let credit1Round = Math.round(1000 * credit1) / 1000;
734
+ let percentCredit1 = credit1 * 100;
735
+ let percentCredit1Round = Math.round(10 * percentCredit1) / 10;
736
+
737
+ cy.get(docCaAnchor).should("have.text", credit1Round.toString());
738
+ cy.get(docPcaAnchor).should("have.text", percentCredit1Round.toString());
739
+ cy.get(s1CaAnchor).should("have.text", "0");
740
+ cy.get(s1PcaAnchor).should("have.text", "0");
741
+ cy.get(s2CaAnchor).should("have.text", "0");
742
+ cy.get(s2PcaAnchor).should("have.text", "0");
743
+ cy.get(s21CaAnchor).should("have.text", "0");
744
+ cy.get(s21PcaAnchor).should("have.text", "0");
745
+ cy.get(s22CaAnchor).should("have.text", "0");
746
+ cy.get(s22PcaAnchor).should("have.text", "0");
747
+ cy.get(s221CaAnchor).should("have.text", "0");
748
+ cy.get(s221PcaAnchor).should("have.text", "0");
749
+ cy.get(s222CaAnchor).should("have.text", "0");
750
+ cy.get(s222PcaAnchor).should("have.text", "0");
751
+
752
+ cy.window().then(async (win) => {
753
+ let stateVariables = await win.returnAllStateVariables1();
754
+ expect(
755
+ stateVariables["/_document1"].stateValues.creditAchieved,
756
+ ).closeTo(credit1, 1e-12);
757
+ expect(
758
+ stateVariables["/_document1"].stateValues.percentCreditAchieved,
759
+ ).closeTo(percentCredit1, 1e-12);
760
+ expect(stateVariables["/section1"].stateValues.creditAchieved).eq(0);
761
+ expect(
762
+ stateVariables["/section1"].stateValues.percentCreditAchieved,
763
+ ).eq(0);
764
+ expect(stateVariables["/section2"].stateValues.creditAchieved).eq(0);
765
+ expect(
766
+ stateVariables["/section2"].stateValues.percentCreditAchieved,
767
+ ).eq(0);
768
+ expect(stateVariables["/section21"].stateValues.creditAchieved).eq(0);
769
+ expect(
770
+ stateVariables["/section21"].stateValues.percentCreditAchieved,
771
+ ).eq(0);
772
+ expect(stateVariables["/section22"].stateValues.creditAchieved).eq(0);
773
+ expect(
774
+ stateVariables["/section22"].stateValues.percentCreditAchieved,
775
+ ).eq(0);
776
+ expect(stateVariables["/section221"].stateValues.creditAchieved).eq(0);
777
+ expect(
778
+ stateVariables["/section221"].stateValues.percentCreditAchieved,
779
+ ).eq(0);
780
+ expect(stateVariables["/section222"].stateValues.creditAchieved).eq(0);
781
+ expect(
782
+ stateVariables["/section222"].stateValues.percentCreditAchieved,
783
+ ).eq(0);
784
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
785
+ expect(stateVariables["/_answer2"].stateValues.creditAchieved).eq(0);
786
+ expect(stateVariables["/_answer3"].stateValues.creditAchieved).eq(0);
787
+ expect(stateVariables["/_answer4"].stateValues.creditAchieved).eq(0);
788
+ expect(stateVariables["/_answer5"].stateValues.creditAchieved).eq(0);
789
+ expect(stateVariables["/_answer6"].stateValues.creditAchieved).eq(0);
790
+ expect(stateVariables["/_answer7"].stateValues.creditAchieved).eq(0);
791
+ expect(stateVariables["/_answer8"].stateValues.creditAchieved).eq(0);
792
+ expect(stateVariables["/_answer9"].stateValues.creditAchieved).eq(0);
793
+ });
794
+
795
+ cy.log("enter additional correct answers");
796
+ cy.get(mathinput3Anchor).type(`y{enter}`, { force: true });
797
+ cy.get(mathinput5Anchor).type(`v{enter}`, { force: true });
798
+ cy.get(mathinput7Anchor).type(`q{enter}`, { force: true });
799
+
800
+ let section1credit2 = 2 / 3;
801
+ let section1credit2Round = Math.round(1000 * section1credit2) / 1000;
802
+ let section1percentCredit2 = section1credit2 * 100;
803
+ let section1percentCredit2Round =
804
+ Math.round(10 * section1percentCredit2) / 10;
805
+
806
+ let section21credit2 = 1 / 3;
807
+ let section21credit2Round = Math.round(1000 * section21credit2) / 1000;
808
+ let section21percentCredit2 = section21credit2 * 100;
809
+ let section21percentCredit2Round =
810
+ Math.round(10 * section21percentCredit2) / 10;
811
+
812
+ let section2credit2 = (section21credit2 + 1) / 5;
813
+ let section2credit2Round = Math.round(1000 * section2credit2) / 1000;
814
+ let section2percentCredit2 = section2credit2 * 100;
815
+ let section2percentCredit2Round =
816
+ Math.round(10 * section2percentCredit2) / 10;
817
+
818
+ let credit2 = (1 + section1credit2 + section2credit2) / 3;
819
+ let credit2Round = Math.round(1000 * credit2) / 1000;
820
+ let percentCredit2 = credit2 * 100;
821
+ let percentCredit2Round = Math.round(10 * percentCredit2) / 10;
822
+
823
+ cy.get(docCaAnchor).should("have.text", credit2Round.toString());
824
+ cy.get(docPcaAnchor).should("have.text", percentCredit2Round.toString());
825
+ cy.get(s1CaAnchor).should("have.text", section1credit2Round.toString());
826
+ cy.get(s1PcaAnchor).should(
827
+ "have.text",
828
+ section1percentCredit2Round.toString(),
829
+ );
830
+ cy.get(s2CaAnchor).should("have.text", section2credit2Round.toString());
831
+ cy.get(s2PcaAnchor).should(
832
+ "have.text",
833
+ section2percentCredit2Round.toString(),
834
+ );
835
+ cy.get(s21CaAnchor).should("have.text", section21credit2Round.toString());
836
+ cy.get(s21PcaAnchor).should(
837
+ "have.text",
838
+ section21percentCredit2Round.toString(),
839
+ );
840
+ cy.get(s22CaAnchor).should("have.text", "0");
841
+ cy.get(s22PcaAnchor).should("have.text", "0");
842
+ cy.get(s221CaAnchor).should("have.text", "0");
843
+ cy.get(s221PcaAnchor).should("have.text", "0");
844
+ cy.get(s222CaAnchor).should("have.text", "0");
845
+ cy.get(s222PcaAnchor).should("have.text", "0");
846
+
847
+ cy.window().then(async (win) => {
848
+ let stateVariables = await win.returnAllStateVariables1();
849
+ expect(
850
+ stateVariables["/_document1"].stateValues.creditAchieved,
851
+ ).closeTo(credit2, 1e-12);
852
+ expect(
853
+ stateVariables["/_document1"].stateValues.percentCreditAchieved,
854
+ ).closeTo(percentCredit2, 1e-12);
855
+ expect(stateVariables["/section1"].stateValues.creditAchieved).closeTo(
856
+ section1credit2,
857
+ 1e-12,
858
+ );
859
+ expect(
860
+ stateVariables["/section1"].stateValues.percentCreditAchieved,
861
+ ).closeTo(section1percentCredit2, 1e-12);
862
+ expect(stateVariables["/section2"].stateValues.creditAchieved).closeTo(
863
+ section2credit2,
864
+ 1e-12,
865
+ );
866
+ expect(
867
+ stateVariables["/section2"].stateValues.percentCreditAchieved,
868
+ ).closeTo(section2percentCredit2, 1e-12);
869
+ expect(stateVariables["/section21"].stateValues.creditAchieved).closeTo(
870
+ section21credit2,
871
+ 1e-12,
872
+ );
873
+ expect(
874
+ stateVariables["/section21"].stateValues.percentCreditAchieved,
875
+ ).closeTo(section21percentCredit2, 1e-12);
876
+ expect(stateVariables["/section22"].stateValues.creditAchieved).eq(0);
877
+ expect(
878
+ stateVariables["/section22"].stateValues.percentCreditAchieved,
879
+ ).eq(0);
880
+ expect(stateVariables["/section221"].stateValues.creditAchieved).eq(0);
881
+ expect(
882
+ stateVariables["/section221"].stateValues.percentCreditAchieved,
883
+ ).eq(0);
884
+ expect(stateVariables["/section222"].stateValues.creditAchieved).eq(0);
885
+ expect(
886
+ stateVariables["/section222"].stateValues.percentCreditAchieved,
887
+ ).eq(0);
888
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
889
+ expect(stateVariables["/_answer2"].stateValues.creditAchieved).eq(0);
890
+ expect(stateVariables["/_answer3"].stateValues.creditAchieved).eq(1);
891
+ expect(stateVariables["/_answer4"].stateValues.creditAchieved).eq(0);
892
+ expect(stateVariables["/_answer5"].stateValues.creditAchieved).eq(1);
893
+ expect(stateVariables["/_answer6"].stateValues.creditAchieved).eq(0);
894
+ expect(stateVariables["/_answer7"].stateValues.creditAchieved).eq(1);
895
+ expect(stateVariables["/_answer8"].stateValues.creditAchieved).eq(0);
896
+ expect(stateVariables["/_answer9"].stateValues.creditAchieved).eq(0);
897
+ });
898
+
899
+ cy.log("enter most other correct answers");
900
+ cy.get(mathinput2Anchor).type(`x{enter}`, { force: true });
901
+ cy.get(mathinput4Anchor).type(`z{enter}`, { force: true });
902
+ cy.get(mathinput6Anchor).type(`w{enter}`, { force: true });
903
+ cy.get(mathinput8Anchor).type(`r{enter}`, { force: true });
904
+
905
+ let section1credit3 = 1;
906
+ let section1credit3Round = Math.round(1000 * section1credit3) / 1000;
907
+ let section1percentCredit3 = section1credit3 * 100;
908
+ let section1percentCredit3Round =
909
+ Math.round(10 * section1percentCredit3) / 10;
910
+
911
+ let section221credit3 = 1;
912
+ let section221credit3Round = Math.round(1000 * section221credit3) / 1000;
913
+ let section221percentCredit3 = section221credit3 * 100;
914
+ let section221percentCredit3Round =
915
+ Math.round(10 * section221percentCredit3) / 10;
916
+
917
+ let section21credit3 = 1;
918
+ let section21credit3Round = Math.round(1000 * section21credit3) / 1000;
919
+ let section21percentCredit3 = section21credit3 * 100;
920
+ let section21percentCredit3Round =
921
+ Math.round(10 * section21percentCredit3) / 10;
922
+
923
+ let section2credit3 = (section21credit3 + 3) / 5;
924
+ let section2credit3Round = Math.round(1000 * section2credit3) / 1000;
925
+ let section2percentCredit3 = section2credit3 * 100;
926
+ let section2percentCredit3Round =
927
+ Math.round(10 * section2percentCredit3) / 10;
928
+
929
+ let credit3 = (1 + section1credit3 + section2credit3) / 3;
930
+ let credit3Round = Math.round(1000 * credit3) / 1000;
931
+ let percentCredit3 = credit3 * 100;
932
+ let percentCredit3Round = Math.round(10 * percentCredit3) / 10;
933
+
934
+ cy.get(docCaAnchor).should("have.text", credit3Round.toString());
935
+ cy.get(docPcaAnchor).should("have.text", percentCredit3Round.toString());
936
+ cy.get(s1CaAnchor).should("have.text", section1credit3Round.toString());
937
+ cy.get(s1PcaAnchor).should(
938
+ "have.text",
939
+ section1percentCredit3Round.toString(),
940
+ );
941
+ cy.get(s2CaAnchor).should("have.text", section2credit3Round.toString());
942
+ cy.get(s2PcaAnchor).should(
943
+ "have.text",
944
+ section2percentCredit3Round.toString(),
945
+ );
946
+ cy.get(s21CaAnchor).should("have.text", section21credit3Round.toString());
947
+ cy.get(s21PcaAnchor).should(
948
+ "have.text",
949
+ section21percentCredit3Round.toString(),
950
+ );
951
+ cy.get(s22CaAnchor).should("have.text", "0");
952
+ cy.get(s22PcaAnchor).should("have.text", "0");
953
+ cy.get(s221CaAnchor).should(
954
+ "have.text",
955
+ section221credit3Round.toString(),
956
+ );
957
+ cy.get(s221PcaAnchor).should(
958
+ "have.text",
959
+ section221percentCredit3Round.toString(),
960
+ );
961
+ cy.get(s222CaAnchor).should("have.text", "0");
962
+ cy.get(s222PcaAnchor).should("have.text", "0");
963
+
964
+ cy.window().then(async (win) => {
965
+ let stateVariables = await win.returnAllStateVariables1();
966
+ expect(
967
+ stateVariables["/_document1"].stateValues.creditAchieved,
968
+ ).closeTo(credit3, 1e-12);
969
+ expect(
970
+ stateVariables["/_document1"].stateValues.percentCreditAchieved,
971
+ ).closeTo(percentCredit3, 1e-12);
972
+ expect(stateVariables["/section1"].stateValues.creditAchieved).closeTo(
973
+ section1credit3,
974
+ 1e-12,
975
+ );
976
+ expect(
977
+ stateVariables["/section1"].stateValues.percentCreditAchieved,
978
+ ).closeTo(section1percentCredit3, 1e-12);
979
+ expect(stateVariables["/section2"].stateValues.creditAchieved).closeTo(
980
+ section2credit3,
981
+ 1e-12,
982
+ );
983
+ expect(
984
+ stateVariables["/section2"].stateValues.percentCreditAchieved,
985
+ ).closeTo(section2percentCredit3, 1e-12);
986
+ expect(stateVariables["/section21"].stateValues.creditAchieved).closeTo(
987
+ section21credit3,
988
+ 1e-12,
989
+ );
990
+ expect(
991
+ stateVariables["/section21"].stateValues.percentCreditAchieved,
992
+ ).closeTo(section21percentCredit3, 1e-12);
993
+ expect(stateVariables["/section22"].stateValues.creditAchieved).eq(0);
994
+ expect(
995
+ stateVariables["/section22"].stateValues.percentCreditAchieved,
996
+ ).eq(0);
997
+ expect(
998
+ stateVariables["/section221"].stateValues.creditAchieved,
999
+ ).closeTo(section221credit3, 1e-12);
1000
+ expect(
1001
+ stateVariables["/section221"].stateValues.percentCreditAchieved,
1002
+ ).closeTo(section221percentCredit3, 1e-12);
1003
+ expect(stateVariables["/section222"].stateValues.creditAchieved).eq(0);
1004
+ expect(
1005
+ stateVariables["/section222"].stateValues.percentCreditAchieved,
1006
+ ).eq(0);
1007
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
1008
+ expect(stateVariables["/_answer2"].stateValues.creditAchieved).eq(1);
1009
+ expect(stateVariables["/_answer3"].stateValues.creditAchieved).eq(1);
1010
+ expect(stateVariables["/_answer4"].stateValues.creditAchieved).eq(1);
1011
+ expect(stateVariables["/_answer5"].stateValues.creditAchieved).eq(1);
1012
+ expect(stateVariables["/_answer6"].stateValues.creditAchieved).eq(1);
1013
+ expect(stateVariables["/_answer7"].stateValues.creditAchieved).eq(1);
1014
+ expect(stateVariables["/_answer8"].stateValues.creditAchieved).eq(1);
1015
+ expect(stateVariables["/_answer9"].stateValues.creditAchieved).eq(0);
1016
+ });
1017
+
1018
+ cy.log("enter last correct answer");
1019
+ cy.get(mathinput9Anchor).type(`s{enter}`, { force: true });
1020
+
1021
+ let section1credit4 = 1;
1022
+ let section1credit4Round = Math.round(1000 * section1credit4) / 1000;
1023
+ let section1percentCredit4 = section1credit4 * 100;
1024
+ let section1percentCredit4Round =
1025
+ Math.round(10 * section1percentCredit4) / 10;
1026
+
1027
+ let section221credit4 = 1;
1028
+ let section221credit4Round = Math.round(1000 * section221credit4) / 1000;
1029
+ let section221percentCredit4 = section221credit4 * 100;
1030
+ let section221percentCredit4Round =
1031
+ Math.round(10 * section221percentCredit4) / 10;
1032
+
1033
+ let section222credit4 = 1;
1034
+ let section222credit4Round = Math.round(1000 * section222credit4) / 1000;
1035
+ let section222percentCredit4 = section222credit4 * 100;
1036
+ let section222percentCredit4Round =
1037
+ Math.round(10 * section222percentCredit4) / 10;
1038
+
1039
+ let section21credit4 = 1;
1040
+ let section21credit4Round = Math.round(1000 * section21credit4) / 1000;
1041
+ let section21percentCredit4 = section21credit4 * 100;
1042
+ let section21percentCredit4Round =
1043
+ Math.round(10 * section21percentCredit4) / 10;
1044
+
1045
+ let section2credit4 = 1;
1046
+ let section2credit4Round = Math.round(1000 * section2credit4) / 1000;
1047
+ let section2percentCredit4 = section2credit4 * 100;
1048
+ let section2percentCredit4Round =
1049
+ Math.round(10 * section2percentCredit4) / 10;
1050
+
1051
+ let credit4 = (1 + section1credit4 + section2credit4) / 3;
1052
+ let credit4Round = Math.round(1000 * credit4) / 1000;
1053
+ let percentCredit4 = credit4 * 100;
1054
+ let percentCredit4Round = Math.round(10 * percentCredit4) / 10;
1055
+
1056
+ cy.get(docCaAnchor).should("have.text", credit4Round.toString());
1057
+ cy.get(docPcaAnchor).should("have.text", percentCredit4Round.toString());
1058
+ cy.get(s1CaAnchor).should("have.text", section1credit4Round.toString());
1059
+ cy.get(s1PcaAnchor).should(
1060
+ "have.text",
1061
+ section1percentCredit4Round.toString(),
1062
+ );
1063
+ cy.get(s2CaAnchor).should("have.text", section2credit4Round.toString());
1064
+ cy.get(s2PcaAnchor).should(
1065
+ "have.text",
1066
+ section2percentCredit4Round.toString(),
1067
+ );
1068
+ cy.get(s21CaAnchor).should("have.text", section21credit4Round.toString());
1069
+ cy.get(s21PcaAnchor).should(
1070
+ "have.text",
1071
+ section21percentCredit4Round.toString(),
1072
+ );
1073
+ cy.get(s22CaAnchor).should("have.text", "0");
1074
+ cy.get(s22PcaAnchor).should("have.text", "0");
1075
+ cy.get(s221CaAnchor).should(
1076
+ "have.text",
1077
+ section221credit4Round.toString(),
1078
+ );
1079
+ cy.get(s221PcaAnchor).should(
1080
+ "have.text",
1081
+ section221percentCredit4Round.toString(),
1082
+ );
1083
+ cy.get(s222CaAnchor).should(
1084
+ "have.text",
1085
+ section222credit4Round.toString(),
1086
+ );
1087
+ cy.get(s222PcaAnchor).should(
1088
+ "have.text",
1089
+ section222percentCredit4Round.toString(),
1090
+ );
1091
+
1092
+ cy.window().then(async (win) => {
1093
+ let stateVariables = await win.returnAllStateVariables1();
1094
+ expect(
1095
+ stateVariables["/_document1"].stateValues.creditAchieved,
1096
+ ).closeTo(credit4, 1e-12);
1097
+ expect(
1098
+ stateVariables["/_document1"].stateValues.percentCreditAchieved,
1099
+ ).closeTo(percentCredit4, 1e-12);
1100
+ expect(stateVariables["/section1"].stateValues.creditAchieved).closeTo(
1101
+ section1credit4,
1102
+ 1e-12,
1103
+ );
1104
+ expect(
1105
+ stateVariables["/section1"].stateValues.percentCreditAchieved,
1106
+ ).closeTo(section1percentCredit4, 1e-12);
1107
+ expect(stateVariables["/section2"].stateValues.creditAchieved).closeTo(
1108
+ section2credit4,
1109
+ 1e-12,
1110
+ );
1111
+ expect(
1112
+ stateVariables["/section2"].stateValues.percentCreditAchieved,
1113
+ ).closeTo(section2percentCredit4, 1e-12);
1114
+ expect(stateVariables["/section21"].stateValues.creditAchieved).closeTo(
1115
+ section21credit4,
1116
+ 1e-12,
1117
+ );
1118
+ expect(
1119
+ stateVariables["/section21"].stateValues.percentCreditAchieved,
1120
+ ).closeTo(section21percentCredit4, 1e-12);
1121
+ expect(stateVariables["/section22"].stateValues.creditAchieved).eq(0);
1122
+ expect(
1123
+ stateVariables["/section22"].stateValues.percentCreditAchieved,
1124
+ ).eq(0);
1125
+ expect(
1126
+ stateVariables["/section221"].stateValues.creditAchieved,
1127
+ ).closeTo(section221credit4, 1e-12);
1128
+ expect(
1129
+ stateVariables["/section221"].stateValues.percentCreditAchieved,
1130
+ ).closeTo(section221percentCredit4, 1e-12);
1131
+ expect(
1132
+ stateVariables["/section222"].stateValues.creditAchieved,
1133
+ ).closeTo(section222credit4, 1e-12);
1134
+ expect(
1135
+ stateVariables["/section222"].stateValues.percentCreditAchieved,
1136
+ ).closeTo(section222percentCredit4, 1e-12);
1137
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
1138
+ expect(stateVariables["/_answer2"].stateValues.creditAchieved).eq(1);
1139
+ expect(stateVariables["/_answer3"].stateValues.creditAchieved).eq(1);
1140
+ expect(stateVariables["/_answer4"].stateValues.creditAchieved).eq(1);
1141
+ expect(stateVariables["/_answer5"].stateValues.creditAchieved).eq(1);
1142
+ expect(stateVariables["/_answer6"].stateValues.creditAchieved).eq(1);
1143
+ expect(stateVariables["/_answer7"].stateValues.creditAchieved).eq(1);
1144
+ expect(stateVariables["/_answer8"].stateValues.creditAchieved).eq(1);
1145
+ expect(stateVariables["/_answer9"].stateValues.creditAchieved).eq(1);
1146
+ });
1147
+ });
1148
+ });
1149
+
1150
+ it("sections aggregating scores, with weights", () => {
1151
+ cy.window().then(async (win) => {
1152
+ win.postMessage(
1153
+ {
1154
+ doenetML: `
1155
+ <title>Activity</title>
1156
+ <p>Credit achieved for <copy prop="title" target="_document1" />:
1157
+ <copy name="docCa" prop="creditAchieved" target="_document1" />, or <copy name="docPca" prop="percentCreditAchieved" target="_document1" />%</p>
1158
+
1159
+ <p>Enter <m>u</m>: <answer>u</answer></p>
1160
+
1161
+ <section name="section1" aggregatescores weight="0.5"><title>Section 1</title>
1162
+ <p>Credit achieved for <copy prop="title" target="section1" />:
1163
+ <copy name="s1Ca" prop="creditAchieved" target="section1" />, or <copy name="s1Pca" prop="percentCreditAchieved" target="section1" />%</p>
1164
+
1165
+ <p>Enter <m>x</m>: <answer>x</answer></p>
1166
+ <p>Enter <m>y</m>: <answer weight="2">y</answer></p>
1167
+
1168
+
1169
+ </section>
1170
+ <section name="section2" aggregatescores weight="2"><title>Section 2</title>
1171
+ <p>Credit achieved for <copy prop="title" target="section2" />:
1172
+ <copy name="s2Ca" prop="creditAchieved" target="section2" />, or <copy name="s2Pca" prop="percentCreditAchieved" target="section2" />%</p>
1173
+
1174
+ <p>Enter <m>z</m>: <answer>z</answer></p>
1175
+
1176
+ <subsection name="section21" aggregatescores weight="3"><title>Section 2.1</title>
1177
+ <p>Credit achieved for <copy prop="title" target="section21" />:
1178
+ <copy name="s21Ca" prop="creditAchieved" target="section21" />, or <copy name="s21Pca" prop="percentCreditAchieved" target="section21" />%</p>
1179
+
1180
+
1181
+ <p>Enter <m>v</m>: <answer weight="0.5">v</answer></p>
1182
+ <p>Enter <m>w</m>: <answer>w</answer></p>
1183
+
1184
+ </subsection>
1185
+ <subsection name="section22" aggregatescores weight="4"><title>Section 2.2</title>
1186
+ <p>Credit achieved for <copy prop="title" target="section22" />:
1187
+ <copy name="s22Ca" prop="creditAchieved" target="section22" />, or <copy name="s22Pca" prop="percentCreditAchieved" target="section22" />%</p>
1188
+
1189
+ <p>Enter <m>q</m>: <answer>q</answer></p>
1190
+
1191
+ <subsubsection name="section221" aggregatescores weight="5"><title>Section 2.2.1</title>
1192
+ <p>Credit achieved for <copy prop="title" target="section221" />:
1193
+ <copy name="s221Ca" prop="creditAchieved" target="section221" />, or <copy name="s221Pca" prop="percentCreditAchieved" target="section221" />%</p>
1194
+
1195
+ <p>Enter <m>r</m>: <answer>r</answer></p>
1196
+
1197
+ </subsubsection>
1198
+ <subsubsection name="section222" aggregatescores weight="1"><title>Section 2.2.2</title>
1199
+ <p>Credit achieved for <copy prop="title" target="section222" />:
1200
+ <copy name="s222Ca" prop="creditAchieved" target="section222" />, or <copy name="s222Pca" prop="percentCreditAchieved" target="section222" />%</p>
1201
+
1202
+ <p>Enter <m>s</m>: <answer weight="3">s</answer></p>
1203
+
1204
+ </subsubsection>
1205
+ </subsection>
1206
+
1207
+ </section>
1208
+ `,
1209
+ },
1210
+ "*",
1211
+ );
1212
+ });
1213
+
1214
+ // to wait for page to load
1215
+ cy.get(cesc("#\\/_document1_title")).should("have.text", "Activity");
1216
+
1217
+ cy.window().then(async (win) => {
1218
+ let stateVariables = await win.returnAllStateVariables1();
1219
+
1220
+ let docCaAnchor = cesc2(
1221
+ "#" + stateVariables["/docCa"].replacements[0].componentName,
1222
+ );
1223
+ let docPcaAnchor = cesc2(
1224
+ "#" + stateVariables["/docPca"].replacements[0].componentName,
1225
+ );
1226
+ let s1CaAnchor = cesc2(
1227
+ "#" + stateVariables["/s1Ca"].replacements[0].componentName,
1228
+ );
1229
+ let s1PcaAnchor = cesc2(
1230
+ "#" + stateVariables["/s1Pca"].replacements[0].componentName,
1231
+ );
1232
+ let s2CaAnchor = cesc2(
1233
+ "#" + stateVariables["/s2Ca"].replacements[0].componentName,
1234
+ );
1235
+ let s2PcaAnchor = cesc2(
1236
+ "#" + stateVariables["/s2Pca"].replacements[0].componentName,
1237
+ );
1238
+ let s21CaAnchor = cesc2(
1239
+ "#" + stateVariables["/s21Ca"].replacements[0].componentName,
1240
+ );
1241
+ let s21PcaAnchor = cesc2(
1242
+ "#" + stateVariables["/s21Pca"].replacements[0].componentName,
1243
+ );
1244
+ let s22CaAnchor = cesc2(
1245
+ "#" + stateVariables["/s22Ca"].replacements[0].componentName,
1246
+ );
1247
+ let s22PcaAnchor = cesc2(
1248
+ "#" + stateVariables["/s22Pca"].replacements[0].componentName,
1249
+ );
1250
+ let s221CaAnchor = cesc2(
1251
+ "#" + stateVariables["/s221Ca"].replacements[0].componentName,
1252
+ );
1253
+ let s221PcaAnchor = cesc2(
1254
+ "#" + stateVariables["/s221Pca"].replacements[0].componentName,
1255
+ );
1256
+ let s222CaAnchor = cesc2(
1257
+ "#" + stateVariables["/s222Ca"].replacements[0].componentName,
1258
+ );
1259
+ let s222PcaAnchor = cesc2(
1260
+ "#" + stateVariables["/s222Pca"].replacements[0].componentName,
1261
+ );
1262
+ let mathinput1Anchor =
1263
+ cesc2(
1264
+ "#" +
1265
+ stateVariables["/_answer1"].stateValues.inputChildren[0]
1266
+ .componentName,
1267
+ ) + " textarea";
1268
+ let mathinput2Anchor =
1269
+ cesc2(
1270
+ "#" +
1271
+ stateVariables["/_answer2"].stateValues.inputChildren[0]
1272
+ .componentName,
1273
+ ) + " textarea";
1274
+ let mathinput3Anchor =
1275
+ cesc2(
1276
+ "#" +
1277
+ stateVariables["/_answer3"].stateValues.inputChildren[0]
1278
+ .componentName,
1279
+ ) + " textarea";
1280
+ let mathinput4Anchor =
1281
+ cesc2(
1282
+ "#" +
1283
+ stateVariables["/_answer4"].stateValues.inputChildren[0]
1284
+ .componentName,
1285
+ ) + " textarea";
1286
+ let mathinput5Anchor =
1287
+ cesc2(
1288
+ "#" +
1289
+ stateVariables["/_answer5"].stateValues.inputChildren[0]
1290
+ .componentName,
1291
+ ) + " textarea";
1292
+ let mathinput6Anchor =
1293
+ cesc2(
1294
+ "#" +
1295
+ stateVariables["/_answer6"].stateValues.inputChildren[0]
1296
+ .componentName,
1297
+ ) + " textarea";
1298
+ let mathinput7Anchor =
1299
+ cesc2(
1300
+ "#" +
1301
+ stateVariables["/_answer7"].stateValues.inputChildren[0]
1302
+ .componentName,
1303
+ ) + " textarea";
1304
+ let mathinput8Anchor =
1305
+ cesc2(
1306
+ "#" +
1307
+ stateVariables["/_answer8"].stateValues.inputChildren[0]
1308
+ .componentName,
1309
+ ) + " textarea";
1310
+ let mathinput9Anchor =
1311
+ cesc2(
1312
+ "#" +
1313
+ stateVariables["/_answer9"].stateValues.inputChildren[0]
1314
+ .componentName,
1315
+ ) + " textarea";
1316
+
1317
+ cy.get(docCaAnchor).should("have.text", "0");
1318
+ cy.get(docPcaAnchor).should("have.text", "0");
1319
+ cy.get(s1CaAnchor).should("have.text", "0");
1320
+ cy.get(s1PcaAnchor).should("have.text", "0");
1321
+ cy.get(s2CaAnchor).should("have.text", "0");
1322
+ cy.get(s2PcaAnchor).should("have.text", "0");
1323
+ cy.get(s21CaAnchor).should("have.text", "0");
1324
+ cy.get(s21PcaAnchor).should("have.text", "0");
1325
+ cy.get(s22CaAnchor).should("have.text", "0");
1326
+ cy.get(s22PcaAnchor).should("have.text", "0");
1327
+ cy.get(s221CaAnchor).should("have.text", "0");
1328
+ cy.get(s221PcaAnchor).should("have.text", "0");
1329
+ cy.get(s222CaAnchor).should("have.text", "0");
1330
+ cy.get(s222PcaAnchor).should("have.text", "0");
1331
+
1332
+ cy.window().then(async (win) => {
1333
+ let stateVariables = await win.returnAllStateVariables1();
1334
+ expect(stateVariables["/_document1"].stateValues.creditAchieved).eq(0);
1335
+ expect(
1336
+ stateVariables["/_document1"].stateValues.percentCreditAchieved,
1337
+ ).eq(0);
1338
+ expect(stateVariables["/section1"].stateValues.creditAchieved).eq(0);
1339
+ expect(
1340
+ stateVariables["/section1"].stateValues.percentCreditAchieved,
1341
+ ).eq(0);
1342
+ expect(stateVariables["/section2"].stateValues.creditAchieved).eq(0);
1343
+ expect(
1344
+ stateVariables["/section2"].stateValues.percentCreditAchieved,
1345
+ ).eq(0);
1346
+ expect(stateVariables["/section21"].stateValues.creditAchieved).eq(0);
1347
+ expect(
1348
+ stateVariables["/section21"].stateValues.percentCreditAchieved,
1349
+ ).eq(0);
1350
+ expect(stateVariables["/section22"].stateValues.creditAchieved).eq(0);
1351
+ expect(
1352
+ stateVariables["/section22"].stateValues.percentCreditAchieved,
1353
+ ).eq(0);
1354
+ expect(stateVariables["/section221"].stateValues.creditAchieved).eq(0);
1355
+ expect(
1356
+ stateVariables["/section221"].stateValues.percentCreditAchieved,
1357
+ ).eq(0);
1358
+ expect(stateVariables["/section222"].stateValues.creditAchieved).eq(0);
1359
+ expect(
1360
+ stateVariables["/section222"].stateValues.percentCreditAchieved,
1361
+ ).eq(0);
1362
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
1363
+ expect(stateVariables["/_answer2"].stateValues.creditAchieved).eq(0);
1364
+ expect(stateVariables["/_answer3"].stateValues.creditAchieved).eq(0);
1365
+ expect(stateVariables["/_answer4"].stateValues.creditAchieved).eq(0);
1366
+ expect(stateVariables["/_answer5"].stateValues.creditAchieved).eq(0);
1367
+ expect(stateVariables["/_answer6"].stateValues.creditAchieved).eq(0);
1368
+ expect(stateVariables["/_answer7"].stateValues.creditAchieved).eq(0);
1369
+ expect(stateVariables["/_answer8"].stateValues.creditAchieved).eq(0);
1370
+ expect(stateVariables["/_answer9"].stateValues.creditAchieved).eq(0);
1371
+ });
1372
+
1373
+ cy.log("enter first correct answer");
1374
+ cy.get(mathinput1Anchor).type(`u{enter}`, { force: true });
1375
+
1376
+ let credit1 = 1 / 3.5;
1377
+ let credit1Round = Math.round(1000 * credit1) / 1000;
1378
+ let percentCredit1 = credit1 * 100;
1379
+ let percentCredit1Round = Math.round(10 * percentCredit1) / 10;
1380
+
1381
+ cy.get(docCaAnchor).should("have.text", credit1Round.toString());
1382
+ cy.get(docPcaAnchor).should("have.text", percentCredit1Round.toString());
1383
+ cy.get(s1CaAnchor).should("have.text", "0");
1384
+ cy.get(s1PcaAnchor).should("have.text", "0");
1385
+ cy.get(s2CaAnchor).should("have.text", "0");
1386
+ cy.get(s2PcaAnchor).should("have.text", "0");
1387
+ cy.get(s21CaAnchor).should("have.text", "0");
1388
+ cy.get(s21PcaAnchor).should("have.text", "0");
1389
+ cy.get(s22CaAnchor).should("have.text", "0");
1390
+ cy.get(s22PcaAnchor).should("have.text", "0");
1391
+ cy.get(s221CaAnchor).should("have.text", "0");
1392
+ cy.get(s221PcaAnchor).should("have.text", "0");
1393
+ cy.get(s222CaAnchor).should("have.text", "0");
1394
+ cy.get(s222PcaAnchor).should("have.text", "0");
1395
+
1396
+ cy.window().then(async (win) => {
1397
+ let stateVariables = await win.returnAllStateVariables1();
1398
+ expect(
1399
+ stateVariables["/_document1"].stateValues.creditAchieved,
1400
+ ).closeTo(credit1, 1e-12);
1401
+ expect(
1402
+ stateVariables["/_document1"].stateValues.percentCreditAchieved,
1403
+ ).closeTo(percentCredit1, 1e-12);
1404
+ expect(stateVariables["/section1"].stateValues.creditAchieved).eq(0);
1405
+ expect(
1406
+ stateVariables["/section1"].stateValues.percentCreditAchieved,
1407
+ ).eq(0);
1408
+ expect(stateVariables["/section2"].stateValues.creditAchieved).eq(0);
1409
+ expect(
1410
+ stateVariables["/section2"].stateValues.percentCreditAchieved,
1411
+ ).eq(0);
1412
+ expect(stateVariables["/section21"].stateValues.creditAchieved).eq(0);
1413
+ expect(
1414
+ stateVariables["/section21"].stateValues.percentCreditAchieved,
1415
+ ).eq(0);
1416
+ expect(stateVariables["/section22"].stateValues.creditAchieved).eq(0);
1417
+ expect(
1418
+ stateVariables["/section22"].stateValues.percentCreditAchieved,
1419
+ ).eq(0);
1420
+ expect(stateVariables["/section221"].stateValues.creditAchieved).eq(0);
1421
+ expect(
1422
+ stateVariables["/section221"].stateValues.percentCreditAchieved,
1423
+ ).eq(0);
1424
+ expect(stateVariables["/section222"].stateValues.creditAchieved).eq(0);
1425
+ expect(
1426
+ stateVariables["/section222"].stateValues.percentCreditAchieved,
1427
+ ).eq(0);
1428
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
1429
+ expect(stateVariables["/_answer2"].stateValues.creditAchieved).eq(0);
1430
+ expect(stateVariables["/_answer3"].stateValues.creditAchieved).eq(0);
1431
+ expect(stateVariables["/_answer4"].stateValues.creditAchieved).eq(0);
1432
+ expect(stateVariables["/_answer5"].stateValues.creditAchieved).eq(0);
1433
+ expect(stateVariables["/_answer6"].stateValues.creditAchieved).eq(0);
1434
+ expect(stateVariables["/_answer7"].stateValues.creditAchieved).eq(0);
1435
+ expect(stateVariables["/_answer8"].stateValues.creditAchieved).eq(0);
1436
+ expect(stateVariables["/_answer9"].stateValues.creditAchieved).eq(0);
1437
+ });
1438
+
1439
+ cy.log("enter additional correct answers");
1440
+ cy.get(mathinput3Anchor).type(`y{enter}`, { force: true });
1441
+ cy.get(mathinput5Anchor).type(`v{enter}`, { force: true });
1442
+ cy.get(mathinput7Anchor).type(`q{enter}`, { force: true });
1443
+
1444
+ let section1credit2 = 2 / 3;
1445
+ let section1credit2Round = Math.round(1000 * section1credit2) / 1000;
1446
+ let section1percentCredit2 = section1credit2 * 100;
1447
+ let section1percentCredit2Round =
1448
+ Math.round(10 * section1percentCredit2) / 10;
1449
+
1450
+ let section21credit2 = 1 / 3;
1451
+ let section21credit2Round = Math.round(1000 * section21credit2) / 1000;
1452
+ let section21percentCredit2 = section21credit2 * 100;
1453
+ let section21percentCredit2Round =
1454
+ Math.round(10 * section21percentCredit2) / 10;
1455
+
1456
+ let section22credit2 = 1 / 7;
1457
+ let section22credit2Round = Math.round(1000 * section22credit2) / 1000;
1458
+ let section22percentCredit2 = section22credit2 * 100;
1459
+ let section22percentCredit2Round =
1460
+ Math.round(10 * section22percentCredit2) / 10;
1461
+
1462
+ let section2credit2 = (3 * section21credit2 + 4 * section22credit2) / 8;
1463
+ let section2credit2Round = Math.round(1000 * section2credit2) / 1000;
1464
+ let section2percentCredit2 = section2credit2 * 100;
1465
+ let section2percentCredit2Round =
1466
+ Math.round(10 * section2percentCredit2) / 10;
1467
+
1468
+ let credit2 = (1 + 0.5 * section1credit2 + 2 * section2credit2) / 3.5;
1469
+ let credit2Round = Math.round(1000 * credit2) / 1000;
1470
+ let percentCredit2 = credit2 * 100;
1471
+ let percentCredit2Round = Math.round(10 * percentCredit2) / 10;
1472
+
1473
+ cy.get(docCaAnchor).should("have.text", credit2Round.toString());
1474
+ cy.get(docPcaAnchor).should("have.text", percentCredit2Round.toString());
1475
+ cy.get(s1CaAnchor).should("have.text", section1credit2Round.toString());
1476
+ cy.get(s1PcaAnchor).should(
1477
+ "have.text",
1478
+ section1percentCredit2Round.toString(),
1479
+ );
1480
+ cy.get(s2CaAnchor).should("have.text", section2credit2Round.toString());
1481
+ cy.get(s2PcaAnchor).should(
1482
+ "have.text",
1483
+ section2percentCredit2Round.toString(),
1484
+ );
1485
+ cy.get(s21CaAnchor).should("have.text", section21credit2Round.toString());
1486
+ cy.get(s21PcaAnchor).should(
1487
+ "have.text",
1488
+ section21percentCredit2Round.toString(),
1489
+ );
1490
+ cy.get(s22CaAnchor).should("have.text", section22credit2Round.toString());
1491
+ cy.get(s22PcaAnchor).should(
1492
+ "have.text",
1493
+ section22percentCredit2Round.toString(),
1494
+ );
1495
+ cy.get(s221CaAnchor).should("have.text", "0");
1496
+ cy.get(s221PcaAnchor).should("have.text", "0");
1497
+ cy.get(s222CaAnchor).should("have.text", "0");
1498
+ cy.get(s222PcaAnchor).should("have.text", "0");
1499
+
1500
+ cy.window().then(async (win) => {
1501
+ let stateVariables = await win.returnAllStateVariables1();
1502
+ expect(
1503
+ stateVariables["/_document1"].stateValues.creditAchieved,
1504
+ ).closeTo(credit2, 1e-12);
1505
+ expect(
1506
+ stateVariables["/_document1"].stateValues.percentCreditAchieved,
1507
+ ).closeTo(percentCredit2, 1e-12);
1508
+ expect(stateVariables["/section1"].stateValues.creditAchieved).closeTo(
1509
+ section1credit2,
1510
+ 1e-12,
1511
+ );
1512
+ expect(
1513
+ stateVariables["/section1"].stateValues.percentCreditAchieved,
1514
+ ).closeTo(section1percentCredit2, 1e-12);
1515
+ expect(stateVariables["/section2"].stateValues.creditAchieved).closeTo(
1516
+ section2credit2,
1517
+ 1e-12,
1518
+ );
1519
+ expect(
1520
+ stateVariables["/section2"].stateValues.percentCreditAchieved,
1521
+ ).closeTo(section2percentCredit2, 1e-12);
1522
+ expect(stateVariables["/section21"].stateValues.creditAchieved).closeTo(
1523
+ section21credit2,
1524
+ 1e-12,
1525
+ );
1526
+ expect(
1527
+ stateVariables["/section21"].stateValues.percentCreditAchieved,
1528
+ ).closeTo(section21percentCredit2, 1e-12);
1529
+ expect(stateVariables["/section22"].stateValues.creditAchieved).closeTo(
1530
+ section22credit2,
1531
+ 1e-12,
1532
+ );
1533
+ expect(
1534
+ stateVariables["/section22"].stateValues.percentCreditAchieved,
1535
+ ).closeTo(section22percentCredit2, 1e-12);
1536
+ expect(stateVariables["/section221"].stateValues.creditAchieved).eq(0);
1537
+ expect(
1538
+ stateVariables["/section221"].stateValues.percentCreditAchieved,
1539
+ ).eq(0);
1540
+ expect(stateVariables["/section222"].stateValues.creditAchieved).eq(0);
1541
+ expect(
1542
+ stateVariables["/section222"].stateValues.percentCreditAchieved,
1543
+ ).eq(0);
1544
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
1545
+ expect(stateVariables["/_answer2"].stateValues.creditAchieved).eq(0);
1546
+ expect(stateVariables["/_answer3"].stateValues.creditAchieved).eq(1);
1547
+ expect(stateVariables["/_answer4"].stateValues.creditAchieved).eq(0);
1548
+ expect(stateVariables["/_answer5"].stateValues.creditAchieved).eq(1);
1549
+ expect(stateVariables["/_answer6"].stateValues.creditAchieved).eq(0);
1550
+ expect(stateVariables["/_answer7"].stateValues.creditAchieved).eq(1);
1551
+ expect(stateVariables["/_answer8"].stateValues.creditAchieved).eq(0);
1552
+ expect(stateVariables["/_answer9"].stateValues.creditAchieved).eq(0);
1553
+ });
1554
+
1555
+ cy.log("enter most other correct answers");
1556
+ cy.get(mathinput2Anchor).type(`x{enter}`, { force: true });
1557
+ cy.get(mathinput4Anchor).type(`z{enter}`, { force: true });
1558
+ cy.get(mathinput6Anchor).type(`w{enter}`, { force: true });
1559
+ cy.get(mathinput8Anchor).type(`r{enter}`, { force: true });
1560
+
1561
+ let section1credit3 = 1;
1562
+ let section1credit3Round = Math.round(1000 * section1credit3) / 1000;
1563
+ let section1percentCredit3 = section1credit3 * 100;
1564
+ let section1percentCredit3Round =
1565
+ Math.round(10 * section1percentCredit3) / 10;
1566
+
1567
+ let section21credit3 = 1;
1568
+ let section21credit3Round = Math.round(1000 * section21credit3) / 1000;
1569
+ let section21percentCredit3 = section21credit3 * 100;
1570
+ let section21percentCredit3Round =
1571
+ Math.round(10 * section21percentCredit3) / 10;
1572
+
1573
+ let section221credit3 = 1;
1574
+ let section221credit3Round = Math.round(1000 * section221credit3) / 1000;
1575
+ let section221percentCredit3 = section221credit3 * 100;
1576
+ let section221percentCredit3Round =
1577
+ Math.round(10 * section221percentCredit3) / 10;
1578
+
1579
+ let section22credit3 = 6 / 7;
1580
+ let section22credit3Round = Math.round(1000 * section22credit3) / 1000;
1581
+ let section22percentCredit3 = section22credit3 * 100;
1582
+ let section22percentCredit3Round =
1583
+ Math.round(10 * section22percentCredit3) / 10;
1584
+
1585
+ let section2credit3 =
1586
+ (1 + 3 * section21credit3 + 4 * section22credit3) / 8;
1587
+ let section2credit3Round = Math.round(1000 * section2credit3) / 1000;
1588
+ let section2percentCredit3 = section2credit3 * 100;
1589
+ let section2percentCredit3Round =
1590
+ Math.round(10 * section2percentCredit3) / 10;
1591
+
1592
+ let credit3 = (1 + 0.5 * section1credit3 + 2 * section2credit3) / 3.5;
1593
+ let credit3Round = Math.round(1000 * credit3) / 1000;
1594
+ let percentCredit3 = credit3 * 100;
1595
+ let percentCredit3Round = Math.round(10 * percentCredit3) / 10;
1596
+
1597
+ cy.get(docCaAnchor).should("have.text", credit3Round.toString());
1598
+ cy.get(docPcaAnchor).should("have.text", percentCredit3Round.toString());
1599
+ cy.get(s1CaAnchor).should("have.text", section1credit3Round.toString());
1600
+ cy.get(s1PcaAnchor).should(
1601
+ "have.text",
1602
+ section1percentCredit3Round.toString(),
1603
+ );
1604
+ cy.get(s2CaAnchor).should("have.text", section2credit3Round.toString());
1605
+ cy.get(s2PcaAnchor).should(
1606
+ "have.text",
1607
+ section2percentCredit3Round.toString(),
1608
+ );
1609
+ cy.get(s21CaAnchor).should("have.text", section21credit3Round.toString());
1610
+ cy.get(s21PcaAnchor).should(
1611
+ "have.text",
1612
+ section21percentCredit3Round.toString(),
1613
+ );
1614
+ cy.get(s22CaAnchor).should("have.text", section22credit3Round.toString());
1615
+ cy.get(s22PcaAnchor).should(
1616
+ "have.text",
1617
+ section22percentCredit3Round.toString(),
1618
+ );
1619
+ cy.get(s221CaAnchor).should(
1620
+ "have.text",
1621
+ section221credit3Round.toString(),
1622
+ );
1623
+ cy.get(s221PcaAnchor).should(
1624
+ "have.text",
1625
+ section221percentCredit3Round.toString(),
1626
+ );
1627
+ cy.get(s222CaAnchor).should("have.text", "0");
1628
+ cy.get(s222PcaAnchor).should("have.text", "0");
1629
+
1630
+ cy.window().then(async (win) => {
1631
+ let stateVariables = await win.returnAllStateVariables1();
1632
+ expect(
1633
+ stateVariables["/_document1"].stateValues.creditAchieved,
1634
+ ).closeTo(credit3, 1e-12);
1635
+ expect(
1636
+ stateVariables["/_document1"].stateValues.percentCreditAchieved,
1637
+ ).closeTo(percentCredit3, 1e-12);
1638
+ expect(stateVariables["/section1"].stateValues.creditAchieved).closeTo(
1639
+ section1credit3,
1640
+ 1e-12,
1641
+ );
1642
+ expect(
1643
+ stateVariables["/section1"].stateValues.percentCreditAchieved,
1644
+ ).closeTo(section1percentCredit3, 1e-12);
1645
+ expect(stateVariables["/section2"].stateValues.creditAchieved).closeTo(
1646
+ section2credit3,
1647
+ 1e-12,
1648
+ );
1649
+ expect(
1650
+ stateVariables["/section2"].stateValues.percentCreditAchieved,
1651
+ ).closeTo(section2percentCredit3, 1e-12);
1652
+ expect(stateVariables["/section21"].stateValues.creditAchieved).closeTo(
1653
+ section21credit3,
1654
+ 1e-12,
1655
+ );
1656
+ expect(
1657
+ stateVariables["/section21"].stateValues.percentCreditAchieved,
1658
+ ).closeTo(section21percentCredit3, 1e-12);
1659
+ expect(stateVariables["/section22"].stateValues.creditAchieved).closeTo(
1660
+ section22credit3,
1661
+ 1e-12,
1662
+ );
1663
+ expect(
1664
+ stateVariables["/section22"].stateValues.percentCreditAchieved,
1665
+ ).closeTo(section22percentCredit3, 1e-12);
1666
+ expect(
1667
+ stateVariables["/section221"].stateValues.creditAchieved,
1668
+ ).closeTo(section221credit3, 1e-12);
1669
+ expect(
1670
+ stateVariables["/section221"].stateValues.percentCreditAchieved,
1671
+ ).closeTo(section221percentCredit3, 1e-12);
1672
+ expect(stateVariables["/section222"].stateValues.creditAchieved).eq(0);
1673
+ expect(
1674
+ stateVariables["/section222"].stateValues.percentCreditAchieved,
1675
+ ).eq(0);
1676
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
1677
+ expect(stateVariables["/_answer2"].stateValues.creditAchieved).eq(1);
1678
+ expect(stateVariables["/_answer3"].stateValues.creditAchieved).eq(1);
1679
+ expect(stateVariables["/_answer4"].stateValues.creditAchieved).eq(1);
1680
+ expect(stateVariables["/_answer5"].stateValues.creditAchieved).eq(1);
1681
+ expect(stateVariables["/_answer6"].stateValues.creditAchieved).eq(1);
1682
+ expect(stateVariables["/_answer7"].stateValues.creditAchieved).eq(1);
1683
+ expect(stateVariables["/_answer8"].stateValues.creditAchieved).eq(1);
1684
+ expect(stateVariables["/_answer9"].stateValues.creditAchieved).eq(0);
1685
+ });
1686
+
1687
+ cy.log("enter last correct answer");
1688
+ cy.get(mathinput9Anchor).type(`s{enter}`, { force: true });
1689
+
1690
+ let section1credit4 = 1;
1691
+ let section1credit4Round = Math.round(1000 * section1credit4) / 1000;
1692
+ let section1percentCredit4 = section1credit4 * 100;
1693
+ let section1percentCredit4Round =
1694
+ Math.round(10 * section1percentCredit4) / 10;
1695
+
1696
+ let section21credit4 = 1;
1697
+ let section21credit4Round = Math.round(1000 * section21credit4) / 1000;
1698
+ let section21percentCredit4 = section21credit4 * 100;
1699
+ let section21percentCredit4Round =
1700
+ Math.round(10 * section21percentCredit4) / 10;
1701
+
1702
+ let section221credit4 = 1;
1703
+ let section221credit4Round = Math.round(1000 * section221credit4) / 1000;
1704
+ let section221percentCredit4 = section221credit4 * 100;
1705
+ let section221percentCredit4Round =
1706
+ Math.round(10 * section221percentCredit4) / 10;
1707
+
1708
+ let section222credit4 = 1;
1709
+ let section222credit4Round = Math.round(1000 * section222credit4) / 1000;
1710
+ let section222percentCredit4 = section222credit4 * 100;
1711
+ let section222percentCredit4Round =
1712
+ Math.round(10 * section222percentCredit4) / 10;
1713
+
1714
+ let section22credit4 = 1;
1715
+ let section22credit4Round = Math.round(1000 * section22credit4) / 1000;
1716
+ let section22percentCredit4 = section22credit4 * 100;
1717
+ let section22percentCredit4Round =
1718
+ Math.round(10 * section22percentCredit4) / 10;
1719
+
1720
+ let section2credit4 = 1;
1721
+ let section2credit4Round = Math.round(1000 * section2credit4) / 1000;
1722
+ let section2percentCredit4 = section2credit4 * 100;
1723
+ let section2percentCredit4Round =
1724
+ Math.round(10 * section2percentCredit4) / 10;
1725
+
1726
+ let credit4 = (1 + section1credit4 + section2credit4) / 3;
1727
+ let credit4Round = Math.round(1000 * credit4) / 1000;
1728
+ let percentCredit4 = credit4 * 100;
1729
+ let percentCredit4Round = Math.round(10 * percentCredit4) / 10;
1730
+
1731
+ cy.get(docCaAnchor).should("have.text", credit4Round.toString());
1732
+ cy.get(docPcaAnchor).should("have.text", percentCredit4Round.toString());
1733
+ cy.get(s1CaAnchor).should("have.text", section1credit4Round.toString());
1734
+ cy.get(s1PcaAnchor).should(
1735
+ "have.text",
1736
+ section1percentCredit4Round.toString(),
1737
+ );
1738
+ cy.get(s2CaAnchor).should("have.text", section2credit4Round.toString());
1739
+ cy.get(s2PcaAnchor).should(
1740
+ "have.text",
1741
+ section2percentCredit4Round.toString(),
1742
+ );
1743
+ cy.get(s21CaAnchor).should("have.text", section21credit4Round.toString());
1744
+ cy.get(s21PcaAnchor).should(
1745
+ "have.text",
1746
+ section21percentCredit4Round.toString(),
1747
+ );
1748
+ cy.get(s22CaAnchor).should("have.text", section22credit4Round.toString());
1749
+ cy.get(s22PcaAnchor).should(
1750
+ "have.text",
1751
+ section22percentCredit4Round.toString(),
1752
+ );
1753
+ cy.get(s221CaAnchor).should(
1754
+ "have.text",
1755
+ section221credit4Round.toString(),
1756
+ );
1757
+ cy.get(s221PcaAnchor).should(
1758
+ "have.text",
1759
+ section221percentCredit4Round.toString(),
1760
+ );
1761
+ cy.get(s222CaAnchor).should(
1762
+ "have.text",
1763
+ section222credit4Round.toString(),
1764
+ );
1765
+ cy.get(s222PcaAnchor).should(
1766
+ "have.text",
1767
+ section222percentCredit4Round.toString(),
1768
+ );
1769
+
1770
+ cy.window().then(async (win) => {
1771
+ let stateVariables = await win.returnAllStateVariables1();
1772
+ expect(
1773
+ stateVariables["/_document1"].stateValues.creditAchieved,
1774
+ ).closeTo(credit4, 1e-12);
1775
+ expect(
1776
+ stateVariables["/_document1"].stateValues.percentCreditAchieved,
1777
+ ).closeTo(percentCredit4, 1e-12);
1778
+ expect(stateVariables["/section1"].stateValues.creditAchieved).closeTo(
1779
+ section1credit4,
1780
+ 1e-12,
1781
+ );
1782
+ expect(
1783
+ stateVariables["/section1"].stateValues.percentCreditAchieved,
1784
+ ).closeTo(section1percentCredit4, 1e-12);
1785
+ expect(stateVariables["/section2"].stateValues.creditAchieved).closeTo(
1786
+ section2credit4,
1787
+ 1e-12,
1788
+ );
1789
+ expect(
1790
+ stateVariables["/section2"].stateValues.percentCreditAchieved,
1791
+ ).closeTo(section2percentCredit4, 1e-12);
1792
+ expect(stateVariables["/section21"].stateValues.creditAchieved).closeTo(
1793
+ section21credit4,
1794
+ 1e-12,
1795
+ );
1796
+ expect(
1797
+ stateVariables["/section21"].stateValues.percentCreditAchieved,
1798
+ ).closeTo(section21percentCredit4, 1e-12);
1799
+ expect(stateVariables["/section22"].stateValues.creditAchieved).closeTo(
1800
+ section22credit4,
1801
+ 1e-12,
1802
+ );
1803
+ expect(
1804
+ stateVariables["/section22"].stateValues.percentCreditAchieved,
1805
+ ).closeTo(section22percentCredit4, 1e-12);
1806
+ expect(
1807
+ stateVariables["/section221"].stateValues.creditAchieved,
1808
+ ).closeTo(section221credit4, 1e-12);
1809
+ expect(
1810
+ stateVariables["/section221"].stateValues.percentCreditAchieved,
1811
+ ).closeTo(section221percentCredit4, 1e-12);
1812
+ expect(
1813
+ stateVariables["/section222"].stateValues.creditAchieved,
1814
+ ).closeTo(section222credit4, 1e-12);
1815
+ expect(
1816
+ stateVariables["/section222"].stateValues.percentCreditAchieved,
1817
+ ).closeTo(section222percentCredit4, 1e-12);
1818
+ expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
1819
+ expect(stateVariables["/_answer2"].stateValues.creditAchieved).eq(1);
1820
+ expect(stateVariables["/_answer3"].stateValues.creditAchieved).eq(1);
1821
+ expect(stateVariables["/_answer4"].stateValues.creditAchieved).eq(1);
1822
+ expect(stateVariables["/_answer5"].stateValues.creditAchieved).eq(1);
1823
+ expect(stateVariables["/_answer6"].stateValues.creditAchieved).eq(1);
1824
+ expect(stateVariables["/_answer7"].stateValues.creditAchieved).eq(1);
1825
+ expect(stateVariables["/_answer8"].stateValues.creditAchieved).eq(1);
1826
+ expect(stateVariables["/_answer9"].stateValues.creditAchieved).eq(1);
1827
+ });
1828
+ });
1829
+ });
1830
+
1831
+ it("paragraphs", () => {
1832
+ cy.window().then(async (win) => {
1833
+ win.postMessage(
1834
+ {
1835
+ doenetML: `
1836
+ <paragraphs><title>Some paragraphs</title>
1837
+
1838
+ <p>Paragraph 1</p>
1839
+ <p>Paragraph 2</p>
1840
+
1841
+ </paragraphs>
1842
+
1843
+ `,
1844
+ },
1845
+ "*",
1846
+ );
1847
+ });
1848
+
1849
+ cy.get(cesc("#\\/_paragraphs1_title")).should(
1850
+ "have.text",
1851
+ "Some paragraphs",
1852
+ );
1853
+
1854
+ cy.get(cesc("#\\/_paragraphs1") + " p:first-of-type").should(
1855
+ "have.text",
1856
+ "Paragraph 1",
1857
+ );
1858
+ cy.get(cesc("#\\/_paragraphs1") + " p:last-of-type").should(
1859
+ "have.text",
1860
+ "Paragraph 2",
1861
+ );
1862
+ });
1863
+
1864
+ it("prefill mathinput in aside", () => {
1865
+ cy.window().then(async (win) => {
1866
+ win.postMessage(
1867
+ {
1868
+ doenetML: `
1869
+ <text>a</text>
1870
+ <aside name="aside1">
1871
+ <title>Starting closed</title>
1872
+ <p>An expression: <mathinput name="expr1" prefill="(x+1)(x^2-1)" /></p>
1873
+ <p>The value of the expression is <copy prop="value" target="expr1" assignNames="expr1a" /></p>
1874
+ </aside>
1875
+ <aside name="aside2" startOpen>
1876
+ <title>Starting open</title>
1877
+ <p>An expression: <mathinput name="expr2" prefill="(x-1)(x^2+1)" /></p>
1878
+ <p>The value of the expression is <copy prop="value" target="expr2" assignNames="expr2a" /></p>
1879
+ </aside>
1880
+
1881
+ <p>The first expression is <copy prop="value" target="expr1" assignNames="expr1b" /></p>
1882
+ <p>The second expression is <copy prop="value" target="expr2" assignNames="expr2b" /></p>
1883
+
1884
+ `,
1885
+ },
1886
+ "*",
1887
+ );
1888
+ });
1889
+
1890
+ cy.get(cesc("#\\/_text1")).should("have.text", "a"); // to wait until loaded
1891
+
1892
+ cy.get(cesc("#\\/expr1b") + " .mjx-mrow")
1893
+ .eq(0)
1894
+ .invoke("text")
1895
+ .then((text) => {
1896
+ expect(text.trim()).eq("(x+1)(x2−1)");
1897
+ });
1898
+ cy.get(cesc("#\\/expr2b") + " .mjx-mrow")
1899
+ .eq(0)
1900
+ .invoke("text")
1901
+ .then((text) => {
1902
+ expect(text.trim()).eq("(x−1)(x2+1)");
1903
+ });
1904
+ cy.get(cesc("#\\/expr1a")).should("not.exist");
1905
+ cy.get(cesc("#\\/expr2a") + " .mjx-mrow")
1906
+ .eq(0)
1907
+ .invoke("text")
1908
+ .then((text) => {
1909
+ expect(text.trim()).eq("(x−1)(x2+1)");
1910
+ });
1911
+
1912
+ cy.get(cesc("#\\/expr1")).should("not.exist");
1913
+ cy.get(cesc("#\\/expr2") + " .mq-editable-field")
1914
+ .invoke("text")
1915
+ .then((text) => {
1916
+ expect(text.trim()).eq("(x−1)(x2+1)");
1917
+ });
1918
+
1919
+ cy.get(cesc("#\\/aside1_title")).click();
1920
+
1921
+ cy.get(cesc("#\\/expr1a") + " .mjx-mrow")
1922
+ .eq(0)
1923
+ .invoke("text")
1924
+ .then((text) => {
1925
+ expect(text.trim()).eq("(x+1)(x2−1)");
1926
+ });
1927
+ cy.get(cesc("#\\/expr1") + " .mq-editable-field")
1928
+ .invoke("text")
1929
+ .then((text) => {
1930
+ expect(text.trim()).eq("(x+1)(x2−1)");
1931
+ });
1932
+
1933
+ cy.get(cesc("#\\/aside2_title")).click();
1934
+ cy.get(cesc("#\\/expr2a")).should("not.exist");
1935
+ cy.get(cesc("#\\/expr2")).should("not.exist");
1936
+
1937
+ cy.get(cesc("#\\/expr1b") + " .mjx-mrow")
1938
+ .eq(0)
1939
+ .invoke("text")
1940
+ .then((text) => {
1941
+ expect(text.trim()).eq("(x+1)(x2−1)");
1942
+ });
1943
+ cy.get(cesc("#\\/expr2b") + " .mjx-mrow")
1944
+ .eq(0)
1945
+ .invoke("text")
1946
+ .then((text) => {
1947
+ expect(text.trim()).eq("(x−1)(x2+1)");
1948
+ });
1949
+
1950
+ cy.get(cesc("#\\/expr1") + " textarea")
1951
+ .type("{end}{leftArrow}{backspace}4{enter}", { force: true })
1952
+ .blur();
1953
+
1954
+ cy.get(cesc("#\\/expr1a")).should("contain.text", "(x+1)(x2−4)");
1955
+ cy.get(cesc("#\\/expr1a") + " .mjx-mrow")
1956
+ .eq(0)
1957
+ .invoke("text")
1958
+ .then((text) => {
1959
+ expect(text.trim()).eq("(x+1)(x2−4)");
1960
+ });
1961
+ cy.get(cesc("#\\/expr1") + " .mq-editable-field")
1962
+ .invoke("text")
1963
+ .then((text) => {
1964
+ expect(text.replace(/[\s\u200B-\u200D\uFEFF]/g, "")).eq("(x+1)(x2−4)");
1965
+ });
1966
+
1967
+ cy.get(cesc("#\\/expr1b") + " .mjx-mrow")
1968
+ .eq(0)
1969
+ .invoke("text")
1970
+ .then((text) => {
1971
+ expect(text.trim()).eq("(x+1)(x2−4)");
1972
+ });
1973
+ cy.get(cesc("#\\/expr2b") + " .mjx-mrow")
1974
+ .eq(0)
1975
+ .invoke("text")
1976
+ .then((text) => {
1977
+ expect(text.trim()).eq("(x−1)(x2+1)");
1978
+ });
1979
+
1980
+ cy.get(cesc("#\\/aside1_title")).click();
1981
+ cy.get(cesc("#\\/expr1a")).should("not.exist");
1982
+ cy.get(cesc("#\\/expr1")).should("not.exist");
1983
+
1984
+ cy.get(cesc("#\\/expr1b") + " .mjx-mrow")
1985
+ .eq(0)
1986
+ .invoke("text")
1987
+ .then((text) => {
1988
+ expect(text.trim()).eq("(x+1)(x2−4)");
1989
+ });
1990
+ cy.get(cesc("#\\/expr2b") + " .mjx-mrow")
1991
+ .eq(0)
1992
+ .invoke("text")
1993
+ .then((text) => {
1994
+ expect(text.trim()).eq("(x−1)(x2+1)");
1995
+ });
1996
+
1997
+ cy.get(cesc("#\\/aside2_title")).click();
1998
+
1999
+ cy.get(cesc("#\\/expr2a") + " .mjx-mrow")
2000
+ .eq(0)
2001
+ .invoke("text")
2002
+ .then((text) => {
2003
+ expect(text.trim()).eq("(x−1)(x2+1)");
2004
+ });
2005
+ cy.get(cesc("#\\/expr2") + " .mq-editable-field")
2006
+ .invoke("text")
2007
+ .then((text) => {
2008
+ expect(text.trim()).eq("(x−1)(x2+1)");
2009
+ });
2010
+
2011
+ cy.get(cesc("#\\/expr2") + " textarea")
2012
+ .type("{end}{leftArrow}{backspace}4{enter}", { force: true })
2013
+ .blur();
2014
+
2015
+ cy.get(cesc("#\\/expr2a") + " .mjx-mrow")
2016
+ .eq(0)
2017
+ .invoke("text")
2018
+ .then((text) => {
2019
+ expect(text.trim()).eq("(x−1)(x2+4)");
2020
+ });
2021
+ cy.get(cesc("#\\/expr2") + " .mq-editable-field")
2022
+ .invoke("text")
2023
+ .then((text) => {
2024
+ expect(text.replace(/[\s\u200B-\u200D\uFEFF]/g, "")).eq("(x−1)(x2+4)");
2025
+ });
2026
+
2027
+ cy.get(cesc("#\\/expr1b") + " .mjx-mrow")
2028
+ .eq(0)
2029
+ .invoke("text")
2030
+ .then((text) => {
2031
+ expect(text.trim()).eq("(x+1)(x2−4)");
2032
+ });
2033
+ cy.get(cesc("#\\/expr2b") + " .mjx-mrow")
2034
+ .eq(0)
2035
+ .invoke("text")
2036
+ .then((text) => {
2037
+ expect(text.trim()).eq("(x−1)(x2+4)");
2038
+ });
2039
+ });
2040
+
2041
+ it("copy and overwrite title", () => {
2042
+ cy.window().then(async (win) => {
2043
+ win.postMessage(
2044
+ {
2045
+ doenetML: `
2046
+ <section includeAutoName includeAutoNumber name="sec">
2047
+ <title>A title</title>
2048
+ <p>Hello</p>
2049
+ </section>
2050
+
2051
+ <section includeAutoName includeAutoNumber name="revised" copySource="sec">
2052
+ <title>A better title</title>
2053
+ <p>Good day!</p>
2054
+ </section>
2055
+
2056
+ <p>Copy of original title: <text copySource="sec.title" name="title1" /></p>
2057
+ <p>Copy of revised title: <text copySource="revised.title" name="title2" /></p>
2058
+ <p>Original section number: <text copySource="sec.sectionNumber" name="sectionNumber1" /></p>
2059
+ <p>Revised section number: <text copySource="revised.sectionNumber" name="sectionNumber2" /></p>
2060
+
2061
+ `,
2062
+ },
2063
+ "*",
2064
+ );
2065
+ });
2066
+
2067
+ cy.get(cesc("#\\/sec_title")).should("have.text", "Section 1: A title");
2068
+ cy.get(cesc("#\\/revised_title")).should(
2069
+ "have.text",
2070
+ "Section 2: A better title",
2071
+ );
2072
+ cy.get(cesc("#\\/title1")).should("have.text", "A title");
2073
+ cy.get(cesc("#\\/title2")).should("have.text", "A better title");
2074
+ cy.get(cesc("#\\/sectionNumber1")).should("have.text", "1");
2075
+ cy.get(cesc("#\\/sectionNumber2")).should("have.text", "2");
2076
+
2077
+ cy.get(cesc("#\\/_p1")).should("have.text", "Hello");
2078
+ cy.get(cesc("#\\/revised") + " p:first-of-type").should(
2079
+ "have.text",
2080
+ "Hello",
2081
+ );
2082
+ cy.get(cesc("#\\/_p2")).should("have.text", "Good day!");
2083
+ });
2084
+
2085
+ it("copy and overwrite title, newNamespaces", () => {
2086
+ cy.window().then(async (win) => {
2087
+ win.postMessage(
2088
+ {
2089
+ doenetML: `
2090
+ <section includeAutoName includeAutoNumber name="sec" newNamespace>
2091
+ <title>A title</title>
2092
+ <p>Hello</p>
2093
+ </section>
2094
+
2095
+ <section includeAutoName includeAutoNumber name="revised" copySource="sec" newNamespace>
2096
+ <title>A better title</title>
2097
+ <p>Good day!</p>
2098
+ </section>
2099
+
2100
+ <p>Copy of original title: <text copySource="sec.title" name="title1" /></p>
2101
+ <p>Copy of revised title: <text copySource="revised.title" name="title2" /></p>
2102
+ <p>Original section number: <text copySource="sec.sectionNumber" name="sectionNumber1" /></p>
2103
+ <p>Revised section number: <text copySource="revised.sectionNumber" name="sectionNumber2" /></p>
2104
+
2105
+ `,
2106
+ },
2107
+ "*",
2108
+ );
2109
+ });
2110
+
2111
+ cy.get(cesc("#\\/sec_title")).should("have.text", "Section 1: A title");
2112
+ cy.get(cesc("#\\/revised_title")).should(
2113
+ "have.text",
2114
+ "Section 2: A better title",
2115
+ );
2116
+ cy.get(cesc("#\\/sec\\/_title1")).should("have.text", "A title");
2117
+ cy.get(cesc("#\\/revised\\/_title")).should("not.exist");
2118
+ cy.get(cesc("#\\/revised\\/_title2")).should("have.text", "A better title");
2119
+ cy.get(cesc("#\\/title1")).should("have.text", "A title");
2120
+ cy.get(cesc("#\\/title2")).should("have.text", "A better title");
2121
+ cy.get(cesc("#\\/sectionNumber1")).should("have.text", "1");
2122
+ cy.get(cesc("#\\/sectionNumber2")).should("have.text", "2");
2123
+
2124
+ cy.get(cesc("#\\/sec\\/_p1")).should("have.text", "Hello");
2125
+ cy.get(cesc("#\\/revised\\/_p1")).should("have.text", "Hello");
2126
+ cy.get(cesc("#\\/revised\\/_p2")).should("have.text", "Good day!");
2127
+ });
2128
+
2129
+ it("Auto naming of section titles", () => {
2130
+ cy.window().then(async (win) => {
2131
+ win.postMessage(
2132
+ {
2133
+ doenetML: `
2134
+ <section name="sec1">
2135
+ <p><lorem generateSentences="1" /></p>
2136
+ </section>
2137
+ <section name="sec2">
2138
+ <p><lorem generateSentences="1" /></p>
2139
+
2140
+ <section name="sec21">
2141
+ <p><lorem generateSentences="1" /></p>
2142
+ </section>
2143
+ <section name="sec22">
2144
+ <p><lorem generateSentences="1" /></p>
2145
+ <section name="sec221">
2146
+ <p><lorem generateSentences="1" /></p>
2147
+ </section>
2148
+ <section name="sec222">
2149
+ <p><lorem generateSentences="1" /></p>
2150
+ </section>
2151
+ <section name="sec223">
2152
+ <p><lorem generateSentences="1" /></p>
2153
+
2154
+ <section name="sec2231">
2155
+ <p><lorem generateSentences="1" /></p>
2156
+ </section>
2157
+ </section>
2158
+
2159
+ </section>
2160
+
2161
+ <section name="sec23">
2162
+ <p><lorem generateSentences="1" /></p>
2163
+ </section>
2164
+ </section>
2165
+
2166
+ <p>Title 1: <text name="title1" copySource="sec1.title" /></p>
2167
+ <p>Title 2: <text name="title2" copySource="sec2.title" /></p>
2168
+ <p>Title 2.1: <text name="title21" copySource="sec21.title" /></p>
2169
+ <p>Title 2.2: <text name="title22" copySource="sec22.title" /></p>
2170
+ <p>Title 2.2.1: <text name="title221" copySource="sec221.title" /></p>
2171
+ <p>Title 2.2.2: <text name="title222" copySource="sec222.title" /></p>
2172
+ <p>Title 2.2.3: <text name="title223" copySource="sec223.title" /></p>
2173
+ <p>Title 2.2.3.1: <text name="title2231" copySource="sec2231.title" /></p>
2174
+ <p>Title 2.3: <text name="title23" copySource="sec23.title" /></p>
2175
+
2176
+ <p>Number for 1: <text name="sectionNumber1" copySource="sec1.sectionNumber" /></p>
2177
+ <p>Number for 2: <text name="sectionNumber2" copySource="sec2.sectionNumber" /></p>
2178
+ <p>Number for 2.1: <text name="sectionNumber21" copySource="sec21.sectionNumber" /></p>
2179
+ <p>Number for 2.2: <text name="sectionNumber22" copySource="sec22.sectionNumber" /></p>
2180
+ <p>Number for 2.2.1: <text name="sectionNumber221" copySource="sec221.sectionNumber" /></p>
2181
+ <p>Number for 2.2.2: <text name="sectionNumber222" copySource="sec222.sectionNumber" /></p>
2182
+ <p>Number for 2.2.3: <text name="sectionNumber223" copySource="sec223.sectionNumber" /></p>
2183
+ <p>Number for 2.2.3.1: <text name="sectionNumber2231" copySource="sec2231.sectionNumber" /></p>
2184
+ <p>Number for 2.3: <text name="sectionNumber23" copySource="sec23.sectionNumber" /></p>
2185
+
2186
+ `,
2187
+ },
2188
+ "*",
2189
+ );
2190
+ });
2191
+
2192
+ cy.get(cesc("#\\/sec1_title")).should("have.text", "Section 1");
2193
+ cy.get(cesc("#\\/sec2_title")).should("have.text", "Section 2");
2194
+ cy.get(cesc("#\\/sec21_title")).should("have.text", "Section 2.1");
2195
+ cy.get(cesc("#\\/sec22_title")).should("have.text", "Section 2.2");
2196
+ cy.get(cesc("#\\/sec221_title")).should("have.text", "Section 2.2.1");
2197
+ cy.get(cesc("#\\/sec222_title")).should("have.text", "Section 2.2.2");
2198
+ cy.get(cesc("#\\/sec223_title")).should("have.text", "Section 2.2.3");
2199
+ cy.get(cesc("#\\/sec2231_title")).should("have.text", "Section 2.2.3.1");
2200
+ cy.get(cesc("#\\/sec23_title")).should("have.text", "Section 2.3");
2201
+
2202
+ cy.get(cesc("#\\/title1")).should("have.text", "Section 1");
2203
+ cy.get(cesc("#\\/title2")).should("have.text", "Section 2");
2204
+ cy.get(cesc("#\\/title21")).should("have.text", "Section 2.1");
2205
+ cy.get(cesc("#\\/title22")).should("have.text", "Section 2.2");
2206
+ cy.get(cesc("#\\/title221")).should("have.text", "Section 2.2.1");
2207
+ cy.get(cesc("#\\/title222")).should("have.text", "Section 2.2.2");
2208
+ cy.get(cesc("#\\/title223")).should("have.text", "Section 2.2.3");
2209
+ cy.get(cesc("#\\/title2231")).should("have.text", "Section 2.2.3.1");
2210
+ cy.get(cesc("#\\/title23")).should("have.text", "Section 2.3");
2211
+
2212
+ cy.get(cesc("#\\/sectionNumber1")).should("have.text", "1");
2213
+ cy.get(cesc("#\\/sectionNumber2")).should("have.text", "2");
2214
+ cy.get(cesc("#\\/sectionNumber21")).should("have.text", "2.1");
2215
+ cy.get(cesc("#\\/sectionNumber22")).should("have.text", "2.2");
2216
+ cy.get(cesc("#\\/sectionNumber221")).should("have.text", "2.2.1");
2217
+ cy.get(cesc("#\\/sectionNumber222")).should("have.text", "2.2.2");
2218
+ cy.get(cesc("#\\/sectionNumber223")).should("have.text", "2.2.3");
2219
+ cy.get(cesc("#\\/sectionNumber2231")).should("have.text", "2.2.3.1");
2220
+ cy.get(cesc("#\\/sectionNumber23")).should("have.text", "2.3");
2221
+
2222
+ cy.window().then(async (win) => {
2223
+ let stateVariables = await win.returnAllStateVariables1();
2224
+ expect(stateVariables["/sec1"].stateValues.level).eq(1);
2225
+ expect(stateVariables["/sec2"].stateValues.level).eq(1);
2226
+ expect(stateVariables["/sec21"].stateValues.level).eq(2);
2227
+ expect(stateVariables["/sec22"].stateValues.level).eq(2);
2228
+ expect(stateVariables["/sec221"].stateValues.level).eq(3);
2229
+ expect(stateVariables["/sec222"].stateValues.level).eq(3);
2230
+ expect(stateVariables["/sec223"].stateValues.level).eq(3);
2231
+ expect(stateVariables["/sec2231"].stateValues.level).eq(4);
2232
+ expect(stateVariables["/sec23"].stateValues.level).eq(2);
2233
+ });
2234
+ });
2235
+
2236
+ it("Not auto naming of section titles with custom titles, by default", () => {
2237
+ cy.window().then(async (win) => {
2238
+ win.postMessage(
2239
+ {
2240
+ doenetML: `
2241
+ <section name="sec1">
2242
+ <title>A</title>
2243
+ <p><lorem generateSentences="1" /></p>
2244
+ </section>
2245
+ <section name="sec2">
2246
+ <title>B</title>
2247
+ <p><lorem generateSentences="1" /></p>
2248
+
2249
+ <section name="sec21">
2250
+ <title>BA</title>
2251
+ <p><lorem generateSentences="1" /></p>
2252
+ </section>
2253
+ <section name="sec22">
2254
+ <title>BB</title>
2255
+ <p><lorem generateSentences="1" /></p>
2256
+ <section name="sec221">
2257
+ <title>BBA</title>
2258
+ <p><lorem generateSentences="1" /></p>
2259
+ </section>
2260
+ <section name="sec222">
2261
+ <title>BBB</title>
2262
+ <p><lorem generateSentences="1" /></p>
2263
+ </section>
2264
+ <section name="sec223">
2265
+ <title>BBC</title>
2266
+ <p><lorem generateSentences="1" /></p>
2267
+
2268
+ <section name="sec2231">
2269
+ <title>BBCA</title>
2270
+ <p><lorem generateSentences="1" /></p>
2271
+ </section>
2272
+ </section>
2273
+
2274
+ </section>
2275
+
2276
+ <section name="sec23">
2277
+ <title>BC</title>
2278
+ <p><lorem generateSentences="1" /></p>
2279
+ </section>
2280
+ </section>
2281
+
2282
+ <p>Title 1: <text name="title1" copySource="sec1.title" /></p>
2283
+ <p>Title 2: <text name="title2" copySource="sec2.title" /></p>
2284
+ <p>Title 2.1: <text name="title21" copySource="sec21.title" /></p>
2285
+ <p>Title 2.2: <text name="title22" copySource="sec22.title" /></p>
2286
+ <p>Title 2.2.1: <text name="title221" copySource="sec221.title" /></p>
2287
+ <p>Title 2.2.2: <text name="title222" copySource="sec222.title" /></p>
2288
+ <p>Title 2.2.3: <text name="title223" copySource="sec223.title" /></p>
2289
+ <p>Title 2.2.3.1: <text name="title2231" copySource="sec2231.title" /></p>
2290
+ <p>Title 2.3: <text name="title23" copySource="sec23.title" /></p>
2291
+
2292
+ <p>Number for 1: <text name="sectionNumber1" copySource="sec1.sectionNumber" /></p>
2293
+ <p>Number for 2: <text name="sectionNumber2" copySource="sec2.sectionNumber" /></p>
2294
+ <p>Number for 2.1: <text name="sectionNumber21" copySource="sec21.sectionNumber" /></p>
2295
+ <p>Number for 2.2: <text name="sectionNumber22" copySource="sec22.sectionNumber" /></p>
2296
+ <p>Number for 2.2.1: <text name="sectionNumber221" copySource="sec221.sectionNumber" /></p>
2297
+ <p>Number for 2.2.2: <text name="sectionNumber222" copySource="sec222.sectionNumber" /></p>
2298
+ <p>Number for 2.2.3: <text name="sectionNumber223" copySource="sec223.sectionNumber" /></p>
2299
+ <p>Number for 2.2.3.1: <text name="sectionNumber2231" copySource="sec2231.sectionNumber" /></p>
2300
+ <p>Number for 2.3: <text name="sectionNumber23" copySource="sec23.sectionNumber" /></p>
2301
+
2302
+
2303
+ `,
2304
+ },
2305
+ "*",
2306
+ );
2307
+ });
2308
+
2309
+ cy.get(cesc("#\\/sec1_title")).should("have.text", "A");
2310
+ cy.get(cesc("#\\/sec2_title")).should("have.text", "B");
2311
+ cy.get(cesc("#\\/sec21_title")).should("have.text", "BA");
2312
+ cy.get(cesc("#\\/sec22_title")).should("have.text", "BB");
2313
+ cy.get(cesc("#\\/sec221_title")).should("have.text", "BBA");
2314
+ cy.get(cesc("#\\/sec222_title")).should("have.text", "BBB");
2315
+ cy.get(cesc("#\\/sec223_title")).should("have.text", "BBC");
2316
+ cy.get(cesc("#\\/sec2231_title")).should("have.text", "BBCA");
2317
+ cy.get(cesc("#\\/sec23_title")).should("have.text", "BC");
2318
+
2319
+ cy.get(cesc("#\\/title1")).should("have.text", "A");
2320
+ cy.get(cesc("#\\/title2")).should("have.text", "B");
2321
+ cy.get(cesc("#\\/title21")).should("have.text", "BA");
2322
+ cy.get(cesc("#\\/title22")).should("have.text", "BB");
2323
+ cy.get(cesc("#\\/title221")).should("have.text", "BBA");
2324
+ cy.get(cesc("#\\/title222")).should("have.text", "BBB");
2325
+ cy.get(cesc("#\\/title223")).should("have.text", "BBC");
2326
+ cy.get(cesc("#\\/title2231")).should("have.text", "BBCA");
2327
+ cy.get(cesc("#\\/title23")).should("have.text", "BC");
2328
+
2329
+ cy.get(cesc("#\\/sectionNumber1")).should("have.text", "1");
2330
+ cy.get(cesc("#\\/sectionNumber2")).should("have.text", "2");
2331
+ cy.get(cesc("#\\/sectionNumber21")).should("have.text", "2.1");
2332
+ cy.get(cesc("#\\/sectionNumber22")).should("have.text", "2.2");
2333
+ cy.get(cesc("#\\/sectionNumber221")).should("have.text", "2.2.1");
2334
+ cy.get(cesc("#\\/sectionNumber222")).should("have.text", "2.2.2");
2335
+ cy.get(cesc("#\\/sectionNumber223")).should("have.text", "2.2.3");
2336
+ cy.get(cesc("#\\/sectionNumber2231")).should("have.text", "2.2.3.1");
2337
+ cy.get(cesc("#\\/sectionNumber23")).should("have.text", "2.3");
2338
+
2339
+ cy.window().then(async (win) => {
2340
+ let stateVariables = await win.returnAllStateVariables1();
2341
+ expect(stateVariables["/sec1"].stateValues.level).eq(1);
2342
+ expect(stateVariables["/sec2"].stateValues.level).eq(1);
2343
+ expect(stateVariables["/sec21"].stateValues.level).eq(2);
2344
+ expect(stateVariables["/sec22"].stateValues.level).eq(2);
2345
+ expect(stateVariables["/sec221"].stateValues.level).eq(3);
2346
+ expect(stateVariables["/sec222"].stateValues.level).eq(3);
2347
+ expect(stateVariables["/sec223"].stateValues.level).eq(3);
2348
+ expect(stateVariables["/sec2231"].stateValues.level).eq(4);
2349
+ expect(stateVariables["/sec23"].stateValues.level).eq(2);
2350
+ });
2351
+ });
2352
+
2353
+ it("Add auto number to section titles with custom titles", () => {
2354
+ cy.window().then(async (win) => {
2355
+ win.postMessage(
2356
+ {
2357
+ doenetML: `
2358
+ <section includeAutoNumber name="sec1">
2359
+ <title>A</title>
2360
+ <p><lorem generateSentences="1" /></p>
2361
+ </section>
2362
+ <section includeAutoNumber name="sec2">
2363
+ <title>B</title>
2364
+ <p><lorem generateSentences="1" /></p>
2365
+
2366
+ <section includeAutoNumber name="sec21">
2367
+ <title>BA</title>
2368
+ <p><lorem generateSentences="1" /></p>
2369
+ </section>
2370
+ <section includeAutoNumber name="sec22">
2371
+ <title>BB</title>
2372
+ <p><lorem generateSentences="1" /></p>
2373
+ <section includeAutoNumber name="sec221">
2374
+ <title>BBA</title>
2375
+ <p><lorem generateSentences="1" /></p>
2376
+ </section>
2377
+ <section includeAutoNumber name="sec222">
2378
+ <title>BBB</title>
2379
+ <p><lorem generateSentences="1" /></p>
2380
+ </section>
2381
+ <section includeAutoNumber name="sec223">
2382
+ <title>BBC</title>
2383
+ <p><lorem generateSentences="1" /></p>
2384
+
2385
+ <section includeAutoNumber name="sec2231">
2386
+ <title>BBCA</title>
2387
+ <p><lorem generateSentences="1" /></p>
2388
+ </section>
2389
+ </section>
2390
+
2391
+ </section>
2392
+
2393
+ <section includeAutoNumber name="sec23">
2394
+ <title>BC</title>
2395
+ <p><lorem generateSentences="1" /></p>
2396
+ </section>
2397
+ </section>
2398
+
2399
+ <p>Title 1: <text name="title1" copySource="sec1.title" /></p>
2400
+ <p>Title 2: <text name="title2" copySource="sec2.title" /></p>
2401
+ <p>Title 2.1: <text name="title21" copySource="sec21.title" /></p>
2402
+ <p>Title 2.2: <text name="title22" copySource="sec22.title" /></p>
2403
+ <p>Title 2.2.1: <text name="title221" copySource="sec221.title" /></p>
2404
+ <p>Title 2.2.2: <text name="title222" copySource="sec222.title" /></p>
2405
+ <p>Title 2.2.3: <text name="title223" copySource="sec223.title" /></p>
2406
+ <p>Title 2.2.3.1: <text name="title2231" copySource="sec2231.title" /></p>
2407
+ <p>Title 2.3: <text name="title23" copySource="sec23.title" /></p>
2408
+
2409
+ <p>Number for 1: <text name="sectionNumber1" copySource="sec1.sectionNumber" /></p>
2410
+ <p>Number for 2: <text name="sectionNumber2" copySource="sec2.sectionNumber" /></p>
2411
+ <p>Number for 2.1: <text name="sectionNumber21" copySource="sec21.sectionNumber" /></p>
2412
+ <p>Number for 2.2: <text name="sectionNumber22" copySource="sec22.sectionNumber" /></p>
2413
+ <p>Number for 2.2.1: <text name="sectionNumber221" copySource="sec221.sectionNumber" /></p>
2414
+ <p>Number for 2.2.2: <text name="sectionNumber222" copySource="sec222.sectionNumber" /></p>
2415
+ <p>Number for 2.2.3: <text name="sectionNumber223" copySource="sec223.sectionNumber" /></p>
2416
+ <p>Number for 2.2.3.1: <text name="sectionNumber2231" copySource="sec2231.sectionNumber" /></p>
2417
+ <p>Number for 2.3: <text name="sectionNumber23" copySource="sec23.sectionNumber" /></p>
2418
+
2419
+
2420
+ `,
2421
+ },
2422
+ "*",
2423
+ );
2424
+ });
2425
+
2426
+ cy.get(cesc("#\\/sec1_title")).should("have.text", "1. A");
2427
+ cy.get(cesc("#\\/sec2_title")).should("have.text", "2. B");
2428
+ cy.get(cesc("#\\/sec21_title")).should("have.text", "2.1. BA");
2429
+ cy.get(cesc("#\\/sec22_title")).should("have.text", "2.2. BB");
2430
+ cy.get(cesc("#\\/sec221_title")).should("have.text", "2.2.1. BBA");
2431
+ cy.get(cesc("#\\/sec222_title")).should("have.text", "2.2.2. BBB");
2432
+ cy.get(cesc("#\\/sec223_title")).should("have.text", "2.2.3. BBC");
2433
+ cy.get(cesc("#\\/sec2231_title")).should("have.text", "2.2.3.1. BBCA");
2434
+ cy.get(cesc("#\\/sec23_title")).should("have.text", "2.3. BC");
2435
+
2436
+ cy.get(cesc("#\\/title1")).should("have.text", "A");
2437
+ cy.get(cesc("#\\/title2")).should("have.text", "B");
2438
+ cy.get(cesc("#\\/title21")).should("have.text", "BA");
2439
+ cy.get(cesc("#\\/title22")).should("have.text", "BB");
2440
+ cy.get(cesc("#\\/title221")).should("have.text", "BBA");
2441
+ cy.get(cesc("#\\/title222")).should("have.text", "BBB");
2442
+ cy.get(cesc("#\\/title223")).should("have.text", "BBC");
2443
+ cy.get(cesc("#\\/title2231")).should("have.text", "BBCA");
2444
+ cy.get(cesc("#\\/title23")).should("have.text", "BC");
2445
+
2446
+ cy.get(cesc("#\\/sectionNumber1")).should("have.text", "1");
2447
+ cy.get(cesc("#\\/sectionNumber2")).should("have.text", "2");
2448
+ cy.get(cesc("#\\/sectionNumber21")).should("have.text", "2.1");
2449
+ cy.get(cesc("#\\/sectionNumber22")).should("have.text", "2.2");
2450
+ cy.get(cesc("#\\/sectionNumber221")).should("have.text", "2.2.1");
2451
+ cy.get(cesc("#\\/sectionNumber222")).should("have.text", "2.2.2");
2452
+ cy.get(cesc("#\\/sectionNumber223")).should("have.text", "2.2.3");
2453
+ cy.get(cesc("#\\/sectionNumber2231")).should("have.text", "2.2.3.1");
2454
+ cy.get(cesc("#\\/sectionNumber23")).should("have.text", "2.3");
2455
+
2456
+ cy.window().then(async (win) => {
2457
+ let stateVariables = await win.returnAllStateVariables1();
2458
+ expect(stateVariables["/sec1"].stateValues.level).eq(1);
2459
+ expect(stateVariables["/sec2"].stateValues.level).eq(1);
2460
+ expect(stateVariables["/sec21"].stateValues.level).eq(2);
2461
+ expect(stateVariables["/sec22"].stateValues.level).eq(2);
2462
+ expect(stateVariables["/sec221"].stateValues.level).eq(3);
2463
+ expect(stateVariables["/sec222"].stateValues.level).eq(3);
2464
+ expect(stateVariables["/sec223"].stateValues.level).eq(3);
2465
+ expect(stateVariables["/sec2231"].stateValues.level).eq(4);
2466
+ expect(stateVariables["/sec23"].stateValues.level).eq(2);
2467
+ });
2468
+ });
2469
+
2470
+ it("Add auto name and number to section titles with custom titles", () => {
2471
+ cy.window().then(async (win) => {
2472
+ win.postMessage(
2473
+ {
2474
+ doenetML: `
2475
+ <section includeAutoNumber includeAutoName name="sec1">
2476
+ <title>A</title>
2477
+ <p><lorem generateSentences="1" /></p>
2478
+ </section>
2479
+ <section includeAutoNumber includeAutoName name="sec2">
2480
+ <title>B</title>
2481
+ <p><lorem generateSentences="1" /></p>
2482
+
2483
+ <section includeAutoNumber includeAutoName name="sec21">
2484
+ <title>BA</title>
2485
+ <p><lorem generateSentences="1" /></p>
2486
+ </section>
2487
+ <section includeAutoNumber includeAutoName name="sec22">
2488
+ <title>BB</title>
2489
+ <p><lorem generateSentences="1" /></p>
2490
+ <section includeAutoNumber includeAutoName name="sec221">
2491
+ <title>BBA</title>
2492
+ <p><lorem generateSentences="1" /></p>
2493
+ </section>
2494
+ <section includeAutoNumber includeAutoName name="sec222">
2495
+ <title>BBB</title>
2496
+ <p><lorem generateSentences="1" /></p>
2497
+ </section>
2498
+ <section includeAutoNumber includeAutoName name="sec223">
2499
+ <title>BBC</title>
2500
+ <p><lorem generateSentences="1" /></p>
2501
+
2502
+ <section includeAutoNumber includeAutoName name="sec2231">
2503
+ <title>BBCA</title>
2504
+ <p><lorem generateSentences="1" /></p>
2505
+ </section>
2506
+ </section>
2507
+
2508
+ </section>
2509
+
2510
+ <section includeAutoNumber includeAutoName name="sec23">
2511
+ <title>BC</title>
2512
+ <p><lorem generateSentences="1" /></p>
2513
+ </section>
2514
+ </section>
2515
+
2516
+ <p>Title 1: <text name="title1" copySource="sec1.title" /></p>
2517
+ <p>Title 2: <text name="title2" copySource="sec2.title" /></p>
2518
+ <p>Title 2.1: <text name="title21" copySource="sec21.title" /></p>
2519
+ <p>Title 2.2: <text name="title22" copySource="sec22.title" /></p>
2520
+ <p>Title 2.2.1: <text name="title221" copySource="sec221.title" /></p>
2521
+ <p>Title 2.2.2: <text name="title222" copySource="sec222.title" /></p>
2522
+ <p>Title 2.2.3: <text name="title223" copySource="sec223.title" /></p>
2523
+ <p>Title 2.2.3.1: <text name="title2231" copySource="sec2231.title" /></p>
2524
+ <p>Title 2.3: <text name="title23" copySource="sec23.title" /></p>
2525
+
2526
+ <p>Number for 1: <text name="sectionNumber1" copySource="sec1.sectionNumber" /></p>
2527
+ <p>Number for 2: <text name="sectionNumber2" copySource="sec2.sectionNumber" /></p>
2528
+ <p>Number for 2.1: <text name="sectionNumber21" copySource="sec21.sectionNumber" /></p>
2529
+ <p>Number for 2.2: <text name="sectionNumber22" copySource="sec22.sectionNumber" /></p>
2530
+ <p>Number for 2.2.1: <text name="sectionNumber221" copySource="sec221.sectionNumber" /></p>
2531
+ <p>Number for 2.2.2: <text name="sectionNumber222" copySource="sec222.sectionNumber" /></p>
2532
+ <p>Number for 2.2.3: <text name="sectionNumber223" copySource="sec223.sectionNumber" /></p>
2533
+ <p>Number for 2.2.3.1: <text name="sectionNumber2231" copySource="sec2231.sectionNumber" /></p>
2534
+ <p>Number for 2.3: <text name="sectionNumber23" copySource="sec23.sectionNumber" /></p>
2535
+
2536
+
2537
+ `,
2538
+ },
2539
+ "*",
2540
+ );
2541
+ });
2542
+
2543
+ cy.get(cesc("#\\/sec1_title")).should("have.text", "Section 1: A");
2544
+ cy.get(cesc("#\\/sec2_title")).should("have.text", "Section 2: B");
2545
+ cy.get(cesc("#\\/sec21_title")).should("have.text", "Section 2.1: BA");
2546
+ cy.get(cesc("#\\/sec22_title")).should("have.text", "Section 2.2: BB");
2547
+ cy.get(cesc("#\\/sec221_title")).should("have.text", "Section 2.2.1: BBA");
2548
+ cy.get(cesc("#\\/sec222_title")).should("have.text", "Section 2.2.2: BBB");
2549
+ cy.get(cesc("#\\/sec223_title")).should("have.text", "Section 2.2.3: BBC");
2550
+ cy.get(cesc("#\\/sec2231_title")).should(
2551
+ "have.text",
2552
+ "Section 2.2.3.1: BBCA",
2553
+ );
2554
+ cy.get(cesc("#\\/sec23_title")).should("have.text", "Section 2.3: BC");
2555
+
2556
+ cy.get(cesc("#\\/title1")).should("have.text", "A");
2557
+ cy.get(cesc("#\\/title2")).should("have.text", "B");
2558
+ cy.get(cesc("#\\/title21")).should("have.text", "BA");
2559
+ cy.get(cesc("#\\/title22")).should("have.text", "BB");
2560
+ cy.get(cesc("#\\/title221")).should("have.text", "BBA");
2561
+ cy.get(cesc("#\\/title222")).should("have.text", "BBB");
2562
+ cy.get(cesc("#\\/title223")).should("have.text", "BBC");
2563
+ cy.get(cesc("#\\/title2231")).should("have.text", "BBCA");
2564
+ cy.get(cesc("#\\/title23")).should("have.text", "BC");
2565
+
2566
+ cy.get(cesc("#\\/sectionNumber1")).should("have.text", "1");
2567
+ cy.get(cesc("#\\/sectionNumber2")).should("have.text", "2");
2568
+ cy.get(cesc("#\\/sectionNumber21")).should("have.text", "2.1");
2569
+ cy.get(cesc("#\\/sectionNumber22")).should("have.text", "2.2");
2570
+ cy.get(cesc("#\\/sectionNumber221")).should("have.text", "2.2.1");
2571
+ cy.get(cesc("#\\/sectionNumber222")).should("have.text", "2.2.2");
2572
+ cy.get(cesc("#\\/sectionNumber223")).should("have.text", "2.2.3");
2573
+ cy.get(cesc("#\\/sectionNumber2231")).should("have.text", "2.2.3.1");
2574
+ cy.get(cesc("#\\/sectionNumber23")).should("have.text", "2.3");
2575
+
2576
+ cy.window().then(async (win) => {
2577
+ let stateVariables = await win.returnAllStateVariables1();
2578
+ expect(stateVariables["/sec1"].stateValues.level).eq(1);
2579
+ expect(stateVariables["/sec2"].stateValues.level).eq(1);
2580
+ expect(stateVariables["/sec21"].stateValues.level).eq(2);
2581
+ expect(stateVariables["/sec22"].stateValues.level).eq(2);
2582
+ expect(stateVariables["/sec221"].stateValues.level).eq(3);
2583
+ expect(stateVariables["/sec222"].stateValues.level).eq(3);
2584
+ expect(stateVariables["/sec223"].stateValues.level).eq(3);
2585
+ expect(stateVariables["/sec2231"].stateValues.level).eq(4);
2586
+ expect(stateVariables["/sec23"].stateValues.level).eq(2);
2587
+ });
2588
+ });
2589
+
2590
+ it("Add auto name to section titles with custom titles", () => {
2591
+ cy.window().then(async (win) => {
2592
+ win.postMessage(
2593
+ {
2594
+ doenetML: `
2595
+ <section includeAutoName name="sec1">
2596
+ <title>A</title>
2597
+ <p><lorem generateSentences="1" /></p>
2598
+ </section>
2599
+ <section includeAutoName name="sec2">
2600
+ <title>B</title>
2601
+ <p><lorem generateSentences="1" /></p>
2602
+
2603
+ <section includeAutoName name="sec21">
2604
+ <title>BA</title>
2605
+ <p><lorem generateSentences="1" /></p>
2606
+ </section>
2607
+ <section includeAutoName name="sec22">
2608
+ <title>BB</title>
2609
+ <p><lorem generateSentences="1" /></p>
2610
+ <section includeAutoName name="sec221">
2611
+ <title>BBA</title>
2612
+ <p><lorem generateSentences="1" /></p>
2613
+ </section>
2614
+ <section includeAutoName name="sec222">
2615
+ <title>BBB</title>
2616
+ <p><lorem generateSentences="1" /></p>
2617
+ </section>
2618
+ <section includeAutoName name="sec223">
2619
+ <title>BBC</title>
2620
+ <p><lorem generateSentences="1" /></p>
2621
+
2622
+ <section includeAutoName name="sec2231">
2623
+ <title>BBCA</title>
2624
+ <p><lorem generateSentences="1" /></p>
2625
+ </section>
2626
+ </section>
2627
+
2628
+ </section>
2629
+
2630
+ <section includeAutoName name="sec23">
2631
+ <title>BC</title>
2632
+ <p><lorem generateSentences="1" /></p>
2633
+ </section>
2634
+ </section>
2635
+
2636
+ <p>Title 1: <text name="title1" copySource="sec1.title" /></p>
2637
+ <p>Title 2: <text name="title2" copySource="sec2.title" /></p>
2638
+ <p>Title 2.1: <text name="title21" copySource="sec21.title" /></p>
2639
+ <p>Title 2.2: <text name="title22" copySource="sec22.title" /></p>
2640
+ <p>Title 2.2.1: <text name="title221" copySource="sec221.title" /></p>
2641
+ <p>Title 2.2.2: <text name="title222" copySource="sec222.title" /></p>
2642
+ <p>Title 2.2.3: <text name="title223" copySource="sec223.title" /></p>
2643
+ <p>Title 2.2.3.1: <text name="title2231" copySource="sec2231.title" /></p>
2644
+ <p>Title 2.3: <text name="title23" copySource="sec23.title" /></p>
2645
+
2646
+ <p>Number for 1: <text name="sectionNumber1" copySource="sec1.sectionNumber" /></p>
2647
+ <p>Number for 2: <text name="sectionNumber2" copySource="sec2.sectionNumber" /></p>
2648
+ <p>Number for 2.1: <text name="sectionNumber21" copySource="sec21.sectionNumber" /></p>
2649
+ <p>Number for 2.2: <text name="sectionNumber22" copySource="sec22.sectionNumber" /></p>
2650
+ <p>Number for 2.2.1: <text name="sectionNumber221" copySource="sec221.sectionNumber" /></p>
2651
+ <p>Number for 2.2.2: <text name="sectionNumber222" copySource="sec222.sectionNumber" /></p>
2652
+ <p>Number for 2.2.3: <text name="sectionNumber223" copySource="sec223.sectionNumber" /></p>
2653
+ <p>Number for 2.2.3.1: <text name="sectionNumber2231" copySource="sec2231.sectionNumber" /></p>
2654
+ <p>Number for 2.3: <text name="sectionNumber23" copySource="sec23.sectionNumber" /></p>
2655
+
2656
+
2657
+ `,
2658
+ },
2659
+ "*",
2660
+ );
2661
+ });
2662
+
2663
+ cy.get(cesc("#\\/sec1_title")).should("have.text", "Section: A");
2664
+ cy.get(cesc("#\\/sec2_title")).should("have.text", "Section: B");
2665
+ cy.get(cesc("#\\/sec21_title")).should("have.text", "Section: BA");
2666
+ cy.get(cesc("#\\/sec22_title")).should("have.text", "Section: BB");
2667
+ cy.get(cesc("#\\/sec221_title")).should("have.text", "Section: BBA");
2668
+ cy.get(cesc("#\\/sec222_title")).should("have.text", "Section: BBB");
2669
+ cy.get(cesc("#\\/sec223_title")).should("have.text", "Section: BBC");
2670
+ cy.get(cesc("#\\/sec2231_title")).should("have.text", "Section: BBCA");
2671
+ cy.get(cesc("#\\/sec23_title")).should("have.text", "Section: BC");
2672
+
2673
+ cy.get(cesc("#\\/title1")).should("have.text", "A");
2674
+ cy.get(cesc("#\\/title2")).should("have.text", "B");
2675
+ cy.get(cesc("#\\/title21")).should("have.text", "BA");
2676
+ cy.get(cesc("#\\/title22")).should("have.text", "BB");
2677
+ cy.get(cesc("#\\/title221")).should("have.text", "BBA");
2678
+ cy.get(cesc("#\\/title222")).should("have.text", "BBB");
2679
+ cy.get(cesc("#\\/title223")).should("have.text", "BBC");
2680
+ cy.get(cesc("#\\/title2231")).should("have.text", "BBCA");
2681
+ cy.get(cesc("#\\/title23")).should("have.text", "BC");
2682
+
2683
+ cy.get(cesc("#\\/sectionNumber1")).should("have.text", "1");
2684
+ cy.get(cesc("#\\/sectionNumber2")).should("have.text", "2");
2685
+ cy.get(cesc("#\\/sectionNumber21")).should("have.text", "2.1");
2686
+ cy.get(cesc("#\\/sectionNumber22")).should("have.text", "2.2");
2687
+ cy.get(cesc("#\\/sectionNumber221")).should("have.text", "2.2.1");
2688
+ cy.get(cesc("#\\/sectionNumber222")).should("have.text", "2.2.2");
2689
+ cy.get(cesc("#\\/sectionNumber223")).should("have.text", "2.2.3");
2690
+ cy.get(cesc("#\\/sectionNumber2231")).should("have.text", "2.2.3.1");
2691
+ cy.get(cesc("#\\/sectionNumber23")).should("have.text", "2.3");
2692
+
2693
+ cy.window().then(async (win) => {
2694
+ let stateVariables = await win.returnAllStateVariables1();
2695
+ expect(stateVariables["/sec1"].stateValues.level).eq(1);
2696
+ expect(stateVariables["/sec2"].stateValues.level).eq(1);
2697
+ expect(stateVariables["/sec21"].stateValues.level).eq(2);
2698
+ expect(stateVariables["/sec22"].stateValues.level).eq(2);
2699
+ expect(stateVariables["/sec221"].stateValues.level).eq(3);
2700
+ expect(stateVariables["/sec222"].stateValues.level).eq(3);
2701
+ expect(stateVariables["/sec223"].stateValues.level).eq(3);
2702
+ expect(stateVariables["/sec2231"].stateValues.level).eq(4);
2703
+ expect(stateVariables["/sec23"].stateValues.level).eq(2);
2704
+ });
2705
+ });
2706
+
2707
+ it("Add auto name and number to section titles with custom titles, turning off include parent number", () => {
2708
+ cy.window().then(async (win) => {
2709
+ win.postMessage(
2710
+ {
2711
+ doenetML: `
2712
+ <section includeAutoNumber includeAutoName name="sec1">
2713
+ <title>A</title>
2714
+ <p><lorem generateSentences="1" /></p>
2715
+ </section>
2716
+ <section includeAutoNumber includeAutoName name="sec2">
2717
+ <title>B</title>
2718
+ <p><lorem generateSentences="1" /></p>
2719
+
2720
+ <section includeAutoNumber includeAutoName name="sec21">
2721
+ <title>BA</title>
2722
+ <p><lorem generateSentences="1" /></p>
2723
+ <section includeAutoNumber includeAutoName name="sec211" includeParentNumber="false">
2724
+ <title>BAA</title>
2725
+ <p><lorem generateSentences="1" /></p>
2726
+ <section includeAutoNumber includeAutoName name="sec2111">
2727
+ <title>BAAA</title>
2728
+ <p><lorem generateSentences="1" /></p>
2729
+ </section>
2730
+ <section includeAutoNumber includeAutoName name="sec2112">
2731
+ <title>BAAB</title>
2732
+ <p><lorem generateSentences="1" /></p>
2733
+ </section>
2734
+ </section>
2735
+ </section>
2736
+ <section includeAutoNumber includeAutoName name="sec22" includeParentNumber="false">
2737
+ <title>BB</title>
2738
+ <p><lorem generateSentences="1" /></p>
2739
+ <section includeAutoNumber includeAutoName name="sec221">
2740
+ <title>BBA</title>
2741
+ <p><lorem generateSentences="1" /></p>
2742
+ </section>
2743
+ <section includeAutoNumber includeAutoName name="sec222">
2744
+ <title>BBB</title>
2745
+ <p><lorem generateSentences="1" /></p>
2746
+ </section>
2747
+ <section includeAutoNumber includeAutoName name="sec223">
2748
+ <title>BBC</title>
2749
+ <p><lorem generateSentences="1" /></p>
2750
+
2751
+ <section includeAutoNumber includeAutoName name="sec2231">
2752
+ <title>BBCA</title>
2753
+ <p><lorem generateSentences="1" /></p>
2754
+ </section>
2755
+ </section>
2756
+
2757
+ </section>
2758
+
2759
+ <section includeAutoNumber includeAutoName name="sec23">
2760
+ <title>BC</title>
2761
+ <p><lorem generateSentences="1" /></p>
2762
+ </section>
2763
+ </section>
2764
+
2765
+
2766
+ <p>Title 1: <text name="title1" copySource="sec1.title" /></p>
2767
+ <p>Title 2: <text name="title2" copySource="sec2.title" /></p>
2768
+ <p>Title 2.1: <text name="title21" copySource="sec21.title" /></p>
2769
+ <p>Title 2.1.1: <text name="title211" copySource="sec211.title" /></p>
2770
+ <p>Title 2.1.1.1: <text name="title2111" copySource="sec2111.title" /></p>
2771
+ <p>Title 2.1.1.2: <text name="title2112" copySource="sec2112.title" /></p>
2772
+ <p>Title 2.2: <text name="title22" copySource="sec22.title" /></p>
2773
+ <p>Title 2.2.1: <text name="title221" copySource="sec221.title" /></p>
2774
+ <p>Title 2.2.2: <text name="title222" copySource="sec222.title" /></p>
2775
+ <p>Title 2.2.3: <text name="title223" copySource="sec223.title" /></p>
2776
+ <p>Title 2.2.3.1: <text name="title2231" copySource="sec2231.title" /></p>
2777
+ <p>Title 2.3: <text name="title23" copySource="sec23.title" /></p>
2778
+
2779
+ <p>Number for 1: <text name="sectionNumber1" copySource="sec1.sectionNumber" /></p>
2780
+ <p>Number for 2: <text name="sectionNumber2" copySource="sec2.sectionNumber" /></p>
2781
+ <p>Number for 2.1: <text name="sectionNumber21" copySource="sec21.sectionNumber" /></p>
2782
+ <p>Number for 2.1.1: <text name="sectionNumber211" copySource="sec211.sectionNumber" /></p>
2783
+ <p>Number for 2.1.1.1: <text name="sectionNumber2111" copySource="sec2111.sectionNumber" /></p>
2784
+ <p>Number for 2.1.1.2: <text name="sectionNumber2112" copySource="sec2112.sectionNumber" /></p>
2785
+ <p>Number for 2.2: <text name="sectionNumber22" copySource="sec22.sectionNumber" /></p>
2786
+ <p>Number for 2.2.1: <text name="sectionNumber221" copySource="sec221.sectionNumber" /></p>
2787
+ <p>Number for 2.2.2: <text name="sectionNumber222" copySource="sec222.sectionNumber" /></p>
2788
+ <p>Number for 2.2.3: <text name="sectionNumber223" copySource="sec223.sectionNumber" /></p>
2789
+ <p>Number for 2.2.3.1: <text name="sectionNumber2231" copySource="sec2231.sectionNumber" /></p>
2790
+ <p>Number for 2.3: <text name="sectionNumber23" copySource="sec23.sectionNumber" /></p>
2791
+
2792
+
2793
+ `,
2794
+ },
2795
+ "*",
2796
+ );
2797
+ });
2798
+
2799
+ cy.get(cesc("#\\/sec1_title")).should("have.text", "Section 1: A");
2800
+ cy.get(cesc("#\\/sec2_title")).should("have.text", "Section 2: B");
2801
+ cy.get(cesc("#\\/sec21_title")).should("have.text", "Section 2.1: BA");
2802
+ cy.get(cesc("#\\/sec211_title")).should("have.text", "Section 1: BAA");
2803
+ cy.get(cesc("#\\/sec2111_title")).should("have.text", "Section 1.1: BAAA");
2804
+ cy.get(cesc("#\\/sec2112_title")).should("have.text", "Section 1.2: BAAB");
2805
+ cy.get(cesc("#\\/sec22_title")).should("have.text", "Section 2: BB");
2806
+ cy.get(cesc("#\\/sec221_title")).should("have.text", "Section 2.1: BBA");
2807
+ cy.get(cesc("#\\/sec222_title")).should("have.text", "Section 2.2: BBB");
2808
+ cy.get(cesc("#\\/sec223_title")).should("have.text", "Section 2.3: BBC");
2809
+ cy.get(cesc("#\\/sec2231_title")).should(
2810
+ "have.text",
2811
+ "Section 2.3.1: BBCA",
2812
+ );
2813
+ cy.get(cesc("#\\/sec23_title")).should("have.text", "Section 2.3: BC");
2814
+
2815
+ cy.get(cesc("#\\/title1")).should("have.text", "A");
2816
+ cy.get(cesc("#\\/title2")).should("have.text", "B");
2817
+ cy.get(cesc("#\\/title21")).should("have.text", "BA");
2818
+ cy.get(cesc("#\\/title211")).should("have.text", "BAA");
2819
+ cy.get(cesc("#\\/title2111")).should("have.text", "BAAA");
2820
+ cy.get(cesc("#\\/title2112")).should("have.text", "BAAB");
2821
+ cy.get(cesc("#\\/title22")).should("have.text", "BB");
2822
+ cy.get(cesc("#\\/title221")).should("have.text", "BBA");
2823
+ cy.get(cesc("#\\/title222")).should("have.text", "BBB");
2824
+ cy.get(cesc("#\\/title223")).should("have.text", "BBC");
2825
+ cy.get(cesc("#\\/title2231")).should("have.text", "BBCA");
2826
+ cy.get(cesc("#\\/title23")).should("have.text", "BC");
2827
+
2828
+ cy.get(cesc("#\\/sectionNumber1")).should("have.text", "1");
2829
+ cy.get(cesc("#\\/sectionNumber2")).should("have.text", "2");
2830
+ cy.get(cesc("#\\/sectionNumber21")).should("have.text", "2.1");
2831
+ cy.get(cesc("#\\/sectionNumber211")).should("have.text", "1");
2832
+ cy.get(cesc("#\\/sectionNumber2111")).should("have.text", "1.1");
2833
+ cy.get(cesc("#\\/sectionNumber2112")).should("have.text", "1.2");
2834
+ cy.get(cesc("#\\/sectionNumber22")).should("have.text", "2");
2835
+ cy.get(cesc("#\\/sectionNumber221")).should("have.text", "2.1");
2836
+ cy.get(cesc("#\\/sectionNumber222")).should("have.text", "2.2");
2837
+ cy.get(cesc("#\\/sectionNumber223")).should("have.text", "2.3");
2838
+ cy.get(cesc("#\\/sectionNumber2231")).should("have.text", "2.3.1");
2839
+ cy.get(cesc("#\\/sectionNumber23")).should("have.text", "2.3");
2840
+
2841
+ cy.window().then(async (win) => {
2842
+ let stateVariables = await win.returnAllStateVariables1();
2843
+ expect(stateVariables["/sec1"].stateValues.level).eq(1);
2844
+ expect(stateVariables["/sec2"].stateValues.level).eq(1);
2845
+ expect(stateVariables["/sec21"].stateValues.level).eq(2);
2846
+ expect(stateVariables["/sec211"].stateValues.level).eq(3);
2847
+ expect(stateVariables["/sec2111"].stateValues.level).eq(4);
2848
+ expect(stateVariables["/sec2112"].stateValues.level).eq(4);
2849
+ expect(stateVariables["/sec22"].stateValues.level).eq(2);
2850
+ expect(stateVariables["/sec221"].stateValues.level).eq(3);
2851
+ expect(stateVariables["/sec222"].stateValues.level).eq(3);
2852
+ expect(stateVariables["/sec223"].stateValues.level).eq(3);
2853
+ expect(stateVariables["/sec2231"].stateValues.level).eq(4);
2854
+ expect(stateVariables["/sec23"].stateValues.level).eq(2);
2855
+ });
2856
+ });
2857
+
2858
+ // TODO: reinstate this test
2859
+ // Temporarily skipping due to stopgap solution of reverting new type of section
2860
+ it.skip("Add auto name to aside", () => {
2861
+ cy.window().then(async (win) => {
2862
+ win.postMessage(
2863
+ {
2864
+ doenetML: `
2865
+ <aside name="aside1">
2866
+ <p><lorem generateSentences="1" /></p>
2867
+ </aside>
2868
+ <aside includeAutoName name="aside2">
2869
+ <title>Side point</title>
2870
+ <p><lorem generateSentences="1" /></p>
2871
+ </aside>
2872
+ <aside includeAutoName name="aside3" includeAutoNumber>
2873
+ <title>Another side point</title>
2874
+ <p><lorem generateSentences="1" /></p>
2875
+ <aside name="aside31">
2876
+ <title>Subpoint</title>
2877
+ <p><lorem generateSentences="1" /></p>
2878
+ </aside>
2879
+ <aside name="aside32">
2880
+ <p><lorem generateSentences="1" /></p>
2881
+ </aside>
2882
+ </aside>
2883
+
2884
+ <p>Title 1: <text name="title1" copySource="aside1.title" /></p>
2885
+ <p>Title 2: <text name="title2" copySource="aside2.title" /></p>
2886
+ <p>Title 3: <text name="title3" copySource="aside3.title" /></p>
2887
+ <p>Title 3.1: <text name="title31" copySource="aside31.title" /></p>
2888
+ <p>Title 3.2: <text name="title32" copySource="aside32.title" /></p>
2889
+
2890
+ `,
2891
+ },
2892
+ "*",
2893
+ );
2894
+ });
2895
+
2896
+ cy.get(cesc("#\\/aside1_title")).should("contain.text", "Aside 1");
2897
+ cy.get(cesc("#\\/aside1_title")).should("not.contain.text", ":");
2898
+ cy.get(cesc("#\\/aside2_title")).should(
2899
+ "contain.text",
2900
+ "Aside: Side point",
2901
+ );
2902
+ cy.get(cesc("#\\/aside3_title")).should(
2903
+ "contain.text",
2904
+ "Aside 3: Another side point",
2905
+ );
2906
+ cy.get(cesc("#\\/title1")).should("have.text", "Aside 1");
2907
+ cy.get(cesc("#\\/title2")).should("have.text", "Side point");
2908
+ cy.get(cesc("#\\/title3")).should("have.text", "Another side point");
2909
+
2910
+ cy.get(cesc("#\\/aside3_title")).click();
2911
+
2912
+ cy.get(cesc("#\\/aside31_title")).should("contain.text", "Subpoint");
2913
+ cy.get(cesc("#\\/aside31_title")).should("not.contain.text", "1");
2914
+ cy.get(cesc("#\\/aside31_title")).should("not.contain.text", ":");
2915
+ cy.get(cesc("#\\/aside32_title")).should("contain.text", "Aside 5 ");
2916
+ cy.get(cesc("#\\/aside32_title")).should("not.contain.text", ":");
2917
+
2918
+ cy.get(cesc("#\\/title31")).should("have.text", "Subpoint");
2919
+ cy.get(cesc("#\\/title32")).should("have.text", "Aside 5");
2920
+ });
2921
+
2922
+ it("Example, problems, exercise do not include parent number", () => {
2923
+ cy.window().then(async (win) => {
2924
+ win.postMessage(
2925
+ {
2926
+ doenetML: `
2927
+ <section name="sec1">
2928
+ <problem name="prob11">
2929
+ <p><lorem generateSentences="1" /></p>
2930
+ </problem>
2931
+ <exercise name="exer11">
2932
+ <p><lorem generateSentences="1" /></p>
2933
+ </exercise>
2934
+ <example name="exam11">
2935
+ <p><lorem generateSentences="1" /></p>
2936
+ </example>
2937
+ <problem name="prob12">
2938
+ <p><lorem generateSentences="1" /></p>
2939
+ </problem>
2940
+ <exercise name="exer12">
2941
+ <p><lorem generateSentences="1" /></p>
2942
+ </exercise>
2943
+ <example name="exam12">
2944
+ <p><lorem generateSentences="1" /></p>
2945
+ </example>
2946
+
2947
+ </section>
2948
+
2949
+
2950
+ <p>Title Section 1: <text name="titleSec1" copySource="sec1.title" /></p>
2951
+ <p>Title Problem 1.1: <text name="titleProb11" copySource="prob11.title" /></p>
2952
+ <p>Title Exercise 1.1: <text name="titleExer11" copySource="exer11.title" /></p>
2953
+ <p>Title Example 1.1: <text name="titleExam11" copySource="exam11.title" /></p>
2954
+ <p>Title Problem 1.2: <text name="titleProb12" copySource="prob12.title" /></p>
2955
+ <p>Title Exercise 1.2: <text name="titleExer12" copySource="exer12.title" /></p>
2956
+ <p>Title Example 1.2: <text name="titleExam12" copySource="exam12.title" /></p>
2957
+
2958
+
2959
+ <p>Number for Section 1: <text name="sectionNumberSec1" copySource="sec1.sectionNumber" /></p>
2960
+ <p>Number for Problem 1.1: <text name="sectionNumberProb11" copySource="prob11.sectionNumber" /></p>
2961
+ <p>Number for Exercise 1.1: <text name="sectionNumberExer11" copySource="exer11.sectionNumber" /></p>
2962
+ <p>Number for Example 1.1: <text name="sectionNumberExam11" copySource="exam11.sectionNumber" /></p>
2963
+ <p>Number for Problem 1.2: <text name="sectionNumberProb12" copySource="prob12.sectionNumber" /></p>
2964
+ <p>Number for Exercise 1.2: <text name="sectionNumberExer12" copySource="exer12.sectionNumber" /></p>
2965
+ <p>Number for Example 1.2: <text name="sectionNumberExam12" copySource="exam12.sectionNumber" /></p>
2966
+
2967
+
2968
+
2969
+ `,
2970
+ },
2971
+ "*",
2972
+ );
2973
+ });
2974
+
2975
+ cy.get(cesc("#\\/sec1_title")).should("have.text", "Section 1");
2976
+ cy.get(cesc("#\\/prob11_title")).should("have.text", "Problem 1");
2977
+ cy.get(cesc("#\\/exer11_title")).should("have.text", "Exercise 2");
2978
+ cy.get(cesc("#\\/exam11_title")).should("have.text", "Example 3");
2979
+ cy.get(cesc("#\\/prob12_title")).should("have.text", "Problem 4");
2980
+ cy.get(cesc("#\\/exer12_title")).should("have.text", "Exercise 5");
2981
+ cy.get(cesc("#\\/exam12_title")).should("have.text", "Example 6");
2982
+
2983
+ cy.get(cesc("#\\/titleProb11")).should("have.text", "Problem 1");
2984
+ cy.get(cesc("#\\/titleExer11")).should("have.text", "Exercise 2");
2985
+ cy.get(cesc("#\\/titleExam11")).should("have.text", "Example 3");
2986
+ cy.get(cesc("#\\/titleProb12")).should("have.text", "Problem 4");
2987
+ cy.get(cesc("#\\/titleExer12")).should("have.text", "Exercise 5");
2988
+ cy.get(cesc("#\\/titleExam12")).should("have.text", "Example 6");
2989
+
2990
+ cy.get(cesc("#\\/sectionNumberProb11")).should("have.text", "1");
2991
+ cy.get(cesc("#\\/sectionNumberExer11")).should("have.text", "2");
2992
+ cy.get(cesc("#\\/sectionNumberExam11")).should("have.text", "3");
2993
+ cy.get(cesc("#\\/sectionNumberProb12")).should("have.text", "4");
2994
+ cy.get(cesc("#\\/sectionNumberExer12")).should("have.text", "5");
2995
+ cy.get(cesc("#\\/sectionNumberExam12")).should("have.text", "6");
2996
+ });
2997
+
2998
+ it("Can open aside in read only mode", () => {
2999
+ cy.get("#testRunner_toggleControls").click();
3000
+ cy.get("#testRunner_readOnly").click();
3001
+ cy.wait(100);
3002
+ cy.get("#testRunner_toggleControls").click();
3003
+
3004
+ cy.window().then(async (win) => {
3005
+ win.postMessage(
3006
+ {
3007
+ doenetML: `
3008
+ <aside name="aside1">
3009
+ <title>Hello</title>
3010
+ <p>Content</p>
3011
+ </aside>
3012
+
3013
+ <p><textinput name="ti" /></p>
3014
+ `,
3015
+ },
3016
+ "*",
3017
+ );
3018
+ });
3019
+
3020
+ cy.get(cesc("#\\/aside1_title")).should("contain.text", "Hello");
3021
+ cy.get(cesc("#\\/_p1")).should("not.exist");
3022
+ cy.get(cesc("#\\/ti_input")).should("be.disabled");
3023
+
3024
+ cy.get(cesc("#\\/aside1_title")).click();
3025
+ cy.get(cesc("#\\/_p1")).should("have.text", "Content");
3026
+
3027
+ cy.get(cesc("#\\/aside1_title")).click();
3028
+ cy.get(cesc("#\\/_p1")).should("not.exist");
3029
+ });
3030
+
3031
+ it("Exercise with statement, hint, givenanswer, and solution", () => {
3032
+ cy.window().then(async (win) => {
3033
+ win.postMessage(
3034
+ {
3035
+ doenetML: `
3036
+
3037
+ <exercise name="exer">
3038
+ <title>An exercise</title>
3039
+ <statement>The exercise</statement>
3040
+ <hint>
3041
+ <p>Try harder</p>
3042
+ </hint>
3043
+ <givenAnswer>
3044
+ <p>The correct answer</p>
3045
+ </givenAnswer>
3046
+ <solution>
3047
+ <p>Here's how you do it.</p>
3048
+ </solution>
3049
+ </exercise>
3050
+
3051
+ `,
3052
+ },
3053
+ "*",
3054
+ );
3055
+ });
3056
+
3057
+ cy.get(cesc("#\\/_title1")).should("have.text", "An exercise");
3058
+
3059
+ cy.get(cesc("#\\/_statement1")).should("have.text", "The exercise");
3060
+
3061
+ cy.get(cesc("#\\/_hint1") + " [data-test=hint-heading]").should(
3062
+ "contain.text",
3063
+ "Hint",
3064
+ );
3065
+ cy.get(cesc("#\\/_hint1")).should("not.contain.text", "Try harder");
3066
+ cy.get(cesc("#\\/_givenanswer1")).should("contain.text", "Answer");
3067
+ cy.get(cesc("#\\/_givenanswer1")).should(
3068
+ "not.contain.text",
3069
+ "The correct answer",
3070
+ );
3071
+ cy.get(cesc("#\\/_solution1")).should("contain.text", "Solution");
3072
+ cy.get(cesc("#\\/_solution1")).should(
3073
+ "not.contain.text",
3074
+ "Here's how you do it.",
3075
+ );
3076
+
3077
+ cy.get(cesc("#\\/_hint1") + " [data-test=hint-heading]").click();
3078
+ cy.get(cesc("#\\/_hint1")).should("contain.text", "Try harder");
3079
+ cy.get(cesc("#\\/_givenanswer1")).should(
3080
+ "not.contain.text",
3081
+ "The correct answer",
3082
+ );
3083
+ cy.get(cesc("#\\/_solution1")).should(
3084
+ "not.contain.text",
3085
+ "Here's how you do it.",
3086
+ );
3087
+
3088
+ cy.get(cesc("#\\/_givenanswer1_button")).click();
3089
+ cy.get(cesc("#\\/_givenanswer1")).should(
3090
+ "contain.text",
3091
+ "The correct answer",
3092
+ );
3093
+ cy.get(cesc("#\\/_hint1")).should("contain.text", "Try harder");
3094
+ cy.get(cesc("#\\/_solution1")).should(
3095
+ "not.contain.text",
3096
+ "Here's how you do it.",
3097
+ );
3098
+
3099
+ cy.get(cesc("#\\/_solution1_button")).click();
3100
+ cy.get(cesc("#\\/_solution1")).should(
3101
+ "contain.text",
3102
+ "Here's how you do it.",
3103
+ );
3104
+ cy.get(cesc("#\\/_hint1")).should("contain.text", "Try harder");
3105
+ cy.get(cesc("#\\/_givenanswer1")).should(
3106
+ "contain.text",
3107
+ "The correct answer",
3108
+ );
3109
+ });
3110
+
3111
+ it("Section with introduction, subsections and conclusion", () => {
3112
+ cy.window().then(async (win) => {
3113
+ win.postMessage(
3114
+ {
3115
+ doenetML: `
3116
+
3117
+ <section>
3118
+ <title>A section</title>
3119
+ <introduction>
3120
+ <p>First this</p>
3121
+ <p>Then that</p>
3122
+ <text>Hello</text> <text>World</text>
3123
+ </introduction>
3124
+ <subsection>
3125
+ <title>Point 1</title>
3126
+ <p>Make the first point</p>
3127
+ </subsection>
3128
+ <subsection>
3129
+ <title>Point 2</title>
3130
+ <p>Make the second point</p>
3131
+ </subsection>
3132
+ <conclusion>
3133
+ Wrap <text>it</text> <text>up</text>!
3134
+ </conclusion>
3135
+ </section>
3136
+
3137
+ `,
3138
+ },
3139
+ "*",
3140
+ );
3141
+ });
3142
+
3143
+ cy.get(cesc("#\\/_title1")).should("have.text", "A section");
3144
+
3145
+ cy.get(cesc("#\\/_introduction1")).should(
3146
+ "have.text",
3147
+ "\n First this\n Then that\n Hello World\n ",
3148
+ );
3149
+
3150
+ cy.get(cesc("#\\/_subsection1")).should(
3151
+ "have.text",
3152
+ " Point 1\n \n Make the first point\n ",
3153
+ );
3154
+ cy.get(cesc("#\\/_subsection2")).should(
3155
+ "have.text",
3156
+ " Point 2\n \n Make the second point\n ",
3157
+ );
3158
+
3159
+ cy.get(cesc("#\\/_conclusion1")).should(
3160
+ "have.text",
3161
+ "\n Wrap it up!\n ",
3162
+ );
3163
+ });
3164
+
3165
+ it("Objectives", () => {
3166
+ cy.window().then(async (win) => {
3167
+ win.postMessage(
3168
+ {
3169
+ doenetML: `
3170
+
3171
+ <section>
3172
+ <title>A section</title>
3173
+ <objectives>
3174
+ <text>Hello</text> <text>World</text>
3175
+ </objectives>
3176
+ <p>Is objectives boxed? $_objectives1.boxed</p>
3177
+ </section>
3178
+
3179
+ `,
3180
+ },
3181
+ "*",
3182
+ );
3183
+ });
3184
+
3185
+ cy.get(cesc("#\\/_title1")).should("have.text", "A section");
3186
+
3187
+ cy.get(cesc("#\\/_objectives1_title")).should("have.text", "Objectives 1");
3188
+ cy.get(cesc("#\\/_objectives1")).should("contain.text", "Hello World");
3189
+
3190
+ cy.get(cesc("#\\/_p1")).should("have.text", "Is objectives boxed? true");
3191
+ });
3192
+
3193
+ it("Activity", () => {
3194
+ cy.window().then(async (win) => {
3195
+ win.postMessage(
3196
+ {
3197
+ doenetML: `
3198
+
3199
+ <section>
3200
+ <title>A section</title>
3201
+ <activity>
3202
+ <text>Hello</text> <text>World</text>
3203
+ </activity>
3204
+ <p>Is activity boxed? $_activity1.boxed</p>
3205
+ </section>
3206
+
3207
+ `,
3208
+ },
3209
+ "*",
3210
+ );
3211
+ });
3212
+
3213
+ cy.get(cesc("#\\/_title1")).should("have.text", "A section");
3214
+
3215
+ cy.get(cesc("#\\/_activity1_title")).should("have.text", "Activity 1");
3216
+ cy.get(cesc("#\\/_activity1")).should("contain.text", "Hello World");
3217
+
3218
+ cy.get(cesc("#\\/_p1")).should("have.text", "Is activity boxed? false");
3219
+ });
3220
+
3221
+ it("Definition", () => {
3222
+ cy.window().then(async (win) => {
3223
+ win.postMessage(
3224
+ {
3225
+ doenetML: `
3226
+
3227
+ <section>
3228
+ <title>A section</title>
3229
+ <definition>
3230
+ <text>Hello</text> <text>World</text>
3231
+ </definition>
3232
+ <p>Is definition boxed? $_definition1.boxed</p>
3233
+ </section>
3234
+
3235
+ `,
3236
+ },
3237
+ "*",
3238
+ );
3239
+ });
3240
+
3241
+ cy.get(cesc("#\\/_title1")).should("have.text", "A section");
3242
+
3243
+ cy.get(cesc("#\\/_definition1_title")).should("have.text", "Definition 1");
3244
+ cy.get(cesc("#\\/_definition1")).should("contain.text", "Hello World");
3245
+
3246
+ cy.get(cesc("#\\/_p1")).should("have.text", "Is definition boxed? false");
3247
+ });
3248
+
3249
+ it("Note", () => {
3250
+ cy.window().then(async (win) => {
3251
+ win.postMessage(
3252
+ {
3253
+ doenetML: `
3254
+
3255
+ <section>
3256
+ <title>A section</title>
3257
+ <note>
3258
+ <text>Hello</text> <text>World</text>
3259
+ </note>
3260
+ <p>Is note boxed? $_note1.boxed</p>
3261
+ </section>
3262
+
3263
+ `,
3264
+ },
3265
+ "*",
3266
+ );
3267
+ });
3268
+
3269
+ cy.get(cesc("#\\/_title1")).should("have.text", "A section");
3270
+
3271
+ cy.get(cesc("#\\/_note1_title")).should("have.text", "Note 1");
3272
+ cy.get(cesc("#\\/_note1")).should("contain.text", "Hello World");
3273
+
3274
+ cy.get(cesc("#\\/_p1")).should("have.text", "Is note boxed? false");
3275
+ });
3276
+
3277
+ // TODO: reinstate this test
3278
+ // Temporarily skipping due to stopgap solution of reverting new type of section
3279
+ it.skip("Theorem elements", () => {
3280
+ cy.window().then(async (win) => {
3281
+ win.postMessage(
3282
+ {
3283
+ doenetML: `
3284
+
3285
+ <section>
3286
+ <title>A section</title>
3287
+ <theorem>
3288
+ <statement>The statement</statement>
3289
+ <proof>The proof</proof>
3290
+ </theorem>
3291
+ <theorem renameTo="Corollary">
3292
+ <statement>The statement</statement>
3293
+ <proof>The proof</proof>
3294
+ </theorem>
3295
+ </section>
3296
+
3297
+ `,
3298
+ },
3299
+ "*",
3300
+ );
3301
+ });
3302
+
3303
+ cy.get(cesc("#\\/_title1")).should("have.text", "A section");
3304
+
3305
+ cy.get(cesc("#\\/_theorem1_title")).should("have.text", "Theorem 1");
3306
+ cy.get(cesc("#\\/_statement1")).should("have.text", "The statement");
3307
+ cy.get(cesc("#\\/_proof1_title")).should("contain.text", "Proof");
3308
+ cy.get(cesc("#\\/_proof1_title")).should("contain.text", "Proof");
3309
+ cy.get(cesc("#\\/_proof1")).should("not.contain.text", "The proof");
3310
+ cy.get(cesc("#\\/_proof1_title")).click();
3311
+ cy.get(cesc("#\\/_proof1")).should("contain.text", "The proof");
3312
+
3313
+ cy.get(cesc("#\\/_theorem2_title")).should("have.text", "Corollary 2");
3314
+ cy.get(cesc("#\\/_statement2")).should("have.text", "The statement");
3315
+ cy.get(cesc("#\\/_proof2_title")).should("contain.text", "Proof");
3316
+ cy.get(cesc("#\\/_proof2")).should("not.contain.text", "The proof");
3317
+ cy.get(cesc("#\\/_proof2_title")).click();
3318
+ cy.get(cesc("#\\/_proof2")).should("contain.text", "The proof");
3319
+ });
3320
+
3321
+ // TODO: reinstate this test
3322
+ // Temporarily skipping due to stopgap solution of reverting new type of section
3323
+ it.skip("Sections number independently of other sectioning elements", () => {
3324
+ cy.window().then(async (win) => {
3325
+ win.postMessage(
3326
+ {
3327
+ doenetML: `
3328
+
3329
+ <section name="sec1">
3330
+ <objectives name="obj1">
3331
+ <ul>
3332
+ <li>First</li>
3333
+ <li>Second</li>
3334
+ </ul>
3335
+ </objectives>
3336
+ <definition name="exp2">
3337
+ An definition
3338
+ </definition>
3339
+ <subsection name="sec1-1">
3340
+ <activity name="act3">
3341
+ Activity inside a subsection.
3342
+ </activity>
3343
+ </subsection>
3344
+ <section name="sec1-2">
3345
+ <aside name="aside4">
3346
+ An aside
3347
+ </aside>
3348
+ </section>
3349
+ <activity name="act5">
3350
+ Final activity
3351
+ </activity>
3352
+ <objectives renameTo="Outcomes" name="out6">
3353
+ <ul>
3354
+ <li>First</li>
3355
+ <li>Second</li>
3356
+ </ul>
3357
+ </objectives>
3358
+ </section>
3359
+ <section name="sec2">
3360
+ <objectives name="obj7">
3361
+ <ul>
3362
+ <li>First 2</li>
3363
+ <li>Second 2</li>
3364
+ </ul>
3365
+ </objectives>
3366
+ <section name="sec2-1">
3367
+ <definition name="exp8">
3368
+ Another definition
3369
+ </definition>
3370
+ </section>
3371
+ </section>
3372
+
3373
+ `,
3374
+ },
3375
+ "*",
3376
+ );
3377
+ });
3378
+
3379
+ // Note: not sure if this is how we want numbering to work long term,
3380
+ // but this test at least documents how it is working now.
3381
+
3382
+ cy.get(cesc("#\\/sec1_title")).should("have.text", "Section 1");
3383
+
3384
+ cy.get(cesc("#\\/obj1_title")).should("have.text", "Objectives 1");
3385
+ cy.get(cesc("#\\/exp2_title")).should("have.text", "Definition 2");
3386
+ cy.get(cesc("#\\/sec1-1_title")).should("have.text", "Section 1.1");
3387
+ cy.get(cesc("#\\/act3_title")).should("have.text", "Activity 3");
3388
+ cy.get(cesc("#\\/sec1-2_title")).should("have.text", "Section 1.2");
3389
+ cy.get(cesc("#\\/aside4_title")).should("contain.text", "Aside 4");
3390
+ cy.get(cesc("#\\/act5_title")).should("have.text", "Activity 5");
3391
+ cy.get(cesc("#\\/out6_title")).should("have.text", "Outcomes 6");
3392
+
3393
+ cy.get(cesc("#\\/sec2_title")).should("have.text", "Section 2");
3394
+
3395
+ cy.get(cesc("#\\/obj7_title")).should("have.text", "Objectives 7");
3396
+ cy.get(cesc("#\\/sec2-1_title")).should("have.text", "Section 2.1");
3397
+ });
3398
+
3399
+ it("Problems tag causes child sections to be rendered as a list", () => {
3400
+ cy.window().then(async (win) => {
3401
+ win.postMessage(
3402
+ {
3403
+ doenetML: `
3404
+ <problem name="aProb" newNamespace>
3405
+ <title>This is a problem</title>
3406
+ <p>Here is a problem!</p>
3407
+
3408
+ <ol>
3409
+ <li>Item 1</li>
3410
+ <li>Item 2</li>
3411
+ </ol>
3412
+ </problem>
3413
+
3414
+ <exercises name="exercises">
3415
+ <problem name="prob1" newNamespace>
3416
+ <p>We don't have a title, but we have a list.</p>
3417
+
3418
+ <ol>
3419
+ <li>Item A</li>
3420
+ <li>Item B</li>
3421
+ </ol>
3422
+ </problem>
3423
+ <problem name="prob2" newNamespace>
3424
+ <title>A titled problem</title>
3425
+ <p>Work hard</p>
3426
+ </problem>
3427
+
3428
+ $aProb{assignNames='aProbb'}
3429
+ </exercises>
3430
+
3431
+ `,
3432
+ },
3433
+ "*",
3434
+ );
3435
+ });
3436
+
3437
+ cy.get(cesc("#\\/aProb_title")).should("have.text", "This is a problem");
3438
+ cy.get(cesc("#\\/aProb\\/_ol1")).should(
3439
+ "have.css",
3440
+ "list-style-type",
3441
+ "decimal",
3442
+ );
3443
+
3444
+ cy.get(cesc("#\\/exercises") + " li")
3445
+ .eq(0)
3446
+ .should("contain.text", "We don't have a title, but we have a list.");
3447
+
3448
+ cy.get(cesc("#\\/prob1_title")).should("have.text", "");
3449
+ cy.get(cesc("#\\/prob1\\/_ol1")).should(
3450
+ "have.css",
3451
+ "list-style-type",
3452
+ "lower-alpha",
3453
+ );
3454
+
3455
+ cy.get(cesc("#\\/prob2_title")).should("have.text", "A titled problem");
3456
+
3457
+ cy.get(cesc("#\\/aProbb_title")).should("have.text", "This is a problem");
3458
+ cy.get(cesc("#\\/aProbb\\/_ol1")).should(
3459
+ "have.css",
3460
+ "list-style-type",
3461
+ "lower-alpha",
3462
+ );
3463
+ });
3464
+
3465
+ it("As list attribute causes child sections to be rendered as a list", () => {
3466
+ cy.window().then(async (win) => {
3467
+ win.postMessage(
3468
+ {
3469
+ doenetML: `
3470
+ <problem name="aProb" newNamespace>
3471
+ <title>This is a problem</title>
3472
+ <p>Here is a problem!</p>
3473
+
3474
+ <ol>
3475
+ <li>Item 1</li>
3476
+ <li>Item 2</li>
3477
+ </ol>
3478
+ </problem>
3479
+
3480
+ <section name="exercises" asList>
3481
+ <problem name="prob1" newNamespace>
3482
+ <p>We don't have a title, but we have a list.</p>
3483
+
3484
+ <ol>
3485
+ <li>Item A</li>
3486
+ <li>Item B</li>
3487
+ </ol>
3488
+ </problem>
3489
+ <problem name="prob2" newNamespace>
3490
+ <title>A titled problem</title>
3491
+ <p>Work hard</p>
3492
+ </problem>
3493
+
3494
+ $aProb{assignNames='aProbb'}
3495
+ </section>
3496
+
3497
+ `,
3498
+ },
3499
+ "*",
3500
+ );
3501
+ });
3502
+
3503
+ cy.get(cesc("#\\/aProb_title")).should("have.text", "This is a problem");
3504
+ cy.get(cesc("#\\/aProb\\/_ol1")).should(
3505
+ "have.css",
3506
+ "list-style-type",
3507
+ "decimal",
3508
+ );
3509
+
3510
+ cy.get(cesc("#\\/exercises") + " li")
3511
+ .eq(0)
3512
+ .should("contain.text", "We don't have a title, but we have a list.");
3513
+
3514
+ cy.get(cesc("#\\/prob1_title")).should("have.text", "");
3515
+ cy.get(cesc("#\\/prob1\\/_ol1")).should(
3516
+ "have.css",
3517
+ "list-style-type",
3518
+ "lower-alpha",
3519
+ );
3520
+
3521
+ cy.get(cesc("#\\/prob2_title")).should("have.text", "A titled problem");
3522
+
3523
+ cy.get(cesc("#\\/aProbb_title")).should("have.text", "This is a problem");
3524
+ cy.get(cesc("#\\/aProbb\\/_ol1")).should(
3525
+ "have.css",
3526
+ "list-style-type",
3527
+ "lower-alpha",
3528
+ );
3529
+ });
3530
+ });