@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.
- package/.prettierrc +3 -0
- package/LICENSE +661 -0
- package/README.md +146 -0
- package/cypress/e2e/ActivityViewer/activityVariants.cy.js +1770 -0
- package/cypress/e2e/ActivityViewer/compiledActivity.cy.js +83 -0
- package/cypress/e2e/ActivityViewer/relationshipsAmongPages.cy.js +697 -0
- package/cypress/e2e/answerValidation/errorinnumbers.cy.js +2125 -0
- package/cypress/e2e/answerValidation/factoring.cy.js +1945 -0
- package/cypress/e2e/answerValidation/factoringOldAlgorithm.cy.js +892 -0
- package/cypress/e2e/answerValidation/functionanswers.cy.js +314 -0
- package/cypress/e2e/answerValidation/matchingpatterns.cy.js +287 -0
- package/cypress/e2e/answerValidation/matchpartial.cy.js +6711 -0
- package/cypress/e2e/answerValidation/pointlocation.cy.js +3989 -0
- package/cypress/e2e/answerValidation/symbolicequality.cy.js +1893 -0
- package/cypress/e2e/answerValidation/videoProgress.cy.js +210 -0
- package/cypress/e2e/assignNames/basiccopy.cy.js +2376 -0
- package/cypress/e2e/assignNames/collections.cy.js +9247 -0
- package/cypress/e2e/assignNames/selects.cy.js +105 -0
- package/cypress/e2e/assignNames/sequences.cy.js +1964 -0
- package/cypress/e2e/baseComponent/basecomponentproperties.cy.js +999 -0
- package/cypress/e2e/baseComponent/doenetMLtext.cy.js +427 -0
- package/cypress/e2e/chemistry/atom.cy.js +201 -0
- package/cypress/e2e/chemistry/ion.cy.js +608 -0
- package/cypress/e2e/chemistry/ioniccompound.cy.js +133 -0
- package/cypress/e2e/dynamicalsystem/cobwebpolyline.cy.js +2653 -0
- package/cypress/e2e/dynamicalsystem/equilibriumcurve.cy.js +311 -0
- package/cypress/e2e/dynamicalsystem/equilibriumline.cy.js +279 -0
- package/cypress/e2e/dynamicalsystem/equilibriumpoint.cy.js +283 -0
- package/cypress/e2e/dynamicalsystem/odesystem.cy.js +1834 -0
- package/cypress/e2e/equality/mathexpressions.cy.js +948 -0
- package/cypress/e2e/graphing/graphreferences.cy.js +978 -0
- package/cypress/e2e/graphing/graphreferences2.cy.js +615 -0
- package/cypress/e2e/linearAlgebra/eigenDecomposition.cy.js +401 -0
- package/cypress/e2e/tagSpecific/angle.cy.js +3898 -0
- package/cypress/e2e/tagSpecific/animatefromsequence.cy.js +2306 -0
- package/cypress/e2e/tagSpecific/answer.cy.js +31647 -0
- package/cypress/e2e/tagSpecific/bestfitline.cy.js +612 -0
- package/cypress/e2e/tagSpecific/blockquote.cy.js +30 -0
- package/cypress/e2e/tagSpecific/boolean.cy.js +742 -0
- package/cypress/e2e/tagSpecific/booleaninput.cy.js +1283 -0
- package/cypress/e2e/tagSpecific/booleanlist.cy.js +588 -0
- package/cypress/e2e/tagSpecific/booleanoperators.cy.js +596 -0
- package/cypress/e2e/tagSpecific/booleanoperatorsonmath.cy.js +498 -0
- package/cypress/e2e/tagSpecific/callaction.cy.js +2835 -0
- package/cypress/e2e/tagSpecific/choiceinput.cy.js +3205 -0
- package/cypress/e2e/tagSpecific/circle.cy.js +22036 -0
- package/cypress/e2e/tagSpecific/codeeditor.cy.js +1995 -0
- package/cypress/e2e/tagSpecific/collect.cy.js +5035 -0
- package/cypress/e2e/tagSpecific/componentsize.cy.js +502 -0
- package/cypress/e2e/tagSpecific/conditionalcontent.cy.js +3495 -0
- package/cypress/e2e/tagSpecific/contentBrowser.cy.js +335 -0
- package/cypress/e2e/tagSpecific/contentpicker.cy.js +261 -0
- package/cypress/e2e/tagSpecific/copy.cy.js +12627 -0
- package/cypress/e2e/tagSpecific/copy2.cy.js +5698 -0
- package/cypress/e2e/tagSpecific/curve.bezier.cy.js +12440 -0
- package/cypress/e2e/tagSpecific/curve.cy.js +1716 -0
- package/cypress/e2e/tagSpecific/curve.function.cy.js +1471 -0
- package/cypress/e2e/tagSpecific/curve.parametrized.cy.js +920 -0
- package/cypress/e2e/tagSpecific/document.cy.js +234 -0
- package/cypress/e2e/tagSpecific/endpoint.cy.js +197 -0
- package/cypress/e2e/tagSpecific/evaluate.cy.js +8895 -0
- package/cypress/e2e/tagSpecific/extract.cy.js +2282 -0
- package/cypress/e2e/tagSpecific/feedback.cy.js +2941 -0
- package/cypress/e2e/tagSpecific/function.cy.js +9450 -0
- package/cypress/e2e/tagSpecific/functioniterates.cy.js +1178 -0
- package/cypress/e2e/tagSpecific/functionoperators.cy.js +4047 -0
- package/cypress/e2e/tagSpecific/graph.cy.js +2491 -0
- package/cypress/e2e/tagSpecific/group.cy.js +683 -0
- package/cypress/e2e/tagSpecific/hint.cy.js +204 -0
- package/cypress/e2e/tagSpecific/image.cy.js +770 -0
- package/cypress/e2e/tagSpecific/integer.cy.js +206 -0
- package/cypress/e2e/tagSpecific/label.cy.js +800 -0
- package/cypress/e2e/tagSpecific/legend.cy.js +1001 -0
- package/cypress/e2e/tagSpecific/line.cy.js +12167 -0
- package/cypress/e2e/tagSpecific/linesegment.cy.js +4749 -0
- package/cypress/e2e/tagSpecific/lorem.cy.js +289 -0
- package/cypress/e2e/tagSpecific/map.cy.js +4476 -0
- package/cypress/e2e/tagSpecific/matchespattern.cy.js +693 -0
- package/cypress/e2e/tagSpecific/math.cy.js +10990 -0
- package/cypress/e2e/tagSpecific/mathdisplay.cy.js +2689 -0
- package/cypress/e2e/tagSpecific/mathinput.cy.js +15628 -0
- package/cypress/e2e/tagSpecific/mathinputgraph.cy.js +566 -0
- package/cypress/e2e/tagSpecific/mathlist.cy.js +4073 -0
- package/cypress/e2e/tagSpecific/mathoperators.cy.js +13851 -0
- package/cypress/e2e/tagSpecific/matrix.cy.js +8825 -0
- package/cypress/e2e/tagSpecific/matrixinput.cy.js +16277 -0
- package/cypress/e2e/tagSpecific/module.cy.js +1771 -0
- package/cypress/e2e/tagSpecific/number.cy.js +2221 -0
- package/cypress/e2e/tagSpecific/numberlist.cy.js +1285 -0
- package/cypress/e2e/tagSpecific/p.cy.js +72 -0
- package/cypress/e2e/tagSpecific/paginator.cy.js +2983 -0
- package/cypress/e2e/tagSpecific/parabola.cy.js +14331 -0
- package/cypress/e2e/tagSpecific/paragraphmarkup.cy.js +104 -0
- package/cypress/e2e/tagSpecific/periodicset.cy.js +1439 -0
- package/cypress/e2e/tagSpecific/piecewisefunction.cy.js +1055 -0
- package/cypress/e2e/tagSpecific/pluralize.cy.js +274 -0
- package/cypress/e2e/tagSpecific/point.cy.js +8895 -0
- package/cypress/e2e/tagSpecific/point2.cy.js +10259 -0
- package/cypress/e2e/tagSpecific/polygon.cy.js +5039 -0
- package/cypress/e2e/tagSpecific/polyline.cy.js +4704 -0
- package/cypress/e2e/tagSpecific/problem.cy.js +2768 -0
- package/cypress/e2e/tagSpecific/ray.cy.js +10770 -0
- package/cypress/e2e/tagSpecific/rectangle.cy.js +2143 -0
- package/cypress/e2e/tagSpecific/ref.cy.js +420 -0
- package/cypress/e2e/tagSpecific/regularPolygon.cy.js +1006 -0
- package/cypress/e2e/tagSpecific/regularPolygon2.cy.js +100 -0
- package/cypress/e2e/tagSpecific/regularPolygon3.cy.js +777 -0
- package/cypress/e2e/tagSpecific/samplerandomnumbers.cy.js +3619 -0
- package/cypress/e2e/tagSpecific/sectioning.cy.js +3530 -0
- package/cypress/e2e/tagSpecific/select.cy.js +5376 -0
- package/cypress/e2e/tagSpecific/selectfromsequence.cy.js +3846 -0
- package/cypress/e2e/tagSpecific/selectrandomnumbers.cy.js +2914 -0
- package/cypress/e2e/tagSpecific/sequence.cy.js +2093 -0
- package/cypress/e2e/tagSpecific/shuffle.cy.js +490 -0
- package/cypress/e2e/tagSpecific/sidebyside.cy.js +8057 -0
- package/cypress/e2e/tagSpecific/singlecharactercomponents.cy.js +72 -0
- package/cypress/e2e/tagSpecific/slider.cy.js +914 -0
- package/cypress/e2e/tagSpecific/solution.cy.js +109 -0
- package/cypress/e2e/tagSpecific/solveequations.cy.js +1026 -0
- package/cypress/e2e/tagSpecific/sort.cy.js +1685 -0
- package/cypress/e2e/tagSpecific/spreadsheet.cy.js +5971 -0
- package/cypress/e2e/tagSpecific/subsetofreals.cy.js +2725 -0
- package/cypress/e2e/tagSpecific/substitute.cy.js +2646 -0
- package/cypress/e2e/tagSpecific/tabular.cy.js +36 -0
- package/cypress/e2e/tagSpecific/text.cy.js +975 -0
- package/cypress/e2e/tagSpecific/textinput.cy.js +2177 -0
- package/cypress/e2e/tagSpecific/textlist.cy.js +369 -0
- package/cypress/e2e/tagSpecific/triangle.cy.js +1936 -0
- package/cypress/e2e/tagSpecific/triggerset.cy.js +2023 -0
- package/cypress/e2e/tagSpecific/updatevalue.cy.js +3288 -0
- package/cypress/e2e/tagSpecific/vector.cy.js +20183 -0
- package/cypress/e2e/tagSpecific/video.cy.js +612 -0
- package/cypress/e2e/tagSpecific/when.cy.js +202 -0
- package/cypress/e2e/variants/specifysinglevariant.cy.js +6726 -0
- package/cypress/e2e/variants/uniquevariants.cy.js +4846 -0
- package/cypress/fixtures/example.json +5 -0
- package/cypress/support/commands.js +32 -0
- package/cypress/support/e2e.js +31 -0
- package/cypress.config.js +18 -0
- package/docs/codeSnippet.jsx +11 -0
- package/docs/index.html +133 -0
- package/docs/index.jsx +138 -0
- package/docs/prism.css +3 -0
- package/index.html +14 -0
- package/index.js +21 -0
- package/media/answer_example.png +0 -0
- package/media/graph_example.png +0 -0
- package/media/graph_markup_example.png +0 -0
- package/package.json +83 -0
- package/public/favicon.ico +0 -0
- package/public/fonts/files/open-sans-v18-latin-700.woff +0 -0
- package/public/fonts/files/open-sans-v18-latin-700.woff2 +0 -0
- package/public/fonts/files/open-sans-v18-latin-700italic.woff +0 -0
- package/public/fonts/files/open-sans-v18-latin-700italic.woff2 +0 -0
- package/public/fonts/files/open-sans-v18-latin-italic.woff +0 -0
- package/public/fonts/files/open-sans-v18-latin-italic.woff2 +0 -0
- package/public/fonts/files/open-sans-v18-latin-light-italic.woff +0 -0
- package/public/fonts/files/open-sans-v18-latin-light-italic.woff2 +0 -0
- package/public/fonts/files/open-sans-v18-latin-light.woff +0 -0
- package/public/fonts/files/open-sans-v18-latin-light.woff2 +0 -0
- package/public/fonts/files/open-sans-v18-latin-regular.woff +0 -0
- package/public/fonts/files/open-sans-v18-latin-regular.woff2 +0 -0
- package/src/Core/ComponentTypes.js +426 -0
- package/src/Core/Core.js +11852 -0
- package/src/Core/CoreWorker.js +127 -0
- package/src/Core/Dependencies.js +8226 -0
- package/src/Core/Numerics.js +473 -0
- package/src/Core/ParameterStack.js +36 -0
- package/src/Core/ReadOnlyProxyHandler.js +41 -0
- package/src/Core/StateProxyHandler.js +88 -0
- package/src/Core/components/Aliases.js +67 -0
- package/src/Core/components/Angle.js +758 -0
- package/src/Core/components/AnimateFromSequence.js +922 -0
- package/src/Core/components/Answer.js +2087 -0
- package/src/Core/components/AsList.js +83 -0
- package/src/Core/components/AttractTo.js +245 -0
- package/src/Core/components/AttractToAngles.js +262 -0
- package/src/Core/components/AttractToConstraint.js +104 -0
- package/src/Core/components/AttractToGrid.js +315 -0
- package/src/Core/components/Award.js +906 -0
- package/src/Core/components/BestFitLine.js +318 -0
- package/src/Core/components/BezierControls.js +719 -0
- package/src/Core/components/BlockQuote.js +35 -0
- package/src/Core/components/Boolean.js +500 -0
- package/src/Core/components/BooleanInput.js +330 -0
- package/src/Core/components/BooleanList.js +396 -0
- package/src/Core/components/BooleanOperators.js +35 -0
- package/src/Core/components/BooleanOperatorsOfMath.js +148 -0
- package/src/Core/components/CallAction.js +261 -0
- package/src/Core/components/Caption.js +73 -0
- package/src/Core/components/Case.js +56 -0
- package/src/Core/components/Cell.js +439 -0
- package/src/Core/components/CellBlock.js +64 -0
- package/src/Core/components/Chart.js +795 -0
- package/src/Core/components/Choice.js +266 -0
- package/src/Core/components/ChoiceInput.js +1407 -0
- package/src/Core/components/Circle.js +2884 -0
- package/src/Core/components/CodeEditor.js +647 -0
- package/src/Core/components/CodeViewer.js +294 -0
- package/src/Core/components/CollaborateGroupSetup.js +46 -0
- package/src/Core/components/CollaborateGroups.js +119 -0
- package/src/Core/components/Collect.js +850 -0
- package/src/Core/components/Column.js +608 -0
- package/src/Core/components/ConditionalContent.js +468 -0
- package/src/Core/components/ConsiderAsResponses.js +49 -0
- package/src/Core/components/ConstrainTo.js +161 -0
- package/src/Core/components/ConstrainToAngles.js +244 -0
- package/src/Core/components/ConstrainToGraph.js +142 -0
- package/src/Core/components/ConstrainToGrid.js +175 -0
- package/src/Core/components/ConstraintUnion.js +119 -0
- package/src/Core/components/Constraints.js +497 -0
- package/src/Core/components/ContentBrowser.js +441 -0
- package/src/Core/components/ContentPicker.js +263 -0
- package/src/Core/components/ControlVectors.js +25 -0
- package/src/Core/components/Coords.js +63 -0
- package/src/Core/components/Copy.js +3412 -0
- package/src/Core/components/Curve.js +4130 -0
- package/src/Core/components/CustomAttribute.js +175 -0
- package/src/Core/components/DataFrame.js +357 -0
- package/src/Core/components/DiscreteSimulationResultList.js +342 -0
- package/src/Core/components/DiscreteSimulationResultPolyline.js +581 -0
- package/src/Core/components/Divisions.js +55 -0
- package/src/Core/components/Document.js +888 -0
- package/src/Core/components/Embed.js +65 -0
- package/src/Core/components/Endpoint.js +62 -0
- package/src/Core/components/Evaluate.js +321 -0
- package/src/Core/components/Extract.js +656 -0
- package/src/Core/components/Extrema.js +556 -0
- package/src/Core/components/Feedback.js +200 -0
- package/src/Core/components/FeedbackDefinitions.js +97 -0
- package/src/Core/components/Figure.js +148 -0
- package/src/Core/components/Footnote.js +73 -0
- package/src/Core/components/Function.js +5344 -0
- package/src/Core/components/FunctionIterates.js +306 -0
- package/src/Core/components/FunctionOperators.js +702 -0
- package/src/Core/components/Graph.js +1679 -0
- package/src/Core/components/Group.js +7 -0
- package/src/Core/components/HasSameFactoring.js +407 -0
- package/src/Core/components/Hint.js +241 -0
- package/src/Core/components/Image.js +524 -0
- package/src/Core/components/Indexing.js +79 -0
- package/src/Core/components/IntComma.js +64 -0
- package/src/Core/components/Integer.js +81 -0
- package/src/Core/components/Intersection.js +328 -0
- package/src/Core/components/Interval.js +29 -0
- package/src/Core/components/Label.js +492 -0
- package/src/Core/components/Latex.js +104 -0
- package/src/Core/components/Legend.js +329 -0
- package/src/Core/components/Line.js +2040 -0
- package/src/Core/components/LineSegment.js +882 -0
- package/src/Core/components/Lists.js +180 -0
- package/src/Core/components/Lorem.js +249 -0
- package/src/Core/components/MMeMen.js +377 -0
- package/src/Core/components/Map.js +873 -0
- package/src/Core/components/Markers.js +101 -0
- package/src/Core/components/MatchesPattern.js +339 -0
- package/src/Core/components/Math.js +2552 -0
- package/src/Core/components/MathInput.js +948 -0
- package/src/Core/components/MathList.js +828 -0
- package/src/Core/components/MathOperators.js +1286 -0
- package/src/Core/components/Matrix.js +497 -0
- package/src/Core/components/MatrixInput.js +3157 -0
- package/src/Core/components/MdMdnMrow.js +394 -0
- package/src/Core/components/Module.js +16 -0
- package/src/Core/components/Number.js +1031 -0
- package/src/Core/components/NumberList.js +550 -0
- package/src/Core/components/Option.js +24 -0
- package/src/Core/components/P.js +71 -0
- package/src/Core/components/Paginator.js +338 -0
- package/src/Core/components/Panel.js +126 -0
- package/src/Core/components/Parabola.js +1561 -0
- package/src/Core/components/ParagraphMarkup.js +59 -0
- package/src/Core/components/Pegboard.js +43 -0
- package/src/Core/components/PeriodicSet.js +291 -0
- package/src/Core/components/PiecewiseFunction.js +832 -0
- package/src/Core/components/Pluralize.js +198 -0
- package/src/Core/components/Point.js +1295 -0
- package/src/Core/components/Polygon.js +408 -0
- package/src/Core/components/Polyline.js +841 -0
- package/src/Core/components/RandomizedTextList.js +225 -0
- package/src/Core/components/Ray.js +1737 -0
- package/src/Core/components/Rectangle.js +1535 -0
- package/src/Core/components/Ref.js +350 -0
- package/src/Core/components/RegionBetweenCurveXAxis.js +124 -0
- package/src/Core/components/RegionHalfPlane.js +107 -0
- package/src/Core/components/RegularPolygon.js +2118 -0
- package/src/Core/components/RenderDoenetML.js +181 -0
- package/src/Core/components/Row.js +780 -0
- package/src/Core/components/SampleRandomNumbers.js +653 -0
- package/src/Core/components/Sectioning.js +303 -0
- package/src/Core/components/Select.js +947 -0
- package/src/Core/components/SelectFromSequence.js +1242 -0
- package/src/Core/components/SelectRandomNumbers.js +225 -0
- package/src/Core/components/Sequence.js +444 -0
- package/src/Core/components/Setup.js +53 -0
- package/src/Core/components/Shuffle.js +470 -0
- package/src/Core/components/SideBySide.js +2130 -0
- package/src/Core/components/SingleCharacterComponents.js +41 -0
- package/src/Core/components/Slider.js +819 -0
- package/src/Core/components/SolutionContainer.js +67 -0
- package/src/Core/components/Solutions.js +334 -0
- package/src/Core/components/SolveEquations.js +568 -0
- package/src/Core/components/Sort.js +398 -0
- package/src/Core/components/Sources.js +108 -0
- package/src/Core/components/Split.js +205 -0
- package/src/Core/components/Spreadsheet.js +1507 -0
- package/src/Core/components/StyleDefinitions.js +111 -0
- package/src/Core/components/SubsetOfReals.js +348 -0
- package/src/Core/components/SubsetOfRealsInput.js +1474 -0
- package/src/Core/components/Substitute.js +496 -0
- package/src/Core/components/SummaryStatistics.js +652 -0
- package/src/Core/components/Table.js +145 -0
- package/src/Core/components/Tabular.js +384 -0
- package/src/Core/components/Template.js +360 -0
- package/src/Core/components/Text.js +341 -0
- package/src/Core/components/TextInput.js +566 -0
- package/src/Core/components/TextList.js +442 -0
- package/src/Core/components/TextListFromString.js +137 -0
- package/src/Core/components/TextOperatorsOfMath.js +21 -0
- package/src/Core/components/Triangle.js +280 -0
- package/src/Core/components/TriggerSet.js +189 -0
- package/src/Core/components/TupleList.js +43 -0
- package/src/Core/components/UpdateValue.js +435 -0
- package/src/Core/components/VariantControl.js +36 -0
- package/src/Core/components/Vector.js +2478 -0
- package/src/Core/components/Verbatim.js +125 -0
- package/src/Core/components/Video.js +673 -0
- package/src/Core/components/When.js +198 -0
- package/src/Core/components/abstract/AngleListComponent.js +140 -0
- package/src/Core/components/abstract/BaseComponent.js +1496 -0
- package/src/Core/components/abstract/BlockComponent.js +5 -0
- package/src/Core/components/abstract/BooleanBaseOperator.js +88 -0
- package/src/Core/components/abstract/BooleanBaseOperatorOfMath.js +100 -0
- package/src/Core/components/abstract/BooleanBaseOperatorOneInput.js +44 -0
- package/src/Core/components/abstract/ComponentSize.js +789 -0
- package/src/Core/components/abstract/ComponentWithSelectableType.js +537 -0
- package/src/Core/components/abstract/CompositeComponent.js +142 -0
- package/src/Core/components/abstract/ConstraintComponent.js +19 -0
- package/src/Core/components/abstract/FunctionBaseOperator.js +680 -0
- package/src/Core/components/abstract/GraphicalComponent.js +56 -0
- package/src/Core/components/abstract/InlineComponent.js +5 -0
- package/src/Core/components/abstract/InlineRenderInlineChildren.js +63 -0
- package/src/Core/components/abstract/Input.js +192 -0
- package/src/Core/components/abstract/IntervalListComponent.js +218 -0
- package/src/Core/components/abstract/LineListComponent.js +114 -0
- package/src/Core/components/abstract/MathBaseOperator.js +631 -0
- package/src/Core/components/abstract/MathBaseOperatorOneInput.js +112 -0
- package/src/Core/components/abstract/PointListComponent.js +238 -0
- package/src/Core/components/abstract/SectioningComponent.js +1262 -0
- package/src/Core/components/abstract/SingleCharacterInline.js +23 -0
- package/src/Core/components/abstract/TextBaseOperatorOfMath.js +47 -0
- package/src/Core/components/abstract/TextOrInline.js +66 -0
- package/src/Core/components/abstract/VariableName.js +31 -0
- package/src/Core/components/abstract/VariableNameList.js +83 -0
- package/src/Core/components/abstract/VectorListComponent.js +235 -0
- package/src/Core/components/chemistry/Atom.js +910 -0
- package/src/Core/components/chemistry/ElectronConfiguration.js +36 -0
- package/src/Core/components/chemistry/Ion.js +684 -0
- package/src/Core/components/chemistry/IonicCompound.js +189 -0
- package/src/Core/components/chemistry/OrbitalDiagram.js +175 -0
- package/src/Core/components/chemistry/OrbitalDiagramInput.js +753 -0
- package/src/Core/components/chemistry/index.js +6 -0
- package/src/Core/components/commonsugar/breakstrings.js +627 -0
- package/src/Core/components/commonsugar/lists.js +177 -0
- package/src/Core/components/dynamicalSystems/CobwebPolyline.js +913 -0
- package/src/Core/components/dynamicalSystems/EquilibriumCurve.js +95 -0
- package/src/Core/components/dynamicalSystems/EquilibriumLine.js +93 -0
- package/src/Core/components/dynamicalSystems/EquilibriumPoint.js +93 -0
- package/src/Core/components/dynamicalSystems/ODESystem.js +943 -0
- package/src/Core/components/dynamicalSystems/index.js +5 -0
- package/src/Core/components/linearAlgebra/EigenDecomposition.js +294 -0
- package/src/Core/utils/array.js +30 -0
- package/src/Core/utils/booleanLogic.js +965 -0
- package/src/Core/utils/checkEquality.js +818 -0
- package/src/Core/utils/cid.js +29 -0
- package/src/Core/utils/componentInfoObjects.js +100 -0
- package/src/Core/utils/constraints.js +23 -0
- package/src/Core/utils/copy.js +572 -0
- package/src/Core/utils/deepFunctions.js +173 -0
- package/src/Core/utils/descendants.js +252 -0
- package/src/Core/utils/enumeration.js +234 -0
- package/src/Core/utils/feedback.js +84 -0
- package/src/Core/utils/function.js +1343 -0
- package/src/Core/utils/graphical.js +196 -0
- package/src/Core/utils/label.js +396 -0
- package/src/Core/utils/math.js +1056 -0
- package/src/Core/utils/naming.js +45 -0
- package/src/Core/utils/periodicSetEquality.js +403 -0
- package/src/Core/utils/randomNumbers.js +70 -0
- package/src/Core/utils/retrieveMedia.js +98 -0
- package/src/Core/utils/retrieveTextFile.js +140 -0
- package/src/Core/utils/returnAllPossibleVariants.js +73 -0
- package/src/Core/utils/rounding.js +316 -0
- package/src/Core/utils/sequence.js +754 -0
- package/src/Core/utils/serializedStateProcessing.js +4049 -0
- package/src/Core/utils/size.js +22 -0
- package/src/Core/utils/stateVariables.js +138 -0
- package/src/Core/utils/style.js +535 -0
- package/src/Core/utils/subset-of-reals.js +796 -0
- package/src/Core/utils/table.js +41 -0
- package/src/Core/utils/text.js +16 -0
- package/src/Core/utils/triggering.js +167 -0
- package/src/Core/utils/variants.js +477 -0
- package/src/DoenetML.css +308 -0
- package/src/DoenetML.jsx +201 -0
- package/src/Parser/doenet.grammar +90 -0
- package/src/Parser/doenet.js +33 -0
- package/src/Parser/doenet.terms.js +20 -0
- package/src/Parser/parser.js +266 -0
- package/src/Parser/tokens.js +129 -0
- package/src/Tools/CodeMirror.jsx +440 -0
- package/src/Tools/DarkmodeController.jsx +21 -0
- package/src/Tools/Footers/MathInputSelector.jsx +34 -0
- package/src/Tools/Footers/VirtualKeyboard.jsx +751 -0
- package/src/Tools/cypressTest/CypressTest.jsx +341 -0
- package/src/Tools/cypressTest/index.html +102 -0
- package/src/Tools/cypressTest/index.jsx +40 -0
- package/src/Viewer/ActivityViewer.jsx +1461 -0
- package/src/Viewer/PageViewer.jsx +1329 -0
- package/src/Viewer/renderers/alert.jsx +17 -0
- package/src/Viewer/renderers/angle.jsx +209 -0
- package/src/Viewer/renderers/answer.jsx +206 -0
- package/src/Viewer/renderers/asList.jsx +25 -0
- package/src/Viewer/renderers/blockQuote.jsx +41 -0
- package/src/Viewer/renderers/boolean.jsx +17 -0
- package/src/Viewer/renderers/booleanInput.css +105 -0
- package/src/Viewer/renderers/booleanInput.jsx +636 -0
- package/src/Viewer/renderers/button.jsx +369 -0
- package/src/Viewer/renderers/c.jsx +17 -0
- package/src/Viewer/renderers/callAction.jsx +18 -0
- package/src/Viewer/renderers/cell.jsx +59 -0
- package/src/Viewer/renderers/chart.jsx +83 -0
- package/src/Viewer/renderers/choiceInput.css +223 -0
- package/src/Viewer/renderers/choiceInput.jsx +535 -0
- package/src/Viewer/renderers/circle.jsx +990 -0
- package/src/Viewer/renderers/cobwebPolyline.jsx +442 -0
- package/src/Viewer/renderers/codeEditor.jsx +248 -0
- package/src/Viewer/renderers/codeViewer.jsx +105 -0
- package/src/Viewer/renderers/containerBlock.jsx +41 -0
- package/src/Viewer/renderers/containerInline.jsx +17 -0
- package/src/Viewer/renderers/contentBrowser.jsx +159 -0
- package/src/Viewer/renderers/contentPicker.jsx +160 -0
- package/src/Viewer/renderers/curve.jsx +1072 -0
- package/src/Viewer/renderers/ellipsis.jsx +17 -0
- package/src/Viewer/renderers/em.jsx +17 -0
- package/src/Viewer/renderers/embed.jsx +110 -0
- package/src/Viewer/renderers/feedback.jsx +74 -0
- package/src/Viewer/renderers/figure.jsx +131 -0
- package/src/Viewer/renderers/footnote.jsx +52 -0
- package/src/Viewer/renderers/graph.jsx +925 -0
- package/src/Viewer/renderers/hint.jsx +142 -0
- package/src/Viewer/renderers/image.jsx +581 -0
- package/src/Viewer/renderers/jsxgraph-distrib/jsxgraphcore.mjs +2 -0
- package/src/Viewer/renderers/jsxgraph-distrib/jsxgraphcore.mjs.map +1 -0
- package/src/Viewer/renderers/label.jsx +470 -0
- package/src/Viewer/renderers/legend.jsx +306 -0
- package/src/Viewer/renderers/line.jsx +511 -0
- package/src/Viewer/renderers/lineSegment.jsx +754 -0
- package/src/Viewer/renderers/list.jsx +111 -0
- package/src/Viewer/renderers/lq.jsx +12 -0
- package/src/Viewer/renderers/lsq.jsx +12 -0
- package/src/Viewer/renderers/math.jsx +582 -0
- package/src/Viewer/renderers/mathInput.css +10 -0
- package/src/Viewer/renderers/mathInput.jsx +425 -0
- package/src/Viewer/renderers/mathInputog.jsx +534 -0
- package/src/Viewer/renderers/mathList.jsx +39 -0
- package/src/Viewer/renderers/matrixInput.jsx +317 -0
- package/src/Viewer/renderers/mdash.jsx +12 -0
- package/src/Viewer/renderers/nbsp.jsx +12 -0
- package/src/Viewer/renderers/ndash.jsx +12 -0
- package/src/Viewer/renderers/number.jsx +454 -0
- package/src/Viewer/renderers/numberList.jsx +35 -0
- package/src/Viewer/renderers/orbitalDiagram.jsx +247 -0
- package/src/Viewer/renderers/orbitalDiagramInput.jsx +450 -0
- package/src/Viewer/renderers/p.jsx +38 -0
- package/src/Viewer/renderers/paginatorControls.jsx +41 -0
- package/src/Viewer/renderers/pegboard.jsx +239 -0
- package/src/Viewer/renderers/point.jsx +649 -0
- package/src/Viewer/renderers/polygon.jsx +612 -0
- package/src/Viewer/renderers/polyline.jsx +608 -0
- package/src/Viewer/renderers/pre.jsx +34 -0
- package/src/Viewer/renderers/q.jsx +17 -0
- package/src/Viewer/renderers/ray.jsx +410 -0
- package/src/Viewer/renderers/ref.jsx +149 -0
- package/src/Viewer/renderers/regionBetweenCurveXAxis.jsx +182 -0
- package/src/Viewer/renderers/renderDoenetML.jsx +56 -0
- package/src/Viewer/renderers/row.jsx +31 -0
- package/src/Viewer/renderers/rq.jsx +12 -0
- package/src/Viewer/renderers/rsq.jsx +12 -0
- package/src/Viewer/renderers/section.jsx +427 -0
- package/src/Viewer/renderers/sideBySide.jsx +80 -0
- package/src/Viewer/renderers/slider.jsx +800 -0
- package/src/Viewer/renderers/solution.jsx +134 -0
- package/src/Viewer/renderers/spreadsheet.jsx +83 -0
- package/src/Viewer/renderers/sq.jsx +17 -0
- package/src/Viewer/renderers/styles/global.css +14 -0
- package/src/Viewer/renderers/subsetOfRealsInput.jsx +392 -0
- package/src/Viewer/renderers/summaryStatistics.jsx +83 -0
- package/src/Viewer/renderers/table.jsx +78 -0
- package/src/Viewer/renderers/tabular.jsx +58 -0
- package/src/Viewer/renderers/tag.jsx +26 -0
- package/src/Viewer/renderers/text.jsx +439 -0
- package/src/Viewer/renderers/textInput.jsx +774 -0
- package/src/Viewer/renderers/textList.jsx +30 -0
- package/src/Viewer/renderers/triggerSet.jsx +52 -0
- package/src/Viewer/renderers/updateValue.jsx +30 -0
- package/src/Viewer/renderers/utils/css.js +13 -0
- package/src/Viewer/renderers/utils/graph.js +159 -0
- package/src/Viewer/renderers/utils/offGraphIndicators.js +91 -0
- package/src/Viewer/renderers/vector.jsx +678 -0
- package/src/Viewer/renderers/video.jsx +494 -0
- package/src/Viewer/useDoenetRenderer.jsx +128 -0
- package/src/main.jsx +16 -0
- package/src/media/fonts/files/open-sans-v18-latin-700.woff +0 -0
- package/src/media/fonts/files/open-sans-v18-latin-700.woff2 +0 -0
- package/src/media/fonts/files/open-sans-v18-latin-700italic.woff +0 -0
- package/src/media/fonts/files/open-sans-v18-latin-700italic.woff2 +0 -0
- package/src/media/fonts/files/open-sans-v18-latin-italic.woff +0 -0
- package/src/media/fonts/files/open-sans-v18-latin-italic.woff2 +0 -0
- package/src/media/fonts/files/open-sans-v18-latin-light-italic.woff +0 -0
- package/src/media/fonts/files/open-sans-v18-latin-light-italic.woff2 +0 -0
- package/src/media/fonts/files/open-sans-v18-latin-light.woff +0 -0
- package/src/media/fonts/files/open-sans-v18-latin-light.woff2 +0 -0
- package/src/media/fonts/files/open-sans-v18-latin-regular.woff +0 -0
- package/src/media/fonts/files/open-sans-v18-latin-regular.woff2 +0 -0
- package/src/test/testCode.doenet +26 -0
- package/src/test/testViewer.jsx +158 -0
- package/src/uiComponents/ActionButton.jsx +157 -0
- package/src/uiComponents/ActionButtonGroup.jsx +93 -0
- package/src/uiComponents/Button.jsx +160 -0
- package/src/uiComponents/ButtonGroup.jsx +56 -0
- package/src/uiComponents/ToggleButton.jsx +194 -0
- package/src/uiComponents/ToggleButtonGroup.jsx +77 -0
- package/src/utils/activityUtils.js +713 -0
- package/src/utils/array.js +17 -0
- package/src/utils/cid.js +34 -0
- package/src/utils/componentInfoObjects.js +89 -0
- package/src/utils/deepFunctions.js +165 -0
- package/src/utils/enumeration.js +226 -0
- package/src/utils/math.js +624 -0
- package/src/utils/naming.js +44 -0
- package/src/utils/retrieveTextFile.js +156 -0
- package/src/utils/returnAllPossibleVariants.js +81 -0
- package/src/utils/sequence.js +715 -0
- package/src/utils/serialize.js +29 -0
- package/src/utils/serializedStateProcessing.js +2587 -0
- package/src/utils/subset-of-reals.js +783 -0
- package/src/utils/url.js +19 -0
- package/vite.config.js +14 -0
|
@@ -0,0 +1,2125 @@
|
|
|
1
|
+
import { cesc, cesc2 } from "../../../../src/utils/url";
|
|
2
|
+
|
|
3
|
+
describe("Allow error in numbers validation tests", function () {
|
|
4
|
+
beforeEach(() => {
|
|
5
|
+
cy.clearIndexedDB();
|
|
6
|
+
cy.visit("/src/Tools/cypressTest/");
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
it("expression with single number", () => {
|
|
10
|
+
cy.window().then(async (win) => {
|
|
11
|
+
win.postMessage(
|
|
12
|
+
{
|
|
13
|
+
doenetML: `
|
|
14
|
+
<p>a</p>
|
|
15
|
+
<p><math>log(32x+c)</math>
|
|
16
|
+
<answer>
|
|
17
|
+
<award allowederrorinnumbers="0.00001">
|
|
18
|
+
<copy target="_math1" />
|
|
19
|
+
</award>
|
|
20
|
+
<award credit="0.8" allowederrorinnumbers="0.0001">
|
|
21
|
+
<copy target="_math1" />
|
|
22
|
+
</award>
|
|
23
|
+
<award credit="0.6" allowederrorinnumbers="0.001">
|
|
24
|
+
<copy target="_math1" />
|
|
25
|
+
</award>
|
|
26
|
+
</answer>
|
|
27
|
+
</p>
|
|
28
|
+
`,
|
|
29
|
+
},
|
|
30
|
+
"*",
|
|
31
|
+
);
|
|
32
|
+
});
|
|
33
|
+
cy.get(cesc("#\\/_p1")).should("have.text", "a"); // to wait until loaded
|
|
34
|
+
|
|
35
|
+
cy.window().then(async (win) => {
|
|
36
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
37
|
+
let mathinputName = cesc2(
|
|
38
|
+
stateVariables["/_answer1"].stateValues.inputChildren[0].componentName,
|
|
39
|
+
);
|
|
40
|
+
let mathinputAnchor = "#" + mathinputName + " textarea";
|
|
41
|
+
let mathinputEditiableFieldAnchor =
|
|
42
|
+
"#" + mathinputName + " .mq-editable-field";
|
|
43
|
+
let mathinputSubmitAnchor = "#" + mathinputName + "_submit";
|
|
44
|
+
let mathinputCorrectAnchor = "#" + mathinputName + "_correct";
|
|
45
|
+
let mathinputPartialAnchor = "#" + mathinputName + "_partial";
|
|
46
|
+
let mathinputIncorrectAnchor = "#" + mathinputName + "_incorrect";
|
|
47
|
+
|
|
48
|
+
cy.get(mathinputSubmitAnchor).should("be.visible");
|
|
49
|
+
|
|
50
|
+
cy.log("Submit exact answer");
|
|
51
|
+
cy.get(mathinputAnchor).type("log(32x+c){enter}", {
|
|
52
|
+
force: true,
|
|
53
|
+
delay: 5,
|
|
54
|
+
});
|
|
55
|
+
cy.get(mathinputCorrectAnchor).should("be.visible");
|
|
56
|
+
cy.get(mathinputEditiableFieldAnchor)
|
|
57
|
+
.invoke("text")
|
|
58
|
+
.then((text) => {
|
|
59
|
+
expect(text.replace(/[\s\u200B-\u200D\uFEFF]/g, "")).equal(
|
|
60
|
+
"log(32x+c)",
|
|
61
|
+
);
|
|
62
|
+
});
|
|
63
|
+
cy.window().then(async (win) => {
|
|
64
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
65
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
cy.log("Enter too large an error");
|
|
69
|
+
cy.get(mathinputAnchor).type(
|
|
70
|
+
"{ctrl+home}{shift+end}{backspace}log(32.04x+c)",
|
|
71
|
+
{ force: true, delay: 5 },
|
|
72
|
+
);
|
|
73
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
74
|
+
cy.get(mathinputIncorrectAnchor).should("be.visible");
|
|
75
|
+
|
|
76
|
+
cy.window().then(async (win) => {
|
|
77
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
78
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
cy.log("shink error");
|
|
82
|
+
cy.get(mathinputAnchor).type(
|
|
83
|
+
"{ctrl+home}{shift+end}{backspace}log(32.01x+c)",
|
|
84
|
+
{ force: true, delay: 5 },
|
|
85
|
+
);
|
|
86
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
87
|
+
cy.get(mathinputPartialAnchor).should("have.text", "60 %");
|
|
88
|
+
|
|
89
|
+
cy.window().then(async (win) => {
|
|
90
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
91
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).closeTo(
|
|
92
|
+
0.6,
|
|
93
|
+
1e-14,
|
|
94
|
+
);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
cy.log("shink error further");
|
|
98
|
+
cy.get(mathinputAnchor).type(
|
|
99
|
+
"{ctrl+home}{shift+end}{backspace}log(32.001x+c)",
|
|
100
|
+
{ force: true, delay: 5 },
|
|
101
|
+
);
|
|
102
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
103
|
+
cy.get(mathinputPartialAnchor).should("have.text", "80 %");
|
|
104
|
+
|
|
105
|
+
cy.window().then(async (win) => {
|
|
106
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
107
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).closeTo(
|
|
108
|
+
0.8,
|
|
109
|
+
1e-14,
|
|
110
|
+
);
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
cy.log("acceptable error for full credit");
|
|
114
|
+
cy.get(mathinputAnchor).type(
|
|
115
|
+
"{ctrl+home}{shift+end}{backspace}log(32.0001x+c)",
|
|
116
|
+
{ force: true, delay: 5 },
|
|
117
|
+
);
|
|
118
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
119
|
+
cy.get(mathinputCorrectAnchor).should("be.visible");
|
|
120
|
+
|
|
121
|
+
cy.window().then(async (win) => {
|
|
122
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
123
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
cy.log("increase error");
|
|
127
|
+
cy.get(mathinputAnchor).type(
|
|
128
|
+
"{ctrl+home}{shift+end}{backspace}log(31.999x+c)",
|
|
129
|
+
{ force: true, delay: 5 },
|
|
130
|
+
);
|
|
131
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
132
|
+
cy.get(mathinputPartialAnchor).should("have.text", "80 %");
|
|
133
|
+
|
|
134
|
+
cy.window().then(async (win) => {
|
|
135
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
136
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).closeTo(
|
|
137
|
+
0.8,
|
|
138
|
+
1e-14,
|
|
139
|
+
);
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
cy.log("increase error further");
|
|
143
|
+
cy.get(mathinputAnchor).type(
|
|
144
|
+
"{ctrl+home}{shift+end}{backspace}log(31.99x+c)",
|
|
145
|
+
{ force: true, delay: 5 },
|
|
146
|
+
);
|
|
147
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
148
|
+
cy.get(mathinputPartialAnchor).should("have.text", "60 %");
|
|
149
|
+
|
|
150
|
+
cy.window().then(async (win) => {
|
|
151
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
152
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).closeTo(
|
|
153
|
+
0.6,
|
|
154
|
+
1e-14,
|
|
155
|
+
);
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
cy.log("error too large again");
|
|
159
|
+
cy.get(mathinputAnchor).type(
|
|
160
|
+
"{ctrl+home}{shift+end}{backspace}log(31.9x+c)",
|
|
161
|
+
{ force: true, delay: 5 },
|
|
162
|
+
);
|
|
163
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
164
|
+
cy.get(mathinputIncorrectAnchor).should("be.visible");
|
|
165
|
+
|
|
166
|
+
cy.window().then(async (win) => {
|
|
167
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
168
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
it("expression with single number, absolute error", () => {
|
|
174
|
+
cy.window().then(async (win) => {
|
|
175
|
+
win.postMessage(
|
|
176
|
+
{
|
|
177
|
+
doenetML: `
|
|
178
|
+
<p>a</p>
|
|
179
|
+
<p><math>log(32x+c)</math>
|
|
180
|
+
<answer>
|
|
181
|
+
<award allowederrorinnumbers="0.00001" allowederrorisabsolute="true">
|
|
182
|
+
<copy target="_math1" />
|
|
183
|
+
</award>
|
|
184
|
+
<award credit="0.8" allowederrorinnumbers="0.0001" allowederrorisabsolute="true">
|
|
185
|
+
<copy target="_math1" />
|
|
186
|
+
</award>
|
|
187
|
+
<award credit="0.6" allowederrorinnumbers="0.001" allowederrorisabsolute="true">
|
|
188
|
+
<copy target="_math1" />
|
|
189
|
+
</award>
|
|
190
|
+
</answer>
|
|
191
|
+
</p>
|
|
192
|
+
`,
|
|
193
|
+
},
|
|
194
|
+
"*",
|
|
195
|
+
);
|
|
196
|
+
});
|
|
197
|
+
cy.get(cesc("#\\/_p1")).should("have.text", "a"); // to wait until loaded
|
|
198
|
+
|
|
199
|
+
cy.window().then(async (win) => {
|
|
200
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
201
|
+
let mathinputName = cesc2(
|
|
202
|
+
stateVariables["/_answer1"].stateValues.inputChildren[0].componentName,
|
|
203
|
+
);
|
|
204
|
+
let mathinputAnchor = "#" + mathinputName + " textarea";
|
|
205
|
+
let mathinputSubmitAnchor = "#" + mathinputName + "_submit";
|
|
206
|
+
let mathinputCorrectAnchor = "#" + mathinputName + "_correct";
|
|
207
|
+
let mathinputPartialAnchor = "#" + mathinputName + "_partial";
|
|
208
|
+
let mathinputIncorrectAnchor = "#" + mathinputName + "_incorrect";
|
|
209
|
+
|
|
210
|
+
cy.get(mathinputSubmitAnchor).should("be.visible");
|
|
211
|
+
|
|
212
|
+
cy.log("Submit exact answer");
|
|
213
|
+
cy.get(mathinputAnchor).type("log(32x+c){enter}", {
|
|
214
|
+
force: true,
|
|
215
|
+
delay: 5,
|
|
216
|
+
});
|
|
217
|
+
cy.get(mathinputCorrectAnchor).should("be.visible");
|
|
218
|
+
|
|
219
|
+
cy.window().then(async (win) => {
|
|
220
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
221
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
cy.log("Enter too large an error");
|
|
225
|
+
cy.get(mathinputAnchor).type(
|
|
226
|
+
"{ctrl+home}{shift+end}{backspace}log(32.002x+c)",
|
|
227
|
+
{ force: true, delay: 5 },
|
|
228
|
+
);
|
|
229
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
230
|
+
cy.get(mathinputIncorrectAnchor).should("be.visible");
|
|
231
|
+
|
|
232
|
+
cy.window().then(async (win) => {
|
|
233
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
234
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
cy.log("shink error");
|
|
238
|
+
cy.get(mathinputAnchor).type(
|
|
239
|
+
"{ctrl+home}{shift+end}{backspace}log(32.0005x+c)",
|
|
240
|
+
{ force: true, delay: 5 },
|
|
241
|
+
);
|
|
242
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
243
|
+
cy.get(mathinputPartialAnchor).should("have.text", "60 %");
|
|
244
|
+
|
|
245
|
+
cy.window().then(async (win) => {
|
|
246
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
247
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).closeTo(
|
|
248
|
+
0.6,
|
|
249
|
+
1e-14,
|
|
250
|
+
);
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
cy.log("shink error further");
|
|
254
|
+
cy.get(mathinputAnchor).type(
|
|
255
|
+
"{ctrl+home}{shift+end}{backspace}log(32.00005x+c)",
|
|
256
|
+
{ force: true, delay: 5 },
|
|
257
|
+
);
|
|
258
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
259
|
+
cy.get(mathinputPartialAnchor).should("have.text", "80 %");
|
|
260
|
+
|
|
261
|
+
cy.window().then(async (win) => {
|
|
262
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
263
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).closeTo(
|
|
264
|
+
0.8,
|
|
265
|
+
1e-14,
|
|
266
|
+
);
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
cy.log("acceptable error for full credit");
|
|
270
|
+
cy.get(mathinputAnchor).type(
|
|
271
|
+
"{ctrl+home}{shift+end}{backspace}log(32.000005x+c)",
|
|
272
|
+
{ force: true, delay: 5 },
|
|
273
|
+
);
|
|
274
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
275
|
+
cy.get(mathinputCorrectAnchor).should("be.visible");
|
|
276
|
+
|
|
277
|
+
cy.window().then(async (win) => {
|
|
278
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
279
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
cy.log("increase error");
|
|
283
|
+
cy.get(mathinputAnchor).type(
|
|
284
|
+
"{ctrl+home}{shift+end}{backspace}log(31.99995x+c)",
|
|
285
|
+
{ force: true, delay: 5 },
|
|
286
|
+
);
|
|
287
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
288
|
+
cy.get(mathinputPartialAnchor).should("have.text", "80 %");
|
|
289
|
+
|
|
290
|
+
cy.window().then(async (win) => {
|
|
291
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
292
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).closeTo(
|
|
293
|
+
0.8,
|
|
294
|
+
1e-14,
|
|
295
|
+
);
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
cy.log("increase error further");
|
|
299
|
+
cy.get(mathinputAnchor).type(
|
|
300
|
+
"{ctrl+home}{shift+end}{backspace}log(31.9995x+c)",
|
|
301
|
+
{ force: true, delay: 5 },
|
|
302
|
+
);
|
|
303
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
304
|
+
cy.get(mathinputPartialAnchor).should("have.text", "60 %");
|
|
305
|
+
|
|
306
|
+
cy.window().then(async (win) => {
|
|
307
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
308
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).closeTo(
|
|
309
|
+
0.6,
|
|
310
|
+
1e-14,
|
|
311
|
+
);
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
cy.log("error too large again");
|
|
315
|
+
cy.get(mathinputAnchor).type(
|
|
316
|
+
"{ctrl+home}{shift+end}{backspace}log(31.995x+c)",
|
|
317
|
+
{ force: true, delay: 5 },
|
|
318
|
+
);
|
|
319
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
320
|
+
cy.get(mathinputIncorrectAnchor).should("be.visible");
|
|
321
|
+
|
|
322
|
+
cy.window().then(async (win) => {
|
|
323
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
324
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
|
|
325
|
+
});
|
|
326
|
+
});
|
|
327
|
+
});
|
|
328
|
+
|
|
329
|
+
// since will randomly fail, just skip test
|
|
330
|
+
it.skip("complicated expression with three numbers", () => {
|
|
331
|
+
cy.window().then(async (win) => {
|
|
332
|
+
win.postMessage(
|
|
333
|
+
{
|
|
334
|
+
doenetML: `
|
|
335
|
+
<p>a</p>
|
|
336
|
+
<p><math simplify>10 exp(7x^2/(3-sqrt(y)))</math>
|
|
337
|
+
<answer>
|
|
338
|
+
<award allowederrorinnumbers="0.0000001">
|
|
339
|
+
<copy target="_math1" />
|
|
340
|
+
</award>
|
|
341
|
+
<award credit="0.6" allowederrorinnumbers="0.0001">
|
|
342
|
+
<copy target="_math1" />
|
|
343
|
+
</award>
|
|
344
|
+
</answer>
|
|
345
|
+
</p>
|
|
346
|
+
`,
|
|
347
|
+
},
|
|
348
|
+
"*",
|
|
349
|
+
);
|
|
350
|
+
});
|
|
351
|
+
cy.get(cesc("#\\/_p1")).should("have.text", "a"); // to wait until loaded
|
|
352
|
+
|
|
353
|
+
cy.window().then(async (win) => {
|
|
354
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
355
|
+
let mathinputName =
|
|
356
|
+
stateVariables["/_answer1"].stateValues.inputChildren[0].componentName;
|
|
357
|
+
let mathinputAnchor = "#" + mathinputName + " textarea";
|
|
358
|
+
let mathinputSubmitAnchor = "#" + mathinputName + "_submit";
|
|
359
|
+
let mathinputCorrectAnchor = "#" + mathinputName + "_correct";
|
|
360
|
+
let mathinputPartialAnchor = "#" + mathinputName + "_partial";
|
|
361
|
+
let mathinputIncorrectAnchor = "#" + mathinputName + "_incorrect";
|
|
362
|
+
|
|
363
|
+
cy.get(mathinputSubmitAnchor).should("be.visible");
|
|
364
|
+
|
|
365
|
+
cy.log("Submit exact answer");
|
|
366
|
+
cy.get(mathinputAnchor).type("10 exp(7x^2/3-sqrty{enter}");
|
|
367
|
+
cy.get(mathinputCorrectAnchor).should("be.visible");
|
|
368
|
+
|
|
369
|
+
cy.window().then(async (win) => {
|
|
370
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
371
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
|
|
372
|
+
});
|
|
373
|
+
|
|
374
|
+
cy.log("Enter too large an error");
|
|
375
|
+
cy.get(mathinputAnchor).clear().type("9.9 exp(6.9x^2/3.1-sqrty{enter}");
|
|
376
|
+
cy.get(mathinputIncorrectAnchor).should("be.visible");
|
|
377
|
+
|
|
378
|
+
cy.window().then(async (win) => {
|
|
379
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
380
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
|
|
381
|
+
});
|
|
382
|
+
|
|
383
|
+
cy.log("shink error");
|
|
384
|
+
cy.get(mathinputAnchor)
|
|
385
|
+
.clear()
|
|
386
|
+
.type("10.0001 exp(7.00005x^2/2.99995-sqrty{enter}");
|
|
387
|
+
cy.get(mathinputPartialAnchor).should("have.text", "60 %");
|
|
388
|
+
|
|
389
|
+
cy.window().then(async (win) => {
|
|
390
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
391
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).closeTo(
|
|
392
|
+
0.6,
|
|
393
|
+
1e-14,
|
|
394
|
+
);
|
|
395
|
+
});
|
|
396
|
+
|
|
397
|
+
cy.log("acceptable error for full credit");
|
|
398
|
+
cy.get(mathinputAnchor)
|
|
399
|
+
.clear()
|
|
400
|
+
.type("10.0000001 exp(7.0000001x^2/2.9999999-sqrty{enter}");
|
|
401
|
+
cy.get(mathinputCorrectAnchor).should("be.visible");
|
|
402
|
+
|
|
403
|
+
cy.window().then(async (win) => {
|
|
404
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
405
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
|
|
406
|
+
});
|
|
407
|
+
});
|
|
408
|
+
});
|
|
409
|
+
|
|
410
|
+
it("don't ignore exponents", () => {
|
|
411
|
+
cy.window().then(async (win) => {
|
|
412
|
+
win.postMessage(
|
|
413
|
+
{
|
|
414
|
+
doenetML: `
|
|
415
|
+
<p>a</p>
|
|
416
|
+
<p><math>10x^2-4</math>
|
|
417
|
+
<answer>
|
|
418
|
+
<award allowederrorinnumbers="0.0001">
|
|
419
|
+
<copy target="_math1" />
|
|
420
|
+
</award>
|
|
421
|
+
</answer>
|
|
422
|
+
</p>
|
|
423
|
+
|
|
424
|
+
<p>Allow for error in exponents
|
|
425
|
+
<answer>
|
|
426
|
+
<award allowederrorinnumbers="0.0001" includeerrorinnumberexponents>
|
|
427
|
+
<copy target="_math1" />
|
|
428
|
+
</award>
|
|
429
|
+
</answer>
|
|
430
|
+
</p>
|
|
431
|
+
`,
|
|
432
|
+
},
|
|
433
|
+
"*",
|
|
434
|
+
);
|
|
435
|
+
});
|
|
436
|
+
cy.get(cesc("#\\/_p1")).should("have.text", "a"); // to wait until loaded
|
|
437
|
+
|
|
438
|
+
cy.window().then(async (win) => {
|
|
439
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
440
|
+
let mathinputName = cesc2(
|
|
441
|
+
stateVariables["/_answer1"].stateValues.inputChildren[0].componentName,
|
|
442
|
+
);
|
|
443
|
+
let mathinputAnchor = "#" + mathinputName + " textarea";
|
|
444
|
+
let mathinputSubmitAnchor = "#" + mathinputName + "_submit";
|
|
445
|
+
let mathinputCorrectAnchor = "#" + mathinputName + "_correct";
|
|
446
|
+
let mathinputPartialAnchor = "#" + mathinputName + "_partial";
|
|
447
|
+
let mathinputIncorrectAnchor = "#" + mathinputName + "_incorrect";
|
|
448
|
+
|
|
449
|
+
let mathinput2Name = cesc2(
|
|
450
|
+
stateVariables["/_answer2"].stateValues.inputChildren[0].componentName,
|
|
451
|
+
);
|
|
452
|
+
let mathinput2Anchor = "#" + mathinput2Name + " textarea";
|
|
453
|
+
let mathinput2SubmitAnchor = "#" + mathinput2Name + "_submit";
|
|
454
|
+
let mathinput2CorrectAnchor = "#" + mathinput2Name + "_correct";
|
|
455
|
+
let mathinput2PartialAnchor = "#" + mathinput2Name + "_partial";
|
|
456
|
+
let mathinput2IncorrectAnchor = "#" + mathinput2Name + "_incorrect";
|
|
457
|
+
|
|
458
|
+
cy.get(mathinputSubmitAnchor).should("be.visible");
|
|
459
|
+
cy.get(mathinput2SubmitAnchor).should("be.visible");
|
|
460
|
+
|
|
461
|
+
cy.log("Submit exact answer");
|
|
462
|
+
cy.get(mathinputAnchor).type("10x^2{rightarrow}-4{enter}", {
|
|
463
|
+
force: true,
|
|
464
|
+
delay: 5,
|
|
465
|
+
});
|
|
466
|
+
cy.get(mathinputCorrectAnchor).should("be.visible");
|
|
467
|
+
cy.get(mathinput2Anchor).type("10x^2{rightarrow}-4{enter}", {
|
|
468
|
+
force: true,
|
|
469
|
+
delay: 5,
|
|
470
|
+
});
|
|
471
|
+
cy.get(mathinput2CorrectAnchor).should("be.visible");
|
|
472
|
+
|
|
473
|
+
cy.window().then(async (win) => {
|
|
474
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
475
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
|
|
476
|
+
expect(stateVariables["/_answer2"].stateValues.creditAchieved).eq(1);
|
|
477
|
+
});
|
|
478
|
+
|
|
479
|
+
cy.log("Enter too large an error");
|
|
480
|
+
cy.get(mathinputAnchor).type(
|
|
481
|
+
"{ctrl+home}{shift+end}{backspace}10.002x^2.0004{rightarrow}-4.0008",
|
|
482
|
+
{ force: true, delay: 5 },
|
|
483
|
+
);
|
|
484
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
485
|
+
cy.get(mathinputIncorrectAnchor).should("be.visible");
|
|
486
|
+
cy.get(mathinput2Anchor).type(
|
|
487
|
+
"{ctrl+home}{shift+end}{backspace}10.002x^2.0004{rightarrow}-4.0008",
|
|
488
|
+
{ force: true, delay: 5 },
|
|
489
|
+
);
|
|
490
|
+
cy.get(mathinput2SubmitAnchor).click();
|
|
491
|
+
cy.get(mathinput2IncorrectAnchor).should("be.visible");
|
|
492
|
+
|
|
493
|
+
cy.window().then(async (win) => {
|
|
494
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
495
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
|
|
496
|
+
expect(stateVariables["/_answer2"].stateValues.creditAchieved).eq(0);
|
|
497
|
+
});
|
|
498
|
+
|
|
499
|
+
cy.log("Too large an error if don't allow exponent error");
|
|
500
|
+
cy.get(mathinputAnchor).type(
|
|
501
|
+
"{ctrl+home}{shift+end}{backspace}10.002x^2{rightarrow}-4.0008",
|
|
502
|
+
{ force: true, delay: 5 },
|
|
503
|
+
);
|
|
504
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
505
|
+
cy.get(mathinputIncorrectAnchor).should("be.visible");
|
|
506
|
+
cy.get(mathinput2Anchor).type(
|
|
507
|
+
"{ctrl+home}{shift+end}{backspace}10.002x^2{rightarrow}-4.0008",
|
|
508
|
+
{ force: true, delay: 5 },
|
|
509
|
+
);
|
|
510
|
+
cy.get(mathinput2SubmitAnchor).click();
|
|
511
|
+
cy.get(mathinput2CorrectAnchor).should("be.visible");
|
|
512
|
+
|
|
513
|
+
cy.window().then(async (win) => {
|
|
514
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
515
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
|
|
516
|
+
expect(stateVariables["/_answer2"].stateValues.creditAchieved).eq(1);
|
|
517
|
+
});
|
|
518
|
+
|
|
519
|
+
cy.log("Shrink to allowable error in both cases");
|
|
520
|
+
cy.get(mathinputAnchor).type(
|
|
521
|
+
"{ctrl+home}{shift+end}{backspace}10.0002x^2{rightarrow}-4.00008",
|
|
522
|
+
{ force: true, delay: 5 },
|
|
523
|
+
);
|
|
524
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
525
|
+
cy.get(mathinputCorrectAnchor).should("be.visible");
|
|
526
|
+
cy.get(mathinput2Anchor).type(
|
|
527
|
+
"{ctrl+home}{shift+end}{backspace}10.0002x^2{rightarrow}-4.00008",
|
|
528
|
+
{ force: true, delay: 5 },
|
|
529
|
+
);
|
|
530
|
+
cy.get(mathinput2SubmitAnchor).click();
|
|
531
|
+
cy.get(mathinput2CorrectAnchor).should("be.visible");
|
|
532
|
+
|
|
533
|
+
cy.window().then(async (win) => {
|
|
534
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
535
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
|
|
536
|
+
expect(stateVariables["/_answer2"].stateValues.creditAchieved).eq(1);
|
|
537
|
+
});
|
|
538
|
+
});
|
|
539
|
+
});
|
|
540
|
+
|
|
541
|
+
it("symbolic, expression with single number", () => {
|
|
542
|
+
cy.window().then(async (win) => {
|
|
543
|
+
win.postMessage(
|
|
544
|
+
{
|
|
545
|
+
doenetML: `
|
|
546
|
+
<p>a</p>
|
|
547
|
+
<p><math>log(32x+c)</math>
|
|
548
|
+
<answer>
|
|
549
|
+
<award symbolicequality="true" allowederrorinnumbers="0.00001" simplifyOnCompare>
|
|
550
|
+
<copy target="_math1" />
|
|
551
|
+
</award>
|
|
552
|
+
<award credit="0.8" symbolicequality="true" allowederrorinnumbers="0.0001" simplifyOnCompare>
|
|
553
|
+
<copy target="_math1" />
|
|
554
|
+
</award>
|
|
555
|
+
<award credit="0.6" symbolicequality="true" allowederrorinnumbers="0.001" simplifyOnCompare>
|
|
556
|
+
<copy target="_math1" />
|
|
557
|
+
</award>
|
|
558
|
+
</answer>
|
|
559
|
+
</p>
|
|
560
|
+
`,
|
|
561
|
+
},
|
|
562
|
+
"*",
|
|
563
|
+
);
|
|
564
|
+
});
|
|
565
|
+
cy.get(cesc("#\\/_p1")).should("have.text", "a"); // to wait until loaded
|
|
566
|
+
|
|
567
|
+
cy.window().then(async (win) => {
|
|
568
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
569
|
+
let mathinputName = cesc2(
|
|
570
|
+
stateVariables["/_answer1"].stateValues.inputChildren[0].componentName,
|
|
571
|
+
);
|
|
572
|
+
let mathinputAnchor = "#" + mathinputName + " textarea";
|
|
573
|
+
let mathinputSubmitAnchor = "#" + mathinputName + "_submit";
|
|
574
|
+
let mathinputCorrectAnchor = "#" + mathinputName + "_correct";
|
|
575
|
+
let mathinputPartialAnchor = "#" + mathinputName + "_partial";
|
|
576
|
+
let mathinputIncorrectAnchor = "#" + mathinputName + "_incorrect";
|
|
577
|
+
|
|
578
|
+
cy.get(mathinputSubmitAnchor).should("be.visible");
|
|
579
|
+
|
|
580
|
+
cy.log("Submit exact answer");
|
|
581
|
+
cy.get(mathinputAnchor).type("log(32x+c){enter}", {
|
|
582
|
+
force: true,
|
|
583
|
+
delay: 5,
|
|
584
|
+
});
|
|
585
|
+
cy.get(mathinputCorrectAnchor).should("be.visible");
|
|
586
|
+
|
|
587
|
+
cy.window().then(async (win) => {
|
|
588
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
589
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
|
|
590
|
+
});
|
|
591
|
+
|
|
592
|
+
cy.log("Enter too large an error");
|
|
593
|
+
cy.get(mathinputAnchor).type(
|
|
594
|
+
"{ctrl+home}{shift+end}{backspace}log(32.04x+c)",
|
|
595
|
+
{ force: true, delay: 5 },
|
|
596
|
+
);
|
|
597
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
598
|
+
cy.get(mathinputIncorrectAnchor).should("be.visible");
|
|
599
|
+
|
|
600
|
+
cy.window().then(async (win) => {
|
|
601
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
602
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
|
|
603
|
+
});
|
|
604
|
+
|
|
605
|
+
cy.log("shink error");
|
|
606
|
+
cy.get(mathinputAnchor).type(
|
|
607
|
+
"{ctrl+home}{shift+end}{backspace}log(32.01x+c)",
|
|
608
|
+
{ force: true, delay: 5 },
|
|
609
|
+
);
|
|
610
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
611
|
+
cy.get(mathinputPartialAnchor).should("have.text", "60 %");
|
|
612
|
+
|
|
613
|
+
cy.window().then(async (win) => {
|
|
614
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
615
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).closeTo(
|
|
616
|
+
0.6,
|
|
617
|
+
1e-14,
|
|
618
|
+
);
|
|
619
|
+
});
|
|
620
|
+
|
|
621
|
+
cy.log("shink error further");
|
|
622
|
+
cy.get(mathinputAnchor).type(
|
|
623
|
+
"{ctrl+home}{shift+end}{backspace}log(32.001x+c)",
|
|
624
|
+
{ force: true, delay: 5 },
|
|
625
|
+
);
|
|
626
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
627
|
+
cy.get(mathinputPartialAnchor).should("have.text", "80 %");
|
|
628
|
+
|
|
629
|
+
cy.window().then(async (win) => {
|
|
630
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
631
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).closeTo(
|
|
632
|
+
0.8,
|
|
633
|
+
1e-14,
|
|
634
|
+
);
|
|
635
|
+
});
|
|
636
|
+
|
|
637
|
+
cy.log("acceptable error for full credit");
|
|
638
|
+
cy.get(mathinputAnchor).type(
|
|
639
|
+
"{ctrl+home}{shift+end}{backspace}log(32.0001x+c)",
|
|
640
|
+
{ force: true, delay: 5 },
|
|
641
|
+
);
|
|
642
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
643
|
+
cy.get(mathinputCorrectAnchor).should("be.visible");
|
|
644
|
+
|
|
645
|
+
cy.window().then(async (win) => {
|
|
646
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
647
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
|
|
648
|
+
});
|
|
649
|
+
|
|
650
|
+
cy.log("increase error");
|
|
651
|
+
cy.get(mathinputAnchor).type(
|
|
652
|
+
"{ctrl+home}{shift+end}{backspace}log(31.999x+c)",
|
|
653
|
+
{ force: true, delay: 5 },
|
|
654
|
+
);
|
|
655
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
656
|
+
cy.get(mathinputPartialAnchor).should("have.text", "80 %");
|
|
657
|
+
|
|
658
|
+
cy.window().then(async (win) => {
|
|
659
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
660
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).closeTo(
|
|
661
|
+
0.8,
|
|
662
|
+
1e-14,
|
|
663
|
+
);
|
|
664
|
+
});
|
|
665
|
+
|
|
666
|
+
cy.log("increase error further");
|
|
667
|
+
cy.get(mathinputAnchor).type(
|
|
668
|
+
"{ctrl+home}{shift+end}{backspace}log(31.99x+c)",
|
|
669
|
+
{ force: true, delay: 5 },
|
|
670
|
+
);
|
|
671
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
672
|
+
cy.get(mathinputPartialAnchor).should("have.text", "60 %");
|
|
673
|
+
|
|
674
|
+
cy.window().then(async (win) => {
|
|
675
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
676
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).closeTo(
|
|
677
|
+
0.6,
|
|
678
|
+
1e-14,
|
|
679
|
+
);
|
|
680
|
+
});
|
|
681
|
+
|
|
682
|
+
cy.log("error too large again");
|
|
683
|
+
cy.get(mathinputAnchor).type(
|
|
684
|
+
"{ctrl+home}{shift+end}{backspace}log(31.9x+c)",
|
|
685
|
+
{ force: true, delay: 5 },
|
|
686
|
+
);
|
|
687
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
688
|
+
cy.get(mathinputIncorrectAnchor).should("be.visible");
|
|
689
|
+
|
|
690
|
+
cy.window().then(async (win) => {
|
|
691
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
692
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
|
|
693
|
+
});
|
|
694
|
+
});
|
|
695
|
+
});
|
|
696
|
+
|
|
697
|
+
it("symbolic, expression with single number, absolute error", () => {
|
|
698
|
+
cy.window().then(async (win) => {
|
|
699
|
+
win.postMessage(
|
|
700
|
+
{
|
|
701
|
+
doenetML: `
|
|
702
|
+
<p>a</p>
|
|
703
|
+
<p><math>log(32x+c)</math>
|
|
704
|
+
<answer symbolicequality allowederrorinnumbers="0.00001" allowederrorisabsolute simplifyOnCompare>
|
|
705
|
+
<award>$_math1</award>
|
|
706
|
+
<award credit="0.8" allowederrorinnumbers="0.0001">$_math1</award>
|
|
707
|
+
<award credit="0.6" allowederrorinnumbers="0.001">$_math1</award>
|
|
708
|
+
</answer>
|
|
709
|
+
</p>
|
|
710
|
+
`,
|
|
711
|
+
},
|
|
712
|
+
"*",
|
|
713
|
+
);
|
|
714
|
+
});
|
|
715
|
+
cy.get(cesc("#\\/_p1")).should("have.text", "a"); // to wait until loaded
|
|
716
|
+
|
|
717
|
+
cy.window().then(async (win) => {
|
|
718
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
719
|
+
let mathinputName = cesc2(
|
|
720
|
+
stateVariables["/_answer1"].stateValues.inputChildren[0].componentName,
|
|
721
|
+
);
|
|
722
|
+
let mathinputAnchor = "#" + mathinputName + " textarea";
|
|
723
|
+
let mathinputSubmitAnchor = "#" + mathinputName + "_submit";
|
|
724
|
+
let mathinputCorrectAnchor = "#" + mathinputName + "_correct";
|
|
725
|
+
let mathinputPartialAnchor = "#" + mathinputName + "_partial";
|
|
726
|
+
let mathinputIncorrectAnchor = "#" + mathinputName + "_incorrect";
|
|
727
|
+
|
|
728
|
+
cy.get(mathinputSubmitAnchor).should("be.visible");
|
|
729
|
+
|
|
730
|
+
cy.log("Submit exact answer");
|
|
731
|
+
cy.get(mathinputAnchor).type("log(32x+c){enter}", {
|
|
732
|
+
force: true,
|
|
733
|
+
delay: 5,
|
|
734
|
+
});
|
|
735
|
+
cy.get(mathinputCorrectAnchor).should("be.visible");
|
|
736
|
+
|
|
737
|
+
cy.window().then(async (win) => {
|
|
738
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
739
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
|
|
740
|
+
});
|
|
741
|
+
|
|
742
|
+
cy.log("Enter too large an error");
|
|
743
|
+
cy.get(mathinputAnchor).type(
|
|
744
|
+
"{ctrl+home}{shift+end}{backspace}log(32.002x+c)",
|
|
745
|
+
{ force: true, delay: 5 },
|
|
746
|
+
);
|
|
747
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
748
|
+
cy.get(mathinputIncorrectAnchor).should("be.visible");
|
|
749
|
+
|
|
750
|
+
cy.window().then(async (win) => {
|
|
751
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
752
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
|
|
753
|
+
});
|
|
754
|
+
|
|
755
|
+
cy.log("shink error");
|
|
756
|
+
cy.get(mathinputAnchor).type(
|
|
757
|
+
"{ctrl+home}{shift+end}{backspace}log(32.0005x+c)",
|
|
758
|
+
{ force: true, delay: 5 },
|
|
759
|
+
);
|
|
760
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
761
|
+
cy.get(mathinputPartialAnchor).should("have.text", "60 %");
|
|
762
|
+
|
|
763
|
+
cy.window().then(async (win) => {
|
|
764
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
765
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).closeTo(
|
|
766
|
+
0.6,
|
|
767
|
+
1e-14,
|
|
768
|
+
);
|
|
769
|
+
});
|
|
770
|
+
|
|
771
|
+
cy.log("shink error further");
|
|
772
|
+
cy.get(mathinputAnchor).type(
|
|
773
|
+
"{ctrl+home}{shift+end}{backspace}log(32.00005x+c)",
|
|
774
|
+
{ force: true, delay: 5 },
|
|
775
|
+
);
|
|
776
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
777
|
+
cy.get(mathinputPartialAnchor).should("have.text", "80 %");
|
|
778
|
+
|
|
779
|
+
cy.window().then(async (win) => {
|
|
780
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
781
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).closeTo(
|
|
782
|
+
0.8,
|
|
783
|
+
1e-14,
|
|
784
|
+
);
|
|
785
|
+
});
|
|
786
|
+
|
|
787
|
+
cy.log("acceptable error for full credit");
|
|
788
|
+
cy.get(mathinputAnchor).type(
|
|
789
|
+
"{ctrl+home}{shift+end}{backspace}log(32.000005x+c)",
|
|
790
|
+
{ force: true, delay: 5 },
|
|
791
|
+
);
|
|
792
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
793
|
+
cy.get(mathinputCorrectAnchor).should("be.visible");
|
|
794
|
+
|
|
795
|
+
cy.window().then(async (win) => {
|
|
796
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
797
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
|
|
798
|
+
});
|
|
799
|
+
|
|
800
|
+
cy.log("increase error");
|
|
801
|
+
cy.get(mathinputAnchor).type(
|
|
802
|
+
"{ctrl+home}{shift+end}{backspace}log(31.99995x+c)",
|
|
803
|
+
{ force: true, delay: 5 },
|
|
804
|
+
);
|
|
805
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
806
|
+
cy.get(mathinputPartialAnchor).should("have.text", "80 %");
|
|
807
|
+
|
|
808
|
+
cy.window().then(async (win) => {
|
|
809
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
810
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).closeTo(
|
|
811
|
+
0.8,
|
|
812
|
+
1e-14,
|
|
813
|
+
);
|
|
814
|
+
});
|
|
815
|
+
|
|
816
|
+
cy.log("increase error further");
|
|
817
|
+
cy.get(mathinputAnchor).type(
|
|
818
|
+
"{ctrl+home}{shift+end}{backspace}log(31.9995x+c)",
|
|
819
|
+
{ force: true, delay: 5 },
|
|
820
|
+
);
|
|
821
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
822
|
+
cy.get(mathinputPartialAnchor).should("have.text", "60 %");
|
|
823
|
+
|
|
824
|
+
cy.window().then(async (win) => {
|
|
825
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
826
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).closeTo(
|
|
827
|
+
0.6,
|
|
828
|
+
1e-14,
|
|
829
|
+
);
|
|
830
|
+
});
|
|
831
|
+
|
|
832
|
+
cy.log("error too large again");
|
|
833
|
+
cy.get(mathinputAnchor).type(
|
|
834
|
+
"{ctrl+home}{shift+end}{backspace}log(31.995x+c)",
|
|
835
|
+
{ force: true, delay: 5 },
|
|
836
|
+
);
|
|
837
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
838
|
+
cy.get(mathinputIncorrectAnchor).should("be.visible");
|
|
839
|
+
|
|
840
|
+
cy.window().then(async (win) => {
|
|
841
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
842
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
|
|
843
|
+
});
|
|
844
|
+
});
|
|
845
|
+
});
|
|
846
|
+
|
|
847
|
+
it("symbolic, complicated expression with three numbers", () => {
|
|
848
|
+
cy.window().then(async (win) => {
|
|
849
|
+
win.postMessage(
|
|
850
|
+
{
|
|
851
|
+
doenetML: `
|
|
852
|
+
<p>a</p>
|
|
853
|
+
<p><math>10000 exp(7x^2/(0.00003-sqrt(y)))</math>
|
|
854
|
+
<answer symbolicequality simplifyOnCompare>
|
|
855
|
+
<award allowederrorinnumbers="0.0000001" >
|
|
856
|
+
<copy target="_math1" />
|
|
857
|
+
</award>
|
|
858
|
+
<award credit="0.8" allowederrorinnumbers="0.000001">
|
|
859
|
+
<copy target="_math1" />
|
|
860
|
+
</award>
|
|
861
|
+
<award credit="0.6" allowederrorinnumbers="0.00001">
|
|
862
|
+
<copy target="_math1" />
|
|
863
|
+
</award>
|
|
864
|
+
</answer>
|
|
865
|
+
</p>
|
|
866
|
+
`,
|
|
867
|
+
},
|
|
868
|
+
"*",
|
|
869
|
+
);
|
|
870
|
+
});
|
|
871
|
+
cy.get(cesc("#\\/_p1")).should("have.text", "a"); // to wait until loaded
|
|
872
|
+
|
|
873
|
+
cy.window().then(async (win) => {
|
|
874
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
875
|
+
let mathinputName = cesc2(
|
|
876
|
+
stateVariables["/_answer1"].stateValues.inputChildren[0].componentName,
|
|
877
|
+
);
|
|
878
|
+
let mathinputAnchor = "#" + mathinputName + " textarea";
|
|
879
|
+
let mathinputSubmitAnchor = "#" + mathinputName + "_submit";
|
|
880
|
+
let mathinputCorrectAnchor = "#" + mathinputName + "_correct";
|
|
881
|
+
let mathinputPartialAnchor = "#" + mathinputName + "_partial";
|
|
882
|
+
let mathinputIncorrectAnchor = "#" + mathinputName + "_incorrect";
|
|
883
|
+
|
|
884
|
+
cy.get(mathinputSubmitAnchor).should("be.visible");
|
|
885
|
+
|
|
886
|
+
cy.log("Submit exact answer");
|
|
887
|
+
cy.get(mathinputAnchor).type(
|
|
888
|
+
"10000 exp(7x^2{rightarrow}/0.00003-sqrty{enter}",
|
|
889
|
+
{ force: true, delay: 5 },
|
|
890
|
+
);
|
|
891
|
+
cy.get(mathinputCorrectAnchor).should("be.visible");
|
|
892
|
+
|
|
893
|
+
cy.window().then(async (win) => {
|
|
894
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
895
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
|
|
896
|
+
});
|
|
897
|
+
|
|
898
|
+
cy.log("Enter too large an error in first number");
|
|
899
|
+
cy.get(mathinputAnchor).type(
|
|
900
|
+
"{ctrl+home}{shift+end}{backspace}9999 exp(7x^2{rightarrow}/0.00003-sqrty",
|
|
901
|
+
{ force: true, delay: 5 },
|
|
902
|
+
);
|
|
903
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
904
|
+
cy.get(mathinputIncorrectAnchor).should("be.visible");
|
|
905
|
+
|
|
906
|
+
cy.window().then(async (win) => {
|
|
907
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
908
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
|
|
909
|
+
});
|
|
910
|
+
|
|
911
|
+
cy.log("Enter too large an error in second number");
|
|
912
|
+
cy.get(mathinputAnchor).type(
|
|
913
|
+
"{ctrl+home}{shift+end}{backspace}10000 exp(7.0001x^2{rightarrow}/0.00003-sqrty",
|
|
914
|
+
{ force: true, delay: 5 },
|
|
915
|
+
);
|
|
916
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
917
|
+
cy.get(mathinputIncorrectAnchor).should("be.visible");
|
|
918
|
+
|
|
919
|
+
cy.window().then(async (win) => {
|
|
920
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
921
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
|
|
922
|
+
});
|
|
923
|
+
|
|
924
|
+
cy.log("Enter too large an error in third number");
|
|
925
|
+
cy.get(mathinputAnchor).type(
|
|
926
|
+
"{ctrl+home}{shift+end}{backspace}10000 exp(7x^2{rightarrow}/0.0000300005-sqrty",
|
|
927
|
+
{ force: true, delay: 5 },
|
|
928
|
+
);
|
|
929
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
930
|
+
cy.get(mathinputIncorrectAnchor).should("be.visible");
|
|
931
|
+
|
|
932
|
+
cy.window().then(async (win) => {
|
|
933
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
934
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
|
|
935
|
+
});
|
|
936
|
+
|
|
937
|
+
cy.log("partial credit error in each");
|
|
938
|
+
cy.get(mathinputAnchor).type(
|
|
939
|
+
"{ctrl+home}{shift+end}{backspace}9999.91 exp(7.00005x^2{rightarrow}/0.0000300002-sqrty",
|
|
940
|
+
{ force: true, delay: 5 },
|
|
941
|
+
);
|
|
942
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
943
|
+
cy.get(mathinputPartialAnchor).should("have.text", "60 %");
|
|
944
|
+
|
|
945
|
+
cy.window().then(async (win) => {
|
|
946
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
947
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).closeTo(
|
|
948
|
+
0.6,
|
|
949
|
+
1e-14,
|
|
950
|
+
);
|
|
951
|
+
});
|
|
952
|
+
|
|
953
|
+
cy.log("higher partial credit error in each");
|
|
954
|
+
cy.get(mathinputAnchor).type(
|
|
955
|
+
"{ctrl+home}{shift+end}{backspace}9999.991 exp(7.000005x^2{rightarrow}/0.00003000002-sqrty",
|
|
956
|
+
{ force: true, delay: 5 },
|
|
957
|
+
);
|
|
958
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
959
|
+
cy.get(mathinputPartialAnchor).should("have.text", "80 %");
|
|
960
|
+
|
|
961
|
+
cy.window().then(async (win) => {
|
|
962
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
963
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).closeTo(
|
|
964
|
+
0.8,
|
|
965
|
+
1e-14,
|
|
966
|
+
);
|
|
967
|
+
});
|
|
968
|
+
|
|
969
|
+
cy.log("acceptable error for full credit");
|
|
970
|
+
cy.get(mathinputAnchor).type(
|
|
971
|
+
"{ctrl+home}{shift+end}{backspace}9999.9991 exp(7.0000005x^2{rightarrow}/0.000030000002-sqrty",
|
|
972
|
+
{ force: true, delay: 5 },
|
|
973
|
+
);
|
|
974
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
975
|
+
cy.get(mathinputCorrectAnchor).should("be.visible");
|
|
976
|
+
|
|
977
|
+
cy.window().then(async (win) => {
|
|
978
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
979
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
|
|
980
|
+
});
|
|
981
|
+
});
|
|
982
|
+
});
|
|
983
|
+
|
|
984
|
+
it("symbolic, complicated expression with three numbers, absolute error", () => {
|
|
985
|
+
cy.window().then(async (win) => {
|
|
986
|
+
win.postMessage(
|
|
987
|
+
{
|
|
988
|
+
doenetML: `
|
|
989
|
+
<p>a</p>
|
|
990
|
+
<p><math simplify>10000 exp(7x^2/(0.00003-sqrt(y)))</math>
|
|
991
|
+
<answer>
|
|
992
|
+
<award symbolicequality="true" allowederrorinnumbers="0.0000001" allowederrorisabsolute simplifyOnCompare>
|
|
993
|
+
<copy target="_math1" />
|
|
994
|
+
</award>
|
|
995
|
+
<award symbolicequality="true" credit="0.8" allowederrorinnumbers="0.000001" allowederrorisabsolute simplifyOnCompare>
|
|
996
|
+
<copy target="_math1" />
|
|
997
|
+
</award>
|
|
998
|
+
<award symbolicequality="true" credit="0.6" allowederrorinnumbers="0.00001" allowederrorisabsolute simplifyOnCompare>
|
|
999
|
+
<copy target="_math1" />
|
|
1000
|
+
</award>
|
|
1001
|
+
</answer>
|
|
1002
|
+
</p>
|
|
1003
|
+
`,
|
|
1004
|
+
},
|
|
1005
|
+
"*",
|
|
1006
|
+
);
|
|
1007
|
+
});
|
|
1008
|
+
cy.get(cesc("#\\/_p1")).should("have.text", "a"); // to wait until loaded
|
|
1009
|
+
|
|
1010
|
+
cy.window().then(async (win) => {
|
|
1011
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1012
|
+
let mathinputName = cesc2(
|
|
1013
|
+
stateVariables["/_answer1"].stateValues.inputChildren[0].componentName,
|
|
1014
|
+
);
|
|
1015
|
+
let mathinputAnchor = "#" + mathinputName + " textarea";
|
|
1016
|
+
let mathinputSubmitAnchor = "#" + mathinputName + "_submit";
|
|
1017
|
+
let mathinputCorrectAnchor = "#" + mathinputName + "_correct";
|
|
1018
|
+
let mathinputPartialAnchor = "#" + mathinputName + "_partial";
|
|
1019
|
+
let mathinputIncorrectAnchor = "#" + mathinputName + "_incorrect";
|
|
1020
|
+
|
|
1021
|
+
cy.get(mathinputSubmitAnchor).should("be.visible");
|
|
1022
|
+
|
|
1023
|
+
cy.log("Submit exact answer");
|
|
1024
|
+
cy.get(mathinputAnchor).type(
|
|
1025
|
+
"10000 exp(7x^2{rightarrow}/0.00003-sqrty{enter}",
|
|
1026
|
+
{ force: true, delay: 5 },
|
|
1027
|
+
);
|
|
1028
|
+
cy.get(mathinputCorrectAnchor).should("be.visible");
|
|
1029
|
+
|
|
1030
|
+
cy.window().then(async (win) => {
|
|
1031
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1032
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
|
|
1033
|
+
});
|
|
1034
|
+
|
|
1035
|
+
cy.log("Enter too large an error in first number");
|
|
1036
|
+
cy.get(mathinputAnchor).type(
|
|
1037
|
+
"{ctrl+home}{shift+end}{backspace}9999.9999 exp(7x^2{rightarrow}/0.00003-sqrty",
|
|
1038
|
+
{ force: true, delay: 5 },
|
|
1039
|
+
);
|
|
1040
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
1041
|
+
cy.get(mathinputIncorrectAnchor).should("be.visible");
|
|
1042
|
+
|
|
1043
|
+
cy.window().then(async (win) => {
|
|
1044
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1045
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
|
|
1046
|
+
});
|
|
1047
|
+
|
|
1048
|
+
cy.log("Enter too large an error in second number");
|
|
1049
|
+
cy.get(mathinputAnchor).type(
|
|
1050
|
+
"{ctrl+home}{shift+end}{backspace}10000 exp(7.00002x^2{rightarrow}/0.00003-sqrty",
|
|
1051
|
+
{ force: true, delay: 5 },
|
|
1052
|
+
);
|
|
1053
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
1054
|
+
cy.get(mathinputIncorrectAnchor).should("be.visible");
|
|
1055
|
+
|
|
1056
|
+
cy.window().then(async (win) => {
|
|
1057
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1058
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
|
|
1059
|
+
});
|
|
1060
|
+
|
|
1061
|
+
cy.log("Enter too large an error in third number");
|
|
1062
|
+
cy.get(mathinputAnchor).type(
|
|
1063
|
+
"{ctrl+home}{shift+end}{backspace}10000 exp(7x^2{rightarrow}/0.00005-sqrty",
|
|
1064
|
+
{ force: true, delay: 5 },
|
|
1065
|
+
);
|
|
1066
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
1067
|
+
cy.get(mathinputIncorrectAnchor).should("be.visible");
|
|
1068
|
+
|
|
1069
|
+
cy.window().then(async (win) => {
|
|
1070
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1071
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
|
|
1072
|
+
});
|
|
1073
|
+
|
|
1074
|
+
cy.log("partial credit error in each");
|
|
1075
|
+
cy.get(mathinputAnchor).type(
|
|
1076
|
+
"{ctrl+home}{shift+end}{backspace}9999.999991 exp(7.000005x^2{rightarrow}/0.000032-sqrty",
|
|
1077
|
+
{ force: true, delay: 5 },
|
|
1078
|
+
);
|
|
1079
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
1080
|
+
cy.get(mathinputPartialAnchor).should("have.text", "60 %");
|
|
1081
|
+
|
|
1082
|
+
cy.window().then(async (win) => {
|
|
1083
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1084
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).closeTo(
|
|
1085
|
+
0.6,
|
|
1086
|
+
1e-14,
|
|
1087
|
+
);
|
|
1088
|
+
});
|
|
1089
|
+
|
|
1090
|
+
cy.log("higher partial credit error in each");
|
|
1091
|
+
cy.get(mathinputAnchor)
|
|
1092
|
+
.type(
|
|
1093
|
+
"{ctrl+home}{shift+end}{backspace}9999.9999991 exp(7.0000005x^2{rightarrow}/0.0000302-sqrty",
|
|
1094
|
+
{ force: true, delay: 5 },
|
|
1095
|
+
)
|
|
1096
|
+
.blur();
|
|
1097
|
+
|
|
1098
|
+
// wait for the value in the input to be rounded before submitting
|
|
1099
|
+
// so that the change doesn't occur after the submission
|
|
1100
|
+
// and make justSubmitted of the answer be false
|
|
1101
|
+
cy.get(`#${mathinputName} .mq-editable-field`).should(
|
|
1102
|
+
"not.contain.text",
|
|
1103
|
+
"9999.9999991",
|
|
1104
|
+
);
|
|
1105
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
1106
|
+
cy.get(mathinputPartialAnchor).should("have.text", "80 %");
|
|
1107
|
+
|
|
1108
|
+
cy.window().then(async (win) => {
|
|
1109
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1110
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).closeTo(
|
|
1111
|
+
0.8,
|
|
1112
|
+
1e-14,
|
|
1113
|
+
);
|
|
1114
|
+
});
|
|
1115
|
+
|
|
1116
|
+
cy.log("acceptable error for full credit");
|
|
1117
|
+
cy.get(mathinputAnchor).type(
|
|
1118
|
+
"{ctrl+home}{shift+end}{backspace}9999.99999991 exp(7.00000005x^2{rightarrow}/0.00003002-sqrty",
|
|
1119
|
+
{ force: true, delay: 5 },
|
|
1120
|
+
);
|
|
1121
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
1122
|
+
cy.get(mathinputCorrectAnchor).should("be.visible");
|
|
1123
|
+
|
|
1124
|
+
cy.window().then(async (win) => {
|
|
1125
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1126
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
|
|
1127
|
+
});
|
|
1128
|
+
});
|
|
1129
|
+
});
|
|
1130
|
+
|
|
1131
|
+
it("symbolic, don't ignore exponents", () => {
|
|
1132
|
+
cy.window().then(async (win) => {
|
|
1133
|
+
win.postMessage(
|
|
1134
|
+
{
|
|
1135
|
+
doenetML: `
|
|
1136
|
+
<p>a</p>
|
|
1137
|
+
<p><math simplify>10x^2-4</math>
|
|
1138
|
+
<answer>
|
|
1139
|
+
<award symbolicequality="true" allowederrorinnumbers="0.0001" simplifyOnCompare>
|
|
1140
|
+
<copy target="_math1" />
|
|
1141
|
+
</award>
|
|
1142
|
+
</answer>
|
|
1143
|
+
</p>
|
|
1144
|
+
|
|
1145
|
+
<p>Allow for error in exponents
|
|
1146
|
+
<answer>
|
|
1147
|
+
<award symbolicequality="true" allowederrorinnumbers="0.0001" includeerrorinnumberexponents simplifyOnCompare>
|
|
1148
|
+
<copy target="_math1" />
|
|
1149
|
+
</award>
|
|
1150
|
+
</answer>
|
|
1151
|
+
</p>
|
|
1152
|
+
`,
|
|
1153
|
+
},
|
|
1154
|
+
"*",
|
|
1155
|
+
);
|
|
1156
|
+
});
|
|
1157
|
+
cy.get(cesc("#\\/_p1")).should("have.text", "a"); // to wait until loaded
|
|
1158
|
+
|
|
1159
|
+
cy.window().then(async (win) => {
|
|
1160
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1161
|
+
let mathinputName = cesc2(
|
|
1162
|
+
stateVariables["/_answer1"].stateValues.inputChildren[0].componentName,
|
|
1163
|
+
);
|
|
1164
|
+
let mathinputAnchor = "#" + mathinputName + " textarea";
|
|
1165
|
+
let mathinputSubmitAnchor = "#" + mathinputName + "_submit";
|
|
1166
|
+
let mathinputCorrectAnchor = "#" + mathinputName + "_correct";
|
|
1167
|
+
let mathinputPartialAnchor = "#" + mathinputName + "_partial";
|
|
1168
|
+
let mathinputIncorrectAnchor = "#" + mathinputName + "_incorrect";
|
|
1169
|
+
|
|
1170
|
+
let mathinput2Name = cesc2(
|
|
1171
|
+
stateVariables["/_answer2"].stateValues.inputChildren[0].componentName,
|
|
1172
|
+
);
|
|
1173
|
+
let mathinput2Anchor = "#" + mathinput2Name + " textarea";
|
|
1174
|
+
let mathinput2SubmitAnchor = "#" + mathinput2Name + "_submit";
|
|
1175
|
+
let mathinput2CorrectAnchor = "#" + mathinput2Name + "_correct";
|
|
1176
|
+
let mathinput2PartialAnchor = "#" + mathinput2Name + "_partial";
|
|
1177
|
+
let mathinput2IncorrectAnchor = "#" + mathinput2Name + "_incorrect";
|
|
1178
|
+
|
|
1179
|
+
cy.get(mathinputSubmitAnchor).should("be.visible");
|
|
1180
|
+
cy.get(mathinput2SubmitAnchor).should("be.visible");
|
|
1181
|
+
|
|
1182
|
+
cy.log("Submit exact answer");
|
|
1183
|
+
cy.get(mathinputAnchor).type("10x^2{rightarrow}-4{enter}", {
|
|
1184
|
+
force: true,
|
|
1185
|
+
delay: 5,
|
|
1186
|
+
});
|
|
1187
|
+
cy.get(mathinputCorrectAnchor).should("be.visible");
|
|
1188
|
+
cy.get(mathinput2Anchor).type("10x^2{rightarrow}-4{enter}", {
|
|
1189
|
+
force: true,
|
|
1190
|
+
delay: 5,
|
|
1191
|
+
});
|
|
1192
|
+
cy.get(mathinput2CorrectAnchor).should("be.visible");
|
|
1193
|
+
|
|
1194
|
+
cy.window().then(async (win) => {
|
|
1195
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1196
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
|
|
1197
|
+
expect(stateVariables["/_answer2"].stateValues.creditAchieved).eq(1);
|
|
1198
|
+
});
|
|
1199
|
+
|
|
1200
|
+
cy.log("Enter too large an error in exponent");
|
|
1201
|
+
cy.get(mathinputAnchor).type(
|
|
1202
|
+
"{ctrl+home}{shift+end}{backspace}10x^2.0004{rightarrow}-4",
|
|
1203
|
+
{ force: true, delay: 5 },
|
|
1204
|
+
);
|
|
1205
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
1206
|
+
cy.get(mathinputIncorrectAnchor).should("be.visible");
|
|
1207
|
+
cy.get(mathinput2Anchor).type(
|
|
1208
|
+
"{ctrl+home}{shift+end}{backspace}10x^2.0004{rightarrow}-4",
|
|
1209
|
+
{ force: true, delay: 5 },
|
|
1210
|
+
);
|
|
1211
|
+
cy.get(mathinput2SubmitAnchor).click();
|
|
1212
|
+
cy.get(mathinput2IncorrectAnchor).should("be.visible");
|
|
1213
|
+
|
|
1214
|
+
cy.window().then(async (win) => {
|
|
1215
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1216
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
|
|
1217
|
+
expect(stateVariables["/_answer2"].stateValues.creditAchieved).eq(0);
|
|
1218
|
+
});
|
|
1219
|
+
|
|
1220
|
+
cy.log("Small error in exponent");
|
|
1221
|
+
cy.get(mathinputAnchor).type(
|
|
1222
|
+
"{ctrl+home}{shift+end}{backspace}10x^2.0001{rightarrow}-4",
|
|
1223
|
+
{ force: true, delay: 5 },
|
|
1224
|
+
);
|
|
1225
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
1226
|
+
cy.get(mathinputIncorrectAnchor).should("be.visible");
|
|
1227
|
+
cy.get(mathinput2Anchor).type(
|
|
1228
|
+
"{ctrl+home}{shift+end}{backspace}10x^2.0001{rightarrow}-4",
|
|
1229
|
+
{ force: true, delay: 5 },
|
|
1230
|
+
);
|
|
1231
|
+
cy.get(mathinput2SubmitAnchor).click();
|
|
1232
|
+
cy.get(mathinput2CorrectAnchor).should("be.visible");
|
|
1233
|
+
|
|
1234
|
+
cy.window().then(async (win) => {
|
|
1235
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1236
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
|
|
1237
|
+
expect(stateVariables["/_answer2"].stateValues.creditAchieved).eq(1);
|
|
1238
|
+
});
|
|
1239
|
+
|
|
1240
|
+
cy.log("Error in numbers not in exponents");
|
|
1241
|
+
cy.get(mathinputAnchor).type(
|
|
1242
|
+
"{ctrl+home}{shift+end}{backspace}10.0002x^2{rightarrow}-4.00008",
|
|
1243
|
+
{ force: true, delay: 5 },
|
|
1244
|
+
);
|
|
1245
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
1246
|
+
cy.get(mathinputCorrectAnchor).should("be.visible");
|
|
1247
|
+
cy.get(mathinput2Anchor).type(
|
|
1248
|
+
"{ctrl+home}{shift+end}{backspace}10.0002x^2{rightarrow}-4.00008",
|
|
1249
|
+
{ force: true, delay: 5 },
|
|
1250
|
+
);
|
|
1251
|
+
cy.get(mathinput2SubmitAnchor).click();
|
|
1252
|
+
cy.get(mathinput2CorrectAnchor).should("be.visible");
|
|
1253
|
+
|
|
1254
|
+
cy.window().then(async (win) => {
|
|
1255
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1256
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
|
|
1257
|
+
expect(stateVariables["/_answer2"].stateValues.creditAchieved).eq(1);
|
|
1258
|
+
});
|
|
1259
|
+
});
|
|
1260
|
+
});
|
|
1261
|
+
|
|
1262
|
+
it("symbolic, no simplification", () => {
|
|
1263
|
+
cy.window().then(async (win) => {
|
|
1264
|
+
win.postMessage(
|
|
1265
|
+
{
|
|
1266
|
+
doenetML: `
|
|
1267
|
+
<p>a</p>
|
|
1268
|
+
<p><math>2.15234262pi+e*25.602348230</math>
|
|
1269
|
+
<answer>
|
|
1270
|
+
<award symbolicequality="true" allowederrorinnumbers="0.001">
|
|
1271
|
+
<copy target="_math1" />
|
|
1272
|
+
</award>
|
|
1273
|
+
</answer>
|
|
1274
|
+
</p>
|
|
1275
|
+
`,
|
|
1276
|
+
},
|
|
1277
|
+
"*",
|
|
1278
|
+
);
|
|
1279
|
+
});
|
|
1280
|
+
cy.get(cesc("#\\/_p1")).should("have.text", "a"); // to wait until loaded
|
|
1281
|
+
|
|
1282
|
+
cy.window().then(async (win) => {
|
|
1283
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1284
|
+
let mathinputName = cesc2(
|
|
1285
|
+
stateVariables["/_answer1"].stateValues.inputChildren[0].componentName,
|
|
1286
|
+
);
|
|
1287
|
+
let mathinputAnchor = "#" + mathinputName + " textarea";
|
|
1288
|
+
let mathinputSubmitAnchor = "#" + mathinputName + "_submit";
|
|
1289
|
+
let mathinputCorrectAnchor = "#" + mathinputName + "_correct";
|
|
1290
|
+
let mathinputPartialAnchor = "#" + mathinputName + "_partial";
|
|
1291
|
+
let mathinputIncorrectAnchor = "#" + mathinputName + "_incorrect";
|
|
1292
|
+
|
|
1293
|
+
cy.get(mathinputSubmitAnchor).should("be.visible");
|
|
1294
|
+
|
|
1295
|
+
cy.log("Submit exact answer");
|
|
1296
|
+
cy.get(mathinputAnchor).type("2.15234262pi+e*25.602348230{enter}", {
|
|
1297
|
+
force: true,
|
|
1298
|
+
delay: 5,
|
|
1299
|
+
});
|
|
1300
|
+
cy.get(mathinputCorrectAnchor).should("be.visible");
|
|
1301
|
+
|
|
1302
|
+
cy.window().then(async (win) => {
|
|
1303
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1304
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
|
|
1305
|
+
});
|
|
1306
|
+
|
|
1307
|
+
cy.log("Reordering not allowed");
|
|
1308
|
+
cy.get(mathinputAnchor).type(
|
|
1309
|
+
"{ctrl+home}{shift+end}{backspace}pi2.15234262+e*25.602348230",
|
|
1310
|
+
{ force: true, delay: 5 },
|
|
1311
|
+
);
|
|
1312
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
1313
|
+
cy.get(mathinputIncorrectAnchor).should("be.visible");
|
|
1314
|
+
|
|
1315
|
+
cy.window().then(async (win) => {
|
|
1316
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1317
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
|
|
1318
|
+
});
|
|
1319
|
+
cy.get(mathinputAnchor).type(
|
|
1320
|
+
"{ctrl+home}{shift+end}{backspace}e*25.602348230+2.15234262pi",
|
|
1321
|
+
{ force: true, delay: 5 },
|
|
1322
|
+
);
|
|
1323
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
1324
|
+
cy.get(mathinputIncorrectAnchor).should("be.visible");
|
|
1325
|
+
|
|
1326
|
+
cy.window().then(async (win) => {
|
|
1327
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1328
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
|
|
1329
|
+
});
|
|
1330
|
+
|
|
1331
|
+
cy.log("Numeric evaluation not allowed");
|
|
1332
|
+
cy.get(mathinputAnchor).type(
|
|
1333
|
+
"{ctrl+home}{shift+end}{backspace}.35618172248981",
|
|
1334
|
+
{ force: true, delay: 5 },
|
|
1335
|
+
);
|
|
1336
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
1337
|
+
cy.get(mathinputIncorrectAnchor).should("be.visible");
|
|
1338
|
+
|
|
1339
|
+
cy.window().then(async (win) => {
|
|
1340
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1341
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
|
|
1342
|
+
});
|
|
1343
|
+
|
|
1344
|
+
cy.log("Round too much");
|
|
1345
|
+
cy.get(mathinputAnchor).type(
|
|
1346
|
+
"{ctrl+home}{shift+end}{backspace}2.15pi+e*25.602348230",
|
|
1347
|
+
{ force: true, delay: 5 },
|
|
1348
|
+
);
|
|
1349
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
1350
|
+
cy.get(mathinputIncorrectAnchor).should("be.visible");
|
|
1351
|
+
|
|
1352
|
+
cy.window().then(async (win) => {
|
|
1353
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1354
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
|
|
1355
|
+
});
|
|
1356
|
+
cy.get(mathinputAnchor).type(
|
|
1357
|
+
"{ctrl+home}{shift+end}{backspace}2.15234262pi+2.73*25.602348230",
|
|
1358
|
+
{ force: true, delay: 5 },
|
|
1359
|
+
);
|
|
1360
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
1361
|
+
cy.get(mathinputIncorrectAnchor).should("be.visible");
|
|
1362
|
+
|
|
1363
|
+
cy.window().then(async (win) => {
|
|
1364
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1365
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
|
|
1366
|
+
});
|
|
1367
|
+
|
|
1368
|
+
cy.log("acceptable rounding");
|
|
1369
|
+
cy.get(mathinputAnchor).type(
|
|
1370
|
+
"{ctrl+home}{shift+end}{backspace}2.152 3.142 + 2.718*25.6",
|
|
1371
|
+
{ force: true, delay: 5 },
|
|
1372
|
+
);
|
|
1373
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
1374
|
+
cy.get(mathinputCorrectAnchor).should("be.visible");
|
|
1375
|
+
|
|
1376
|
+
cy.window().then(async (win) => {
|
|
1377
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1378
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
|
|
1379
|
+
});
|
|
1380
|
+
});
|
|
1381
|
+
});
|
|
1382
|
+
|
|
1383
|
+
// TODO: currently failing. Need to investigate
|
|
1384
|
+
it.skip("symbolic, evaluate numbers, preserve order", () => {
|
|
1385
|
+
cy.window().then(async (win) => {
|
|
1386
|
+
win.postMessage(
|
|
1387
|
+
{
|
|
1388
|
+
doenetML: `
|
|
1389
|
+
<p>a</p>
|
|
1390
|
+
<p><math>sin(2pi+1x+4x+pi+6)</math>
|
|
1391
|
+
<answer>
|
|
1392
|
+
<award symbolicequality="true" allowederrorinnumbers="0.001" simplifyOnCompare="numbersPreserveOrder">
|
|
1393
|
+
<copy target="_math1" />
|
|
1394
|
+
</award>
|
|
1395
|
+
</answer>
|
|
1396
|
+
</p>
|
|
1397
|
+
`,
|
|
1398
|
+
},
|
|
1399
|
+
"*",
|
|
1400
|
+
);
|
|
1401
|
+
});
|
|
1402
|
+
cy.get(cesc("#\\/_p1")).should("have.text", "a"); // to wait until loaded
|
|
1403
|
+
|
|
1404
|
+
cy.window().then(async (win) => {
|
|
1405
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1406
|
+
let mathinputName = cesc2(
|
|
1407
|
+
stateVariables["/_answer1"].stateValues.inputChildren[0].componentName,
|
|
1408
|
+
);
|
|
1409
|
+
let mathinputAnchor = "#" + mathinputName + " textarea";
|
|
1410
|
+
let mathinputSubmitAnchor = "#" + mathinputName + "_submit";
|
|
1411
|
+
let mathinputCorrectAnchor = "#" + mathinputName + "_correct";
|
|
1412
|
+
let mathinputPartialAnchor = "#" + mathinputName + "_partial";
|
|
1413
|
+
let mathinputIncorrectAnchor = "#" + mathinputName + "_incorrect";
|
|
1414
|
+
|
|
1415
|
+
cy.get(mathinputSubmitAnchor).should("be.visible");
|
|
1416
|
+
|
|
1417
|
+
cy.log("Submit exact answer");
|
|
1418
|
+
cy.get(mathinputAnchor).type("sin(2pi+1x+4x+pi+6){enter}", {
|
|
1419
|
+
force: true,
|
|
1420
|
+
delay: 5,
|
|
1421
|
+
});
|
|
1422
|
+
cy.get(mathinputCorrectAnchor).should("be.visible");
|
|
1423
|
+
|
|
1424
|
+
cy.window().then(async (win) => {
|
|
1425
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1426
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
|
|
1427
|
+
});
|
|
1428
|
+
|
|
1429
|
+
cy.log("Reordering not allowed");
|
|
1430
|
+
cy.get(mathinputAnchor).type(
|
|
1431
|
+
"{ctrl+home}{shift+end}{backspace}sin(2pi+pi+1x+4x+6)",
|
|
1432
|
+
{ force: true, delay: 5 },
|
|
1433
|
+
);
|
|
1434
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
1435
|
+
cy.get(mathinputIncorrectAnchor).should("be.visible");
|
|
1436
|
+
|
|
1437
|
+
cy.window().then(async (win) => {
|
|
1438
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1439
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
|
|
1440
|
+
});
|
|
1441
|
+
|
|
1442
|
+
cy.log("Combining terms not allowed");
|
|
1443
|
+
cy.get(mathinputAnchor).type(
|
|
1444
|
+
"{ctrl+home}{shift+end}{backspace}sin(2pi+5x+pi+6)",
|
|
1445
|
+
{ force: true, delay: 5 },
|
|
1446
|
+
);
|
|
1447
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
1448
|
+
cy.get(mathinputIncorrectAnchor).should("be.visible");
|
|
1449
|
+
|
|
1450
|
+
cy.window().then(async (win) => {
|
|
1451
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1452
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
|
|
1453
|
+
});
|
|
1454
|
+
|
|
1455
|
+
cy.log("Numeric evaluation OK");
|
|
1456
|
+
cy.get(mathinputAnchor).type(
|
|
1457
|
+
"{ctrl+home}{shift+end}{backspace}sin(6.28318+x+4x+9.14159)",
|
|
1458
|
+
{ force: true, delay: 5 },
|
|
1459
|
+
);
|
|
1460
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
1461
|
+
cy.get(mathinputCorrectAnchor).should("be.visible");
|
|
1462
|
+
|
|
1463
|
+
cy.window().then(async (win) => {
|
|
1464
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1465
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
|
|
1466
|
+
});
|
|
1467
|
+
|
|
1468
|
+
cy.log("Round too much");
|
|
1469
|
+
cy.get(mathinputAnchor).type(
|
|
1470
|
+
"{ctrl+home}{shift+end}{backspace}sin(6.28318+x+4x+9.14",
|
|
1471
|
+
{ force: true, delay: 5 },
|
|
1472
|
+
);
|
|
1473
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
1474
|
+
cy.get(mathinputIncorrectAnchor).should("be.visible");
|
|
1475
|
+
|
|
1476
|
+
cy.window().then(async (win) => {
|
|
1477
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1478
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
|
|
1479
|
+
});
|
|
1480
|
+
cy.get(mathinputAnchor).type(
|
|
1481
|
+
"{ctrl+home}{shift+end}{backspace}6.28+x+4x+9.14159",
|
|
1482
|
+
{ force: true, delay: 5 },
|
|
1483
|
+
);
|
|
1484
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
1485
|
+
cy.get(mathinputIncorrectAnchor).should("be.visible");
|
|
1486
|
+
|
|
1487
|
+
cy.window().then(async (win) => {
|
|
1488
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1489
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
|
|
1490
|
+
});
|
|
1491
|
+
});
|
|
1492
|
+
});
|
|
1493
|
+
|
|
1494
|
+
it("symbolic, evaluate numbers", () => {
|
|
1495
|
+
cy.window().then(async (win) => {
|
|
1496
|
+
win.postMessage(
|
|
1497
|
+
{
|
|
1498
|
+
doenetML: `
|
|
1499
|
+
<p>a</p>
|
|
1500
|
+
<p><math>sin(2pi+1x+4x+pi+6)</math>
|
|
1501
|
+
<answer>
|
|
1502
|
+
<award symbolicequality="true" allowederrorinnumbers="0.001" simplifyOnCompare="numbers">
|
|
1503
|
+
<copy target="_math1" />
|
|
1504
|
+
</award>
|
|
1505
|
+
</answer>
|
|
1506
|
+
</p>
|
|
1507
|
+
`,
|
|
1508
|
+
},
|
|
1509
|
+
"*",
|
|
1510
|
+
);
|
|
1511
|
+
});
|
|
1512
|
+
cy.get(cesc("#\\/_p1")).should("have.text", "a"); // to wait until loaded
|
|
1513
|
+
|
|
1514
|
+
cy.window().then(async (win) => {
|
|
1515
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1516
|
+
let mathinputName = cesc2(
|
|
1517
|
+
stateVariables["/_answer1"].stateValues.inputChildren[0].componentName,
|
|
1518
|
+
);
|
|
1519
|
+
let mathinputAnchor = "#" + mathinputName + " textarea";
|
|
1520
|
+
let mathinputSubmitAnchor = "#" + mathinputName + "_submit";
|
|
1521
|
+
let mathinputCorrectAnchor = "#" + mathinputName + "_correct";
|
|
1522
|
+
let mathinputPartialAnchor = "#" + mathinputName + "_partial";
|
|
1523
|
+
let mathinputIncorrectAnchor = "#" + mathinputName + "_incorrect";
|
|
1524
|
+
|
|
1525
|
+
cy.get(mathinputSubmitAnchor).should("be.visible");
|
|
1526
|
+
|
|
1527
|
+
cy.log("Submit exact answer");
|
|
1528
|
+
cy.get(mathinputAnchor).type("sin(2pi+1x+4x+pi+6){enter}", {
|
|
1529
|
+
force: true,
|
|
1530
|
+
delay: 5,
|
|
1531
|
+
});
|
|
1532
|
+
cy.get(mathinputCorrectAnchor).should("be.visible");
|
|
1533
|
+
|
|
1534
|
+
cy.window().then(async (win) => {
|
|
1535
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1536
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
|
|
1537
|
+
});
|
|
1538
|
+
|
|
1539
|
+
cy.log("Reordering allowed");
|
|
1540
|
+
cy.get(mathinputAnchor).type(
|
|
1541
|
+
"{ctrl+home}{shift+end}{backspace}sin(2pi+pi+1x+4x+6)",
|
|
1542
|
+
{ force: true, delay: 5 },
|
|
1543
|
+
);
|
|
1544
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
1545
|
+
cy.get(mathinputCorrectAnchor).should("be.visible");
|
|
1546
|
+
|
|
1547
|
+
cy.window().then(async (win) => {
|
|
1548
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1549
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
|
|
1550
|
+
});
|
|
1551
|
+
|
|
1552
|
+
cy.log("Combining terms not allowed");
|
|
1553
|
+
cy.get(mathinputAnchor).type(
|
|
1554
|
+
"{ctrl+home}{shift+end}{backspace}sin(2pi+5x+pi+6)",
|
|
1555
|
+
{ force: true, delay: 5 },
|
|
1556
|
+
);
|
|
1557
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
1558
|
+
cy.get(mathinputIncorrectAnchor).should("be.visible");
|
|
1559
|
+
|
|
1560
|
+
cy.window().then(async (win) => {
|
|
1561
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1562
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
|
|
1563
|
+
});
|
|
1564
|
+
|
|
1565
|
+
cy.log("Numeric evaluation OK");
|
|
1566
|
+
cy.get(mathinputAnchor).type(
|
|
1567
|
+
"{ctrl+home}{shift+end}{backspace}sin(6.28318+x+4x+9.14159)",
|
|
1568
|
+
{ force: true, delay: 5 },
|
|
1569
|
+
);
|
|
1570
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
1571
|
+
cy.get(mathinputCorrectAnchor).should("be.visible");
|
|
1572
|
+
|
|
1573
|
+
cy.window().then(async (win) => {
|
|
1574
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1575
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
|
|
1576
|
+
});
|
|
1577
|
+
|
|
1578
|
+
cy.get(mathinputAnchor).type(
|
|
1579
|
+
"{ctrl+home}{shift+end}{backspace}sin(x+15.42478+4x)",
|
|
1580
|
+
{ force: true, delay: 5 },
|
|
1581
|
+
);
|
|
1582
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
1583
|
+
cy.get(mathinputCorrectAnchor).should("be.visible");
|
|
1584
|
+
|
|
1585
|
+
cy.window().then(async (win) => {
|
|
1586
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1587
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
|
|
1588
|
+
});
|
|
1589
|
+
|
|
1590
|
+
cy.log("Round too much");
|
|
1591
|
+
cy.get(mathinputAnchor).type(
|
|
1592
|
+
"{ctrl+home}{shift+end}{backspace}sin(x+15.4+4x)",
|
|
1593
|
+
{ force: true, delay: 5 },
|
|
1594
|
+
);
|
|
1595
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
1596
|
+
cy.get(mathinputIncorrectAnchor).should("be.visible");
|
|
1597
|
+
|
|
1598
|
+
cy.window().then(async (win) => {
|
|
1599
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1600
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
|
|
1601
|
+
});
|
|
1602
|
+
});
|
|
1603
|
+
});
|
|
1604
|
+
|
|
1605
|
+
it("symbolic, full simplification", () => {
|
|
1606
|
+
cy.window().then(async (win) => {
|
|
1607
|
+
win.postMessage(
|
|
1608
|
+
{
|
|
1609
|
+
doenetML: `
|
|
1610
|
+
<p>a</p>
|
|
1611
|
+
<p><math>sin(2pi+1x+4x+pi+6)</math>
|
|
1612
|
+
<answer>
|
|
1613
|
+
<award symbolicequality="true" allowederrorinnumbers="0.001" simplifyOnCompare="full">
|
|
1614
|
+
<copy target="_math1" />
|
|
1615
|
+
</award>
|
|
1616
|
+
</answer>
|
|
1617
|
+
</p>
|
|
1618
|
+
`,
|
|
1619
|
+
},
|
|
1620
|
+
"*",
|
|
1621
|
+
);
|
|
1622
|
+
});
|
|
1623
|
+
cy.get(cesc("#\\/_p1")).should("have.text", "a"); // to wait until loaded
|
|
1624
|
+
|
|
1625
|
+
cy.window().then(async (win) => {
|
|
1626
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1627
|
+
let mathinputName = cesc2(
|
|
1628
|
+
stateVariables["/_answer1"].stateValues.inputChildren[0].componentName,
|
|
1629
|
+
);
|
|
1630
|
+
let mathinputAnchor = "#" + mathinputName + " textarea";
|
|
1631
|
+
let mathinputSubmitAnchor = "#" + mathinputName + "_submit";
|
|
1632
|
+
let mathinputCorrectAnchor = "#" + mathinputName + "_correct";
|
|
1633
|
+
let mathinputPartialAnchor = "#" + mathinputName + "_partial";
|
|
1634
|
+
let mathinputIncorrectAnchor = "#" + mathinputName + "_incorrect";
|
|
1635
|
+
|
|
1636
|
+
cy.get(mathinputSubmitAnchor).should("be.visible");
|
|
1637
|
+
|
|
1638
|
+
cy.log("Submit exact answer");
|
|
1639
|
+
cy.get(mathinputAnchor).type("sin(2pi+1x+4x+pi+6){enter}", {
|
|
1640
|
+
force: true,
|
|
1641
|
+
delay: 5,
|
|
1642
|
+
});
|
|
1643
|
+
cy.get(mathinputCorrectAnchor).should("be.visible");
|
|
1644
|
+
|
|
1645
|
+
cy.window().then(async (win) => {
|
|
1646
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1647
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
|
|
1648
|
+
});
|
|
1649
|
+
|
|
1650
|
+
cy.log("Reordering allowed");
|
|
1651
|
+
cy.get(mathinputAnchor).type(
|
|
1652
|
+
"{ctrl+home}{shift+end}{backspace}sin(2pi+pi+1x+4x+6)",
|
|
1653
|
+
{ force: true, delay: 5 },
|
|
1654
|
+
);
|
|
1655
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
1656
|
+
cy.get(mathinputCorrectAnchor).should("be.visible");
|
|
1657
|
+
|
|
1658
|
+
cy.window().then(async (win) => {
|
|
1659
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1660
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
|
|
1661
|
+
});
|
|
1662
|
+
|
|
1663
|
+
cy.log("Combining terms allowed");
|
|
1664
|
+
cy.get(mathinputAnchor).type(
|
|
1665
|
+
"{ctrl+home}{shift+end}{backspace}sin(2pi+5x+pi+6)",
|
|
1666
|
+
{ force: true, delay: 5 },
|
|
1667
|
+
);
|
|
1668
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
1669
|
+
cy.get(mathinputCorrectAnchor).should("be.visible");
|
|
1670
|
+
|
|
1671
|
+
cy.window().then(async (win) => {
|
|
1672
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1673
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
|
|
1674
|
+
});
|
|
1675
|
+
|
|
1676
|
+
cy.log("Numeric evaluation OK");
|
|
1677
|
+
cy.get(mathinputAnchor).type(
|
|
1678
|
+
"{ctrl+home}{shift+end}{backspace}sin(6.28318+x+4x+9.14159)",
|
|
1679
|
+
{ force: true, delay: 5 },
|
|
1680
|
+
);
|
|
1681
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
1682
|
+
cy.get(mathinputCorrectAnchor).should("be.visible");
|
|
1683
|
+
|
|
1684
|
+
cy.window().then(async (win) => {
|
|
1685
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1686
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
|
|
1687
|
+
});
|
|
1688
|
+
|
|
1689
|
+
cy.get(mathinputAnchor).type(
|
|
1690
|
+
"{ctrl+home}{shift+end}{backspace}sin(15.42478+5x)",
|
|
1691
|
+
{ force: true, delay: 5 },
|
|
1692
|
+
);
|
|
1693
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
1694
|
+
cy.get(mathinputCorrectAnchor).should("be.visible");
|
|
1695
|
+
|
|
1696
|
+
cy.window().then(async (win) => {
|
|
1697
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1698
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
|
|
1699
|
+
});
|
|
1700
|
+
|
|
1701
|
+
cy.log("Round too much");
|
|
1702
|
+
cy.get(mathinputAnchor).type(
|
|
1703
|
+
"{ctrl+home}{shift+end}{backspace}sin(15.4+5x)",
|
|
1704
|
+
{ force: true, delay: 5 },
|
|
1705
|
+
);
|
|
1706
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
1707
|
+
cy.get(mathinputIncorrectAnchor).should("be.visible");
|
|
1708
|
+
|
|
1709
|
+
cy.window().then(async (win) => {
|
|
1710
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1711
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0);
|
|
1712
|
+
});
|
|
1713
|
+
});
|
|
1714
|
+
});
|
|
1715
|
+
|
|
1716
|
+
it("expression with vector, matchPartial", () => {
|
|
1717
|
+
cy.window().then(async (win) => {
|
|
1718
|
+
win.postMessage(
|
|
1719
|
+
{
|
|
1720
|
+
doenetML: `
|
|
1721
|
+
<p>a</p>
|
|
1722
|
+
<p><math>(log(32x+c), 42)</math>
|
|
1723
|
+
<answer matchPartial>
|
|
1724
|
+
<award allowederrorinnumbers="0.001">
|
|
1725
|
+
<copy target="_math1" />
|
|
1726
|
+
</award>
|
|
1727
|
+
</answer>
|
|
1728
|
+
</p>
|
|
1729
|
+
`,
|
|
1730
|
+
},
|
|
1731
|
+
"*",
|
|
1732
|
+
);
|
|
1733
|
+
});
|
|
1734
|
+
cy.get(cesc("#\\/_p1")).should("have.text", "a"); // to wait until loaded
|
|
1735
|
+
|
|
1736
|
+
cy.window().then(async (win) => {
|
|
1737
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1738
|
+
let mathinputName = cesc2(
|
|
1739
|
+
stateVariables["/_answer1"].stateValues.inputChildren[0].componentName,
|
|
1740
|
+
);
|
|
1741
|
+
let mathinputAnchor = "#" + mathinputName + " textarea";
|
|
1742
|
+
let mathinputSubmitAnchor = "#" + mathinputName + "_submit";
|
|
1743
|
+
let mathinputCorrectAnchor = "#" + mathinputName + "_correct";
|
|
1744
|
+
let mathinputPartialAnchor = "#" + mathinputName + "_partial";
|
|
1745
|
+
let mathinputIncorrectAnchor = "#" + mathinputName + "_incorrect";
|
|
1746
|
+
|
|
1747
|
+
cy.get(mathinputSubmitAnchor).should("be.visible");
|
|
1748
|
+
|
|
1749
|
+
cy.log("Submit exact answer");
|
|
1750
|
+
cy.get(mathinputAnchor).type("(log(32x+c), 42){enter}", {
|
|
1751
|
+
force: true,
|
|
1752
|
+
delay: 5,
|
|
1753
|
+
});
|
|
1754
|
+
cy.get(mathinputCorrectAnchor).should("be.visible");
|
|
1755
|
+
|
|
1756
|
+
cy.window().then(async (win) => {
|
|
1757
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1758
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
|
|
1759
|
+
});
|
|
1760
|
+
|
|
1761
|
+
cy.log("Enter too large an error in first component");
|
|
1762
|
+
cy.get(mathinputAnchor).type(
|
|
1763
|
+
"{ctrl+home}{shift+end}{backspace}(log(32.04x+c), 42)",
|
|
1764
|
+
{ force: true, delay: 5 },
|
|
1765
|
+
);
|
|
1766
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
1767
|
+
cy.get(mathinputPartialAnchor).should("have.text", "50 %");
|
|
1768
|
+
|
|
1769
|
+
cy.window().then(async (win) => {
|
|
1770
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1771
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
|
|
1772
|
+
});
|
|
1773
|
+
|
|
1774
|
+
cy.log("Enter too large an error in second component");
|
|
1775
|
+
cy.get(mathinputAnchor).type("{end}{leftArrow}.3", {
|
|
1776
|
+
force: true,
|
|
1777
|
+
delay: 5,
|
|
1778
|
+
});
|
|
1779
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
1780
|
+
cy.get(mathinputIncorrectAnchor).should("be.visible");
|
|
1781
|
+
|
|
1782
|
+
cy.window().then(async (win) => {
|
|
1783
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1784
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.0);
|
|
1785
|
+
});
|
|
1786
|
+
|
|
1787
|
+
cy.log("shink error in first component");
|
|
1788
|
+
cy.get(mathinputAnchor).type(
|
|
1789
|
+
"{ctrl+home}{shift+end}{backspace}(log(32.01x+c), 42.3)",
|
|
1790
|
+
{ force: true, delay: 5 },
|
|
1791
|
+
);
|
|
1792
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
1793
|
+
cy.get(mathinputPartialAnchor).should("have.text", "50 %");
|
|
1794
|
+
|
|
1795
|
+
cy.window().then(async (win) => {
|
|
1796
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1797
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).closeTo(
|
|
1798
|
+
0.5,
|
|
1799
|
+
1e-14,
|
|
1800
|
+
);
|
|
1801
|
+
});
|
|
1802
|
+
|
|
1803
|
+
cy.log("Shrink error in second component");
|
|
1804
|
+
cy.get(mathinputAnchor).type("{end}{leftArrow}{leftArrow}0", {
|
|
1805
|
+
force: true,
|
|
1806
|
+
delay: 5,
|
|
1807
|
+
});
|
|
1808
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
1809
|
+
cy.get(mathinputCorrectAnchor).should("be.visible");
|
|
1810
|
+
|
|
1811
|
+
cy.window().then(async (win) => {
|
|
1812
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1813
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1.0);
|
|
1814
|
+
});
|
|
1815
|
+
});
|
|
1816
|
+
});
|
|
1817
|
+
|
|
1818
|
+
it("expression with vector, matchPartial, unordered", () => {
|
|
1819
|
+
cy.window().then(async (win) => {
|
|
1820
|
+
win.postMessage(
|
|
1821
|
+
{
|
|
1822
|
+
doenetML: `
|
|
1823
|
+
<p>a</p>
|
|
1824
|
+
<p><math unordered>(42, log(32x+c))</math>
|
|
1825
|
+
<answer matchPartial>
|
|
1826
|
+
<award allowederrorinnumbers="0.001">
|
|
1827
|
+
<copy target="_math1" />
|
|
1828
|
+
</award>
|
|
1829
|
+
</answer>
|
|
1830
|
+
</p>
|
|
1831
|
+
`,
|
|
1832
|
+
},
|
|
1833
|
+
"*",
|
|
1834
|
+
);
|
|
1835
|
+
});
|
|
1836
|
+
cy.get(cesc("#\\/_p1")).should("have.text", "a"); // to wait until loaded
|
|
1837
|
+
|
|
1838
|
+
cy.window().then(async (win) => {
|
|
1839
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1840
|
+
let mathinputName = cesc2(
|
|
1841
|
+
stateVariables["/_answer1"].stateValues.inputChildren[0].componentName,
|
|
1842
|
+
);
|
|
1843
|
+
let mathinputAnchor = "#" + mathinputName + " textarea";
|
|
1844
|
+
let mathinputSubmitAnchor = "#" + mathinputName + "_submit";
|
|
1845
|
+
let mathinputCorrectAnchor = "#" + mathinputName + "_correct";
|
|
1846
|
+
let mathinputPartialAnchor = "#" + mathinputName + "_partial";
|
|
1847
|
+
let mathinputIncorrectAnchor = "#" + mathinputName + "_incorrect";
|
|
1848
|
+
|
|
1849
|
+
cy.get(mathinputSubmitAnchor).should("be.visible");
|
|
1850
|
+
|
|
1851
|
+
cy.log("Submit exact answer");
|
|
1852
|
+
cy.get(mathinputAnchor).type("(log(32x+c), 42){enter}", {
|
|
1853
|
+
force: true,
|
|
1854
|
+
delay: 5,
|
|
1855
|
+
});
|
|
1856
|
+
cy.get(mathinputCorrectAnchor).should("be.visible");
|
|
1857
|
+
|
|
1858
|
+
cy.window().then(async (win) => {
|
|
1859
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1860
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1);
|
|
1861
|
+
});
|
|
1862
|
+
|
|
1863
|
+
cy.log("Enter too large an error in first component");
|
|
1864
|
+
cy.get(mathinputAnchor).type(
|
|
1865
|
+
"{ctrl+home}{shift+end}{backspace}(log(32.04x+c), 42)",
|
|
1866
|
+
{ force: true, delay: 5 },
|
|
1867
|
+
);
|
|
1868
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
1869
|
+
cy.get(mathinputPartialAnchor).should("have.text", "50 %");
|
|
1870
|
+
|
|
1871
|
+
cy.window().then(async (win) => {
|
|
1872
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1873
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.5);
|
|
1874
|
+
});
|
|
1875
|
+
|
|
1876
|
+
cy.log("Enter too large an error in second component");
|
|
1877
|
+
cy.get(mathinputAnchor).type("{end}{leftArrow}.3", {
|
|
1878
|
+
force: true,
|
|
1879
|
+
delay: 5,
|
|
1880
|
+
});
|
|
1881
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
1882
|
+
cy.get(mathinputIncorrectAnchor).should("be.visible");
|
|
1883
|
+
|
|
1884
|
+
cy.window().then(async (win) => {
|
|
1885
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1886
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(0.0);
|
|
1887
|
+
});
|
|
1888
|
+
|
|
1889
|
+
cy.log("shink error in first component");
|
|
1890
|
+
cy.get(mathinputAnchor).type(
|
|
1891
|
+
"{ctrl+home}{shift+end}{backspace}(log(32.01x+c), 42.3)",
|
|
1892
|
+
{ force: true, delay: 5 },
|
|
1893
|
+
);
|
|
1894
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
1895
|
+
cy.get(mathinputPartialAnchor).should("have.text", "50 %");
|
|
1896
|
+
|
|
1897
|
+
cy.window().then(async (win) => {
|
|
1898
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1899
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).closeTo(
|
|
1900
|
+
0.5,
|
|
1901
|
+
1e-14,
|
|
1902
|
+
);
|
|
1903
|
+
});
|
|
1904
|
+
|
|
1905
|
+
cy.log("Shrink error in second component");
|
|
1906
|
+
cy.get(mathinputAnchor).type("{end}{leftArrow}{leftArrow}0", {
|
|
1907
|
+
force: true,
|
|
1908
|
+
delay: 5,
|
|
1909
|
+
});
|
|
1910
|
+
cy.get(mathinputSubmitAnchor).click();
|
|
1911
|
+
cy.get(mathinputCorrectAnchor).should("be.visible");
|
|
1912
|
+
|
|
1913
|
+
cy.window().then(async (win) => {
|
|
1914
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1915
|
+
expect(stateVariables["/_answer1"].stateValues.creditAchieved).eq(1.0);
|
|
1916
|
+
});
|
|
1917
|
+
});
|
|
1918
|
+
});
|
|
1919
|
+
|
|
1920
|
+
it("expression with math lists, matchPartial", () => {
|
|
1921
|
+
cy.window().then(async (win) => {
|
|
1922
|
+
win.postMessage(
|
|
1923
|
+
{
|
|
1924
|
+
doenetML: `
|
|
1925
|
+
<p>a</p>
|
|
1926
|
+
<p><mathlist name="ml">log(32x+c) 42</mathlist>
|
|
1927
|
+
<answer name="ans" matchPartial allowederrorinnumbers="0.001">
|
|
1928
|
+
<mathinput name="mi1" />
|
|
1929
|
+
<mathinput name="mi2" />
|
|
1930
|
+
<award>
|
|
1931
|
+
<when><mathlist>$mi1 $mi2</mathlist> = $ml</when>
|
|
1932
|
+
</award>
|
|
1933
|
+
</answer>
|
|
1934
|
+
</p>
|
|
1935
|
+
`,
|
|
1936
|
+
},
|
|
1937
|
+
"*",
|
|
1938
|
+
);
|
|
1939
|
+
});
|
|
1940
|
+
cy.get(cesc("#\\/_p1")).should("have.text", "a"); // to wait until loaded
|
|
1941
|
+
|
|
1942
|
+
cy.get(cesc("#\\/ans_submit")).should("be.visible");
|
|
1943
|
+
|
|
1944
|
+
cy.log("Submit exact answer");
|
|
1945
|
+
cy.get(cesc("#\\/mi1") + " textarea").type("log(32x+c)", {
|
|
1946
|
+
force: true,
|
|
1947
|
+
delay: 5,
|
|
1948
|
+
});
|
|
1949
|
+
cy.get(cesc("#\\/mi2") + " textarea").type("42", { force: true, delay: 5 });
|
|
1950
|
+
|
|
1951
|
+
cy.get(cesc("#\\/ans_submit")).click();
|
|
1952
|
+
cy.get(cesc("#\\/ans_correct")).should("be.visible");
|
|
1953
|
+
|
|
1954
|
+
cy.window().then(async (win) => {
|
|
1955
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1956
|
+
expect(stateVariables["/ans"].stateValues.creditAchieved).eq(1);
|
|
1957
|
+
});
|
|
1958
|
+
|
|
1959
|
+
cy.log("Enter too large an error in first component");
|
|
1960
|
+
cy.get(cesc("#\\/mi1") + " textarea").type(
|
|
1961
|
+
"{ctrl+home}{shift+end}{backspace}log(32.04x+c)",
|
|
1962
|
+
{ force: true, delay: 5 },
|
|
1963
|
+
);
|
|
1964
|
+
cy.get(cesc("#\\/ans_submit")).click();
|
|
1965
|
+
cy.get(cesc("#\\/ans_partial"))
|
|
1966
|
+
.invoke("text")
|
|
1967
|
+
.then((text) => {
|
|
1968
|
+
expect(text.trim().toLowerCase()).equal("50% correct");
|
|
1969
|
+
});
|
|
1970
|
+
|
|
1971
|
+
cy.window().then(async (win) => {
|
|
1972
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1973
|
+
expect(stateVariables["/ans"].stateValues.creditAchieved).eq(0.5);
|
|
1974
|
+
});
|
|
1975
|
+
|
|
1976
|
+
cy.log("Enter too large an error in second component");
|
|
1977
|
+
cy.get(cesc("#\\/mi2") + " textarea").type("{end}.3{enter}", {
|
|
1978
|
+
force: true,
|
|
1979
|
+
delay: 5,
|
|
1980
|
+
});
|
|
1981
|
+
cy.get(cesc("#\\/ans_submit")).click();
|
|
1982
|
+
cy.get(cesc("#\\/ans_incorrect")).should("be.visible");
|
|
1983
|
+
|
|
1984
|
+
cy.window().then(async (win) => {
|
|
1985
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
1986
|
+
expect(stateVariables["/ans"].stateValues.creditAchieved).eq(0.0);
|
|
1987
|
+
});
|
|
1988
|
+
|
|
1989
|
+
cy.log("shink error in first component");
|
|
1990
|
+
cy.get(cesc("#\\/mi1") + " textarea").type(
|
|
1991
|
+
"{ctrl+home}{shift+end}{backspace}log(32.01x+c)",
|
|
1992
|
+
{ force: true, delay: 5 },
|
|
1993
|
+
);
|
|
1994
|
+
cy.get(cesc("#\\/ans_submit")).click();
|
|
1995
|
+
cy.get(cesc("#\\/ans_partial"))
|
|
1996
|
+
.invoke("text")
|
|
1997
|
+
.then((text) => {
|
|
1998
|
+
expect(text.trim().toLowerCase()).equal("50% correct");
|
|
1999
|
+
});
|
|
2000
|
+
|
|
2001
|
+
cy.window().then(async (win) => {
|
|
2002
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
2003
|
+
expect(stateVariables["/ans"].stateValues.creditAchieved).closeTo(
|
|
2004
|
+
0.5,
|
|
2005
|
+
1e-14,
|
|
2006
|
+
);
|
|
2007
|
+
});
|
|
2008
|
+
|
|
2009
|
+
cy.log("Shrink error in second component");
|
|
2010
|
+
cy.get(cesc("#\\/mi2") + " textarea").type("{end}{leftArrow}0", {
|
|
2011
|
+
force: true,
|
|
2012
|
+
delay: 5,
|
|
2013
|
+
});
|
|
2014
|
+
cy.get(cesc("#\\/ans_submit")).click();
|
|
2015
|
+
cy.get(cesc("#\\/ans_correct")).should("be.visible");
|
|
2016
|
+
|
|
2017
|
+
cy.window().then(async (win) => {
|
|
2018
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
2019
|
+
expect(stateVariables["/ans"].stateValues.creditAchieved).eq(1.0);
|
|
2020
|
+
});
|
|
2021
|
+
});
|
|
2022
|
+
|
|
2023
|
+
it("expression with math lists, matchPartial, unordered", () => {
|
|
2024
|
+
cy.window().then(async (win) => {
|
|
2025
|
+
win.postMessage(
|
|
2026
|
+
{
|
|
2027
|
+
doenetML: `
|
|
2028
|
+
<p>a</p>
|
|
2029
|
+
<p><mathlist name="ml" unordered>42 log(32x+c)</mathlist>
|
|
2030
|
+
<answer name="ans" matchPartial allowederrorinnumbers="0.001">
|
|
2031
|
+
<mathinput name="mi1" />
|
|
2032
|
+
<mathinput name="mi2" />
|
|
2033
|
+
<award>
|
|
2034
|
+
<when><mathlist>$mi1 $mi2</mathlist> = $ml</when>
|
|
2035
|
+
</award>
|
|
2036
|
+
</answer>
|
|
2037
|
+
</p>
|
|
2038
|
+
`,
|
|
2039
|
+
},
|
|
2040
|
+
"*",
|
|
2041
|
+
);
|
|
2042
|
+
});
|
|
2043
|
+
cy.get(cesc("#\\/_p1")).should("have.text", "a"); // to wait until loaded
|
|
2044
|
+
|
|
2045
|
+
cy.get(cesc("#\\/ans_submit")).should("be.visible");
|
|
2046
|
+
|
|
2047
|
+
cy.log("Submit exact answer");
|
|
2048
|
+
cy.get(cesc("#\\/mi1") + " textarea").type("log(32x+c)", {
|
|
2049
|
+
force: true,
|
|
2050
|
+
delay: 5,
|
|
2051
|
+
});
|
|
2052
|
+
cy.get(cesc("#\\/mi2") + " textarea").type("42", { force: true, delay: 5 });
|
|
2053
|
+
|
|
2054
|
+
cy.get(cesc("#\\/ans_submit")).click();
|
|
2055
|
+
cy.get(cesc("#\\/ans_correct")).should("be.visible");
|
|
2056
|
+
|
|
2057
|
+
cy.window().then(async (win) => {
|
|
2058
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
2059
|
+
expect(stateVariables["/ans"].stateValues.creditAchieved).eq(1);
|
|
2060
|
+
});
|
|
2061
|
+
|
|
2062
|
+
cy.log("Enter too large an error in first component");
|
|
2063
|
+
cy.get(cesc("#\\/mi1") + " textarea").type(
|
|
2064
|
+
"{ctrl+home}{shift+end}{backspace}log(32.04x+c)",
|
|
2065
|
+
{ force: true, delay: 5 },
|
|
2066
|
+
);
|
|
2067
|
+
cy.get(cesc("#\\/ans_submit")).click();
|
|
2068
|
+
cy.get(cesc("#\\/ans_partial"))
|
|
2069
|
+
.invoke("text")
|
|
2070
|
+
.then((text) => {
|
|
2071
|
+
expect(text.trim().toLowerCase()).equal("50% correct");
|
|
2072
|
+
});
|
|
2073
|
+
|
|
2074
|
+
cy.window().then(async (win) => {
|
|
2075
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
2076
|
+
expect(stateVariables["/ans"].stateValues.creditAchieved).eq(0.5);
|
|
2077
|
+
});
|
|
2078
|
+
|
|
2079
|
+
cy.log("Enter too large an error in second component");
|
|
2080
|
+
cy.get(cesc("#\\/mi2") + " textarea").type("{end}.3", {
|
|
2081
|
+
force: true,
|
|
2082
|
+
delay: 5,
|
|
2083
|
+
});
|
|
2084
|
+
cy.get(cesc("#\\/ans_submit")).click();
|
|
2085
|
+
cy.get(cesc("#\\/ans_incorrect")).should("be.visible");
|
|
2086
|
+
|
|
2087
|
+
cy.window().then(async (win) => {
|
|
2088
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
2089
|
+
expect(stateVariables["/ans"].stateValues.creditAchieved).eq(0.0);
|
|
2090
|
+
});
|
|
2091
|
+
|
|
2092
|
+
cy.log("shink error in first component");
|
|
2093
|
+
cy.get(cesc("#\\/mi1") + " textarea").type(
|
|
2094
|
+
"{ctrl+home}{shift+end}{backspace}log(32.01x+c)",
|
|
2095
|
+
{ force: true, delay: 5 },
|
|
2096
|
+
);
|
|
2097
|
+
cy.get(cesc("#\\/ans_submit")).click();
|
|
2098
|
+
cy.get(cesc("#\\/ans_partial"))
|
|
2099
|
+
.invoke("text")
|
|
2100
|
+
.then((text) => {
|
|
2101
|
+
expect(text.trim().toLowerCase()).equal("50% correct");
|
|
2102
|
+
});
|
|
2103
|
+
|
|
2104
|
+
cy.window().then(async (win) => {
|
|
2105
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
2106
|
+
expect(stateVariables["/ans"].stateValues.creditAchieved).closeTo(
|
|
2107
|
+
0.5,
|
|
2108
|
+
1e-14,
|
|
2109
|
+
);
|
|
2110
|
+
});
|
|
2111
|
+
|
|
2112
|
+
cy.log("Shrink error in second component");
|
|
2113
|
+
cy.get(cesc("#\\/mi2") + " textarea").type("{end}{leftArrow}0", {
|
|
2114
|
+
force: true,
|
|
2115
|
+
delay: 5,
|
|
2116
|
+
});
|
|
2117
|
+
cy.get(cesc("#\\/ans_submit")).click();
|
|
2118
|
+
cy.get(cesc("#\\/ans_correct")).should("be.visible");
|
|
2119
|
+
|
|
2120
|
+
cy.window().then(async (win) => {
|
|
2121
|
+
let stateVariables = await win.returnAllStateVariables1();
|
|
2122
|
+
expect(stateVariables["/ans"].stateValues.creditAchieved).eq(1.0);
|
|
2123
|
+
});
|
|
2124
|
+
});
|
|
2125
|
+
});
|