Skip to content

Commit

Permalink
Refactor copies and composites (#2316)
Browse files Browse the repository at this point in the history
* working toward phasing out copy
  - macros and copies behave the same way
  - combine plain macro and plain copy attributes into implicit prop attribute
  - if no prop, name applies to replacement (no assignNames)
  - if prop, still applies to copy, use assignNames for pieces
* the ability to copy componentIndex from non-standard composites
* updateValue, animateFromSequence handle target subnames and subnames component index
* Actions always await performUpdate and similar
* render composite replacements with commas
* assignNames, componentIndex skip only blank children
* correctly copy with no-link copies of a prop
* aslist attribute for additional composites
  • Loading branch information
dqnykamp authored Aug 15, 2023
1 parent 7d59374 commit e6e256f
Show file tree
Hide file tree
Showing 193 changed files with 26,161 additions and 24,708 deletions.
6 changes: 3 additions & 3 deletions cypress/e2e/AssignedActivity/singlepageActivities.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -1630,9 +1630,9 @@ describe("Single page activity tests", function () {
const doenetML = `
<title>A video</title>
<video youtube="tJ4ypc5L6uU" width="640px" height="360px" name="v" />
<p>State: <copy prop="state" source="v" assignNames="state" /></p>
<p>Time: <copy prop="time" source="v" assignNames="time" /></p>
<p>Duration: <copy prop="duration" source="v" assignNames="duration" /></p>
<p>State: $v.state{assignNames="state"}</p>
<p>Time: $v.time{assignNames="time"}</p>
<p>Duration: $v.duration{assignNames="duration"}</p>
<p>
<callAction target="v" actionName="playVideo" name="playAction"><label>Play action</label></callAction>
<callAction target="v" actionName="pauseVideo" name="pauseAction"><label>Pause action</label></callAction>
Expand Down
54 changes: 27 additions & 27 deletions cypress/e2e/DoenetML/answerValidation/errorinnumbers.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ describe("Allow error in numbers validation tests", function () {
<p><math>log(32x+c)</math>
<answer>
<award allowederrorinnumbers="0.00001">
<copy target="_math1" />
$_math1
</award>
<award credit="0.8" allowederrorinnumbers="0.0001">
<copy target="_math1" />
$_math1
</award>
<award credit="0.6" allowederrorinnumbers="0.001">
<copy target="_math1" />
$_math1
</award>
</answer>
</p>
Expand Down Expand Up @@ -179,13 +179,13 @@ describe("Allow error in numbers validation tests", function () {
<p><math>log(32x+c)</math>
<answer>
<award allowederrorinnumbers="0.00001" allowederrorisabsolute="true">
<copy target="_math1" />
$_math1
</award>
<award credit="0.8" allowederrorinnumbers="0.0001" allowederrorisabsolute="true">
<copy target="_math1" />
$_math1
</award>
<award credit="0.6" allowederrorinnumbers="0.001" allowederrorisabsolute="true">
<copy target="_math1" />
$_math1
</award>
</answer>
</p>
Expand Down Expand Up @@ -336,10 +336,10 @@ describe("Allow error in numbers validation tests", function () {
<p><math simplify>10 exp(7x^2/(3-sqrt(y)))</math>
<answer>
<award allowederrorinnumbers="0.0000001">
<copy target="_math1" />
$_math1
</award>
<award credit="0.6" allowederrorinnumbers="0.0001">
<copy target="_math1" />
$_math1
</award>
</answer>
</p>
Expand Down Expand Up @@ -416,15 +416,15 @@ describe("Allow error in numbers validation tests", function () {
<p><math>10x^2-4</math>
<answer>
<award allowederrorinnumbers="0.0001">
<copy target="_math1" />
$_math1
</award>
</answer>
</p>
<p>Allow for error in exponents
<answer>
<award allowederrorinnumbers="0.0001" includeerrorinnumberexponents>
<copy target="_math1" />
$_math1
</award>
</answer>
</p>
Expand Down Expand Up @@ -547,13 +547,13 @@ describe("Allow error in numbers validation tests", function () {
<p><math>log(32x+c)</math>
<answer>
<award symbolicequality="true" allowederrorinnumbers="0.00001" simplifyOnCompare>
<copy target="_math1" />
$_math1
</award>
<award credit="0.8" symbolicequality="true" allowederrorinnumbers="0.0001" simplifyOnCompare>
<copy target="_math1" />
$_math1
</award>
<award credit="0.6" symbolicequality="true" allowederrorinnumbers="0.001" simplifyOnCompare>
<copy target="_math1" />
$_math1
</award>
</answer>
</p>
Expand Down Expand Up @@ -853,13 +853,13 @@ describe("Allow error in numbers validation tests", function () {
<p><math>10000 exp(7x^2/(0.00003-sqrt(y)))</math>
<answer symbolicequality simplifyOnCompare>
<award allowederrorinnumbers="0.0000001" >
<copy target="_math1" />
$_math1
</award>
<award credit="0.8" allowederrorinnumbers="0.000001">
<copy target="_math1" />
$_math1
</award>
<award credit="0.6" allowederrorinnumbers="0.00001">
<copy target="_math1" />
$_math1
</award>
</answer>
</p>
Expand Down Expand Up @@ -990,13 +990,13 @@ describe("Allow error in numbers validation tests", function () {
<p><math simplify>10000 exp(7x^2/(0.00003-sqrt(y)))</math>
<answer>
<award symbolicequality="true" allowederrorinnumbers="0.0000001" allowederrorisabsolute simplifyOnCompare>
<copy target="_math1" />
$_math1
</award>
<award symbolicequality="true" credit="0.8" allowederrorinnumbers="0.000001" allowederrorisabsolute simplifyOnCompare>
<copy target="_math1" />
$_math1
</award>
<award symbolicequality="true" credit="0.6" allowederrorinnumbers="0.00001" allowederrorisabsolute simplifyOnCompare>
<copy target="_math1" />
$_math1
</award>
</answer>
</p>
Expand Down Expand Up @@ -1137,15 +1137,15 @@ describe("Allow error in numbers validation tests", function () {
<p><math simplify>10x^2-4</math>
<answer>
<award symbolicequality="true" allowederrorinnumbers="0.0001" simplifyOnCompare>
<copy target="_math1" />
$_math1
</award>
</answer>
</p>
<p>Allow for error in exponents
<answer>
<award symbolicequality="true" allowederrorinnumbers="0.0001" includeerrorinnumberexponents simplifyOnCompare>
<copy target="_math1" />
$_math1
</award>
</answer>
</p>
Expand Down Expand Up @@ -1268,7 +1268,7 @@ describe("Allow error in numbers validation tests", function () {
<p><math>2.15234262pi+e*25.602348230</math>
<answer>
<award symbolicequality="true" allowederrorinnumbers="0.001">
<copy target="_math1" />
$_math1
</award>
</answer>
</p>
Expand Down Expand Up @@ -1390,7 +1390,7 @@ describe("Allow error in numbers validation tests", function () {
<p><math>sin(2pi+1x+4x+pi+6)</math>
<answer>
<award symbolicequality="true" allowederrorinnumbers="0.001" simplifyOnCompare="numbersPreserveOrder">
<copy target="_math1" />
$_math1
</award>
</answer>
</p>
Expand Down Expand Up @@ -1500,7 +1500,7 @@ describe("Allow error in numbers validation tests", function () {
<p><math>sin(2pi+1x+4x+pi+6)</math>
<answer>
<award symbolicequality="true" allowederrorinnumbers="0.001" simplifyOnCompare="numbers">
<copy target="_math1" />
$_math1
</award>
</answer>
</p>
Expand Down Expand Up @@ -1611,7 +1611,7 @@ describe("Allow error in numbers validation tests", function () {
<p><math>sin(2pi+1x+4x+pi+6)</math>
<answer>
<award symbolicequality="true" allowederrorinnumbers="0.001" simplifyOnCompare="full">
<copy target="_math1" />
$_math1
</award>
</answer>
</p>
Expand Down Expand Up @@ -1722,7 +1722,7 @@ describe("Allow error in numbers validation tests", function () {
<p><math>(log(32x+c), 42)</math>
<answer matchPartial>
<award allowederrorinnumbers="0.001">
<copy target="_math1" />
$_math1
</award>
</answer>
</p>
Expand Down Expand Up @@ -1824,7 +1824,7 @@ describe("Allow error in numbers validation tests", function () {
<p><math unordered>(42, log(32x+c))</math>
<answer matchPartial>
<award allowederrorinnumbers="0.001">
<copy target="_math1" />
$_math1
</award>
</answer>
</p>
Expand Down
Loading

0 comments on commit e6e256f

Please sign in to comment.