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