Commit 19cc68c8 by muhammad-ammar Committed by muzaffaryousaf

make numerical and math expression input accessible

TNL-4973
parent 31be6fad
<%! from openedx.core.djangolib.markup import HTML %>
<form class="annotation-input"> <form class="annotation-input">
<div class="script_placeholder" data-src="${STATIC_URL}js/capa/annotationinput.js"/> <div class="script_placeholder" data-src="${STATIC_URL}js/capa/annotationinput.js"/>
...@@ -59,6 +60,5 @@ ...@@ -59,6 +60,5 @@
</form> </form>
% if msg: % if msg:
<span class="message">${msg|n}</span> <span class="message">${HTML(msg)}</span>
% endif % endif
<%! from openedx.core.djangolib.markup import HTML %>
<% <%
def is_radio_input(choice_id): def is_radio_input(choice_id):
return input_type == 'radio' and ((isinstance(value, basestring) and (choice_id == value)) or ( return input_type == 'radio' and ((isinstance(value, basestring) and (choice_id == value)) or (
...@@ -73,6 +74,6 @@ ...@@ -73,6 +74,6 @@
<div class="capa_alert">${submitted_message}</div> <div class="capa_alert">${submitted_message}</div>
%endif %endif
% if msg: % if msg:
<span class="message">${msg|n}</span> <span class="message">${HTML(msg)}</span>
% endif % endif
</form> </form>
<%! from openedx.core.djangolib.markup import HTML %>
<div id="inputtype_${id}" class="capa_inputtype"> <div id="inputtype_${id}" class="capa_inputtype">
<div class="drag_and_drop_problem_div" id="drag_and_drop_div_${id}" <div class="drag_and_drop_problem_div" id="drag_and_drop_div_${id}"
data-plain-id="${id}"> data-plain-id="${id}">
...@@ -23,7 +24,7 @@ ...@@ -23,7 +24,7 @@
<p id="answer_${id}" class="answer"></p> <p id="answer_${id}" class="answer"></p>
% if msg: % if msg:
<span class="message">${msg|n}</span> <span class="message">${HTML(msg)}</span>
% endif % endif
% if status in ['unsubmitted', 'correct', 'incorrect', 'partially-correct', 'incomplete']: % if status in ['unsubmitted', 'correct', 'incorrect', 'partially-correct', 'incomplete']:
......
<%! from openedx.core.djangolib.markup import HTML %>
<section id="filesubmission_${id}" class="filesubmission"> <section id="filesubmission_${id}" class="filesubmission">
<div class="grader-status file"> <div class="grader-status file">
...@@ -9,5 +10,5 @@ ...@@ -9,5 +10,5 @@
<input type="file" name="input_${id}" id="input_${id}" value="${value}" multiple="multiple" data-required_files="${required_files|h}" data-allowed_files="${allowed_files|h}" aria-label="${response_data['label']}"/> <input type="file" name="input_${id}" id="input_${id}" value="${value}" multiple="multiple" data-required_files="${required_files|h}" data-allowed_files="${allowed_files|h}" aria-label="${response_data['label']}"/>
</div> </div>
<div class="message">${msg|n}</div> <div class="message">${HTML(msg)}</div>
</section> </section>
<%page expression_filter="h"/> <%page expression_filter="h"/>
<%! from openedx.core.djangolib.markup import HTML %> <%! from openedx.core.djangolib.markup import HTML %>
<% doinline = 'style="display:inline-block;vertical-align:top"' if inline else "" %> <% doinline = 'style="display:inline-block;vertical-align:top"' if inline else "" %>
<section id="formulaequationinput_${id}" class="inputtype formulaequationinput" ${doinline | n}> <div id="formulaequationinput_${id}" class="inputtype formulaequationinput" ${doinline | n}>
<div class="${status.classname}" id="status_${id}"> <div class="${status.classname}" id="status_${id}">
<input type="text" name="input_${id}" id="input_${id}" <label class="problem-group-label" for="input_${id}">${response_data['label']}</label>
data-input-id="${id}" value="${value}" % for description_id, description_text in response_data['descriptions'].items():
${describedby| n} <p class="question-description" id="${description_id}">${description_text}</p>
% if size: % endfor
size="${size}" <input type="text" name="input_${id}" id="input_${id}"
% endif data-input-id="${id}" value="${value}"
/> ${describedby| n}
<span class="trailing_text">${trailing_text}</span> % if size:
size="${size}"
% endif
/>
<span class="trailing_text">${trailing_text}</span>
<span class="status" id="${id}_status" data-tooltip="${status.display_tooltip}"> <span class="status" id="${id}_status" data-tooltip="${status.display_tooltip}">
<span class="sr"> <span class="sr">
${status.display_name} ${status.display_name}
</span>
</span> </span>
</span>
<p id="answer_${id}" class="answer"></p> <p id="answer_${id}" class="answer"></p>
<div id="input_${id}_preview" class="equation"> <div id="input_${id}_preview" class="equation">
\(\) \(\)
<img src="${STATIC_URL}images/spinner.gif" class="loading" alt="Loading"/> <img src="${STATIC_URL}images/spinner.gif" class="loading" alt="Loading"/>
</div> </div>
</div> </div>
<div class="script_placeholder" data-src="${previewer}"/> <div class="script_placeholder" data-src="${previewer}"/>
% if msg: % if msg:
<span class="message">${HTML(msg)}</span> <span class="message">${HTML(msg)}</span>
% endif % endif
</section> </div>
<%! from openedx.core.djangolib.markup import HTML %>
<% doinline = "inline" if inline else "" %> <% doinline = "inline" if inline else "" %>
<form class="inputtype option-input ${doinline}"> <form class="inputtype option-input ${doinline}">
...@@ -29,6 +30,6 @@ ...@@ -29,6 +30,6 @@
</div> </div>
<p class="answer" id="answer_${id}"></p> <p class="answer" id="answer_${id}"></p>
% if msg: % if msg:
<span class="message">${msg|n}</span> <span class="message">${HTML(msg)}</span>
% endif % endif
</form> </form>
<%! from openedx.core.djangolib.markup import HTML %>
<section id="inputtype_${id}" class="capa_inputtype" > <section id="inputtype_${id}" class="capa_inputtype" >
<table><tr><td height='600'> <table><tr><td height='600'>
<div id="vsepr_div_${id}" style="position:relative;" data-molecules="${molecules}" data-geometries="${geometries}"> <div id="vsepr_div_${id}" style="position:relative;" data-molecules="${molecules}" data-geometries="${geometries}">
...@@ -26,7 +27,7 @@ ...@@ -26,7 +27,7 @@
<p id="answer_${id}" class="answer"></p> <p id="answer_${id}" class="answer"></p>
% if msg: % if msg:
<span class="message">${msg|n}</span> <span class="message">${HTML(msg)}</span>
% endif % endif
% if status in ['unsubmitted', 'correct', 'incorrect', 'partially-correct', 'incomplete']: % if status in ['unsubmitted', 'correct', 'incorrect', 'partially-correct', 'incomplete']:
</div> </div>
......
...@@ -579,7 +579,7 @@ class FormulaEquationInputTemplateTest(TemplateTestCase): ...@@ -579,7 +579,7 @@ class FormulaEquationInputTemplateTest(TemplateTestCase):
Test that correct description information is set on desired elements. Test that correct description information is set on desired elements.
""" """
xpaths = ['//input/@aria-describedby'] xpaths = ['//input/@aria-describedby']
self.assert_description(xpaths, descriptions=False) self.assert_description(xpaths)
self.assert_describedby_attribute(xpaths) self.assert_describedby_attribute(xpaths)
......
...@@ -157,12 +157,16 @@ div.problem { ...@@ -157,12 +157,16 @@ div.problem {
@include margin(($baseline*0.75), 0); @include margin(($baseline*0.75), 0);
} }
form > label { form > label, .problem-group-label {
display: block; display: block;
margin-bottom: $baseline; margin-bottom: $baseline;
font: inherit; font: inherit;
color: inherit; color: inherit;
} }
.wrapper-problem-response:not(:last-child) {
margin-bottom: $baseline;
}
} }
// Choice Group - silent class // Choice Group - silent class
......
...@@ -22,7 +22,7 @@ data: | ...@@ -22,7 +22,7 @@ data: |
<p>You can use the following example problems as models.</p> <p>You can use the following example problems as models.</p>
<schematicresponse> <schematicresponse>
<label>Make a voltage divider that splits the provided voltage evenly.</label> <p>Make a voltage divider that splits the provided voltage evenly.</p>
<center> <center>
<schematic height="500" width="600" parts="g,r" analyses="dc" <schematic height="500" width="600" parts="g,r" analyses="dc"
initial_value="[[&quot;v&quot;,[168,144,0],{&quot;value&quot;:&quot;dc(1)&quot;,&quot;_json_&quot;:0},[&quot;1&quot;,&quot;0&quot;]],[&quot;r&quot;,[296,120,0],{&quot;r&quot;:&quot;1&quot;,&quot;_json_&quot;:1},[&quot;1&quot;,&quot;output&quot;]],[&quot;L&quot;,[296,168,3],{&quot;label&quot;:&quot;output&quot;,&quot;_json_&quot;:2},[&quot;output&quot;]],[&quot;w&quot;,[296,216,168,216]],[&quot;w&quot;,[168,216,168,192]],[&quot;w&quot;,[168,144,168,120]],[&quot;w&quot;,[168,120,296,120]],[&quot;g&quot;,[168,216,0],{&quot;_json_&quot;:7},[&quot;0&quot;]],[&quot;view&quot;,-67.49999999999994,-78.49999999999994,1.6000000000000003,&quot;50&quot;,&quot;10&quot;,&quot;1G&quot;,null,&quot;100&quot;,&quot;1&quot;,&quot;1000&quot;]]"/> initial_value="[[&quot;v&quot;,[168,144,0],{&quot;value&quot;:&quot;dc(1)&quot;,&quot;_json_&quot;:0},[&quot;1&quot;,&quot;0&quot;]],[&quot;r&quot;,[296,120,0],{&quot;r&quot;:&quot;1&quot;,&quot;_json_&quot;:1},[&quot;1&quot;,&quot;output&quot;]],[&quot;L&quot;,[296,168,3],{&quot;label&quot;:&quot;output&quot;,&quot;_json_&quot;:2},[&quot;output&quot;]],[&quot;w&quot;,[296,216,168,216]],[&quot;w&quot;,[168,216,168,192]],[&quot;w&quot;,[168,144,168,120]],[&quot;w&quot;,[168,120,296,120]],[&quot;g&quot;,[168,216,0],{&quot;_json_&quot;:7},[&quot;0&quot;]],[&quot;view&quot;,-67.49999999999994,-78.49999999999994,1.6000000000000003,&quot;50&quot;,&quot;10&quot;,&quot;1G&quot;,null,&quot;100&quot;,&quot;1&quot;,&quot;1000&quot;]]"/>
...@@ -53,7 +53,7 @@ data: | ...@@ -53,7 +53,7 @@ data: |
</schematicresponse> </schematicresponse>
<schematicresponse> <schematicresponse>
<label>Make a high-pass filter.</label> <p>Make a high-pass filter.</p>
<center> <center>
<schematic height="500" width="600" parts="g,r,s,c" analyses="ac" <schematic height="500" width="600" parts="g,r,s,c" analyses="ac"
submit_analyses="{&quot;ac&quot;:[[&quot;NodeA&quot;,1,9]]}" submit_analyses="{&quot;ac&quot;:[[&quot;NodeA&quot;,1,9]]}"
......
...@@ -40,7 +40,7 @@ data: | ...@@ -40,7 +40,7 @@ data: |
return test_add(10, ans) return test_add(10, ans)
</script> </script>
<label>Enter two integers that sum to 10.</label> <p>Enter two integers that sum to 10.</p>
<textline size="40" correct_answer="3"/><br/> <textline size="40" correct_answer="3"/><br/>
<textline size="40" correct_answer="7"/> <textline size="40" correct_answer="7"/>
<solution> <solution>
...@@ -63,7 +63,7 @@ data: | ...@@ -63,7 +63,7 @@ data: |
return False return False
</script> </script>
<label>Enter two integers that sum to 20.</label> <p>Enter two integers that sum to 20.</p>
<textline size="40" correct_answer="11"/><br/> <textline size="40" correct_answer="11"/><br/>
<textline size="40" correct_answer="9"/> <textline size="40" correct_answer="9"/>
<solution> <solution>
......
...@@ -4,52 +4,10 @@ metadata: ...@@ -4,52 +4,10 @@ metadata:
markdown: !!null markdown: !!null
data: | data: |
<problem> <problem>
<p> <formularesponse type="ci" samples="R_1,R_2,R_3@1,2,3:3,4,5#10" answer="R_1*R_2/R_3">
In math expression input problems, learners enter text that represents a <p>You can use this template as a guide to the OLX markup to use for math expression problems. Edit this component to replace the example with your own assessment.</p>
mathematical expression into a field, and text is converted to a symbolic <label>Add the question text, or prompt, here. This text is required. Example: Write an expression for the product of R_1, R_2, and the inverse of R_3.</label>
expression that appears below that field. You can refer learners to <description>You can add an optional tip or note related to the prompt like this. Example: To test this example, the correct answer is R_1*R_2/R_3</description>
<a href="http://edx.readthedocs.io/projects/edx-guide-for-students/en/latest/completing_assignments/SFD_mathformatting.html" target="_blank">
Entering Mathematical and Scientific Expressions</a> in the <i>EdX Learner's
Guide</i> for information about how to enter text into the field.
</p>
<p>
Math expression problems can include unknown variables and relatively
complicated symbolic expressions. The grader uses a numerical sampling to
determine whether the student’s response matches your math expression, to a
specified numerical tolerance. You must specify the allowed variables in the
expression as well as the range of values for each variable.
</p>
<p>
To create these problems, you use MathJax to change your plain text into
"beautiful math." For more information about how to use MathJax in Studio,
see <a href="http://edx.readthedocs.io/projects/edx-partner-course-staff/en/latest/exercises_tools/mathjax.html" target="_blank">
A Brief Introduction to MathJax in Studio</a> in <i>Building and Running an edx
Course</i>.
</p>
<p>
When you add the problem, be sure to select <strong>Settings</strong>
to specify a <strong>Display Name</strong> and other values that apply.
</p>
<p>You can use the following example problems as models.</p>
<formularesponse type="ci" samples="R_1,R_2,R_3@1,2,3:3,4,5#10" answer="$VoVi">
<label>Write an expression for the product of \( R_1\), \( R_2\), and the inverse of \( R_3\).</label>
<description>Enter the equation</description>
<responseparam type="tolerance" default="0.00001"/>
<formulaequationinput size="40"/>
</formularesponse>
<script type="loncapa/python">
VoVi = "(R_1*R_2)/R_3"
</script>
<script type="loncapa/python">
derivative = "n*x^(n-1)"
</script>
<formularesponse type="ci" samples="x,n@1,2:3,4#10" answer="$derivative">
<label>Let \( x\) be a variable, and let \( n\) be an arbitrary constant. What is the derivative of \( x^n\)?</label>
<description>Enter the equation</description>
<responseparam type="tolerance" default="0.00001"/> <responseparam type="tolerance" default="0.00001"/>
<formulaequationinput size="40"/> <formulaequationinput size="40"/>
</formularesponse> </formularesponse>
......
...@@ -18,7 +18,7 @@ data: | ...@@ -18,7 +18,7 @@ data: |
and other values that apply.</p> and other values that apply.</p>
<p>You can use the following example problem as a model.</p> <p>You can use the following example problem as a model.</p>
<imageresponse> <imageresponse>
<label>What country is home to the Great Pyramid of Giza as well as the cities of Cairo and Memphis? Click the country on the map below.</label> <p>What country is home to the Great Pyramid of Giza as well as the cities of Cairo and Memphis? Click the country on the map below.</p>
<imageinput src="https://studio.edx.org/c4x/edX/DemoX/asset/Africa.png" width="600" height="638" rectangle="(338,98)-(412,168)" alt="Map of Africa"/> <imageinput src="https://studio.edx.org/c4x/edX/DemoX/asset/Africa.png" width="600" height="638" rectangle="(338,98)-(412,168)" alt="Map of Africa"/>
<solution> <solution>
<div class="detailed-solution"> <div class="detailed-solution">
......
...@@ -58,7 +58,7 @@ data: | ...@@ -58,7 +58,7 @@ data: |
''' '''
]]> ]]>
</script> </script>
<label>In the following image, click the objects until the cone is yellow and the cube is blue.</label> <p>In the following image, click the objects until the cone is yellow and the cube is blue.</p>
<jsinput gradefn="WebGLDemo.getGrade" <jsinput gradefn="WebGLDemo.getGrade"
get_statefn="WebGLDemo.getState" get_statefn="WebGLDemo.getState"
set_statefn="WebGLDemo.setState" set_statefn="WebGLDemo.setState"
......
...@@ -138,7 +138,7 @@ data: | ...@@ -138,7 +138,7 @@ data: |
<p><strong>Example Math Expression Problem</strong></p> <p><strong>Example Math Expression Problem</strong></p>
<symbolicresponse expect="m*c^2"> <symbolicresponse expect="m*c^2">
<label>What is Einstein's equation for the energy equivalent of a mass [mathjaxinline]m[/mathjaxinline]?</label> <p>What is Einstein's equation for the energy equivalent of a mass [mathjaxinline]m[/mathjaxinline]?</p>
<textline size="90" correct_answer="m*c^2" math="1"/> <textline size="90" correct_answer="m*c^2" math="1"/>
</symbolicresponse> </symbolicresponse>
<br/> <br/>
...@@ -146,11 +146,8 @@ data: | ...@@ -146,11 +146,8 @@ data: |
<p><strong>Example Numerical Problem</strong></p> <p><strong>Example Numerical Problem</strong></p>
<numericalresponse inline="1" answer="0.52"> <numericalresponse inline="1" answer="0.52">
<label>Estimate the energy savings (in J/y) if all the people ([mathjaxinline]3\times 10^8[/mathjaxinline]) in the U.&#xA0;S. switched from U.&#xA0;S. code to low-flow shower heads.</label> <label>Estimate the energy savings (in J/y) if all the people ([mathjaxinline]3\times 10^8[/mathjaxinline]) in the U.&#xA0;S. switched from U.&#xA0;S. code to low-flow shower heads.</label>
<p style="display:inline">Energy saved = </p> <formulaequationinput trailing_text="EJ/year" />
<textline inline="1"> <responseparam type="tolerance" default="0.02"/>
<responseparam type="tolerance" default="0.02"/>
</textline>
<p style="display:inline">&#xA0;EJ/year</p>
</numericalresponse> </numericalresponse>
<br/> <br/>
...@@ -176,7 +173,7 @@ data: | ...@@ -176,7 +173,7 @@ data: |
def test_add_to_ten(expect, ans): def test_add_to_ten(expect, ans):
return test_add(10, ans) return test_add(10, ans)
</script> </script>
<label>Enter two integers that sum to 10.</label> <p>Enter two integers that sum to 10.</p>
<textline size="40" correct_answer="3"/><br/> <textline size="40" correct_answer="3"/><br/>
<textline size="40" correct_answer="7"/> <textline size="40" correct_answer="7"/>
<solution> <solution>
...@@ -197,7 +194,7 @@ data: | ...@@ -197,7 +194,7 @@ data: |
except ValueError: except ValueError:
return False return False
</script> </script>
<label>Enter two integers that sum to 20.</label> <p>Enter two integers that sum to 20.</p>
<textline size="40" correct_answer="11"/><br/> <textline size="40" correct_answer="11"/><br/>
<textline size="40" correct_answer="9"/> <textline size="40" correct_answer="9"/>
<solution> <solution>
...@@ -213,10 +210,10 @@ data: | ...@@ -213,10 +210,10 @@ data: |
<p><strong>Example Image Mapped Input Problem</strong></p> <p><strong>Example Image Mapped Input Problem</strong></p>
<imageresponse> <imageresponse>
<label> <p>
What country is home to the Great Pyramid of Giza as well as the cities What country is home to the Great Pyramid of Giza as well as the cities
of Cairo and Memphis? Click the country on the map below. of Cairo and Memphis? Click the country on the map below.
</label> </p>
<imageinput src="https://studio.edx.org/c4x/edX/DemoX/asset/Africa.png" <imageinput src="https://studio.edx.org/c4x/edX/DemoX/asset/Africa.png"
width="600" height="638" rectangle="(338,98)-(412,168)" alt="Map of width="600" height="638" rectangle="(338,98)-(412,168)" alt="Map of
Africa"/> Africa"/>
......
...@@ -2,61 +2,19 @@ ...@@ -2,61 +2,19 @@
metadata: metadata:
display_name: Numerical Input display_name: Numerical Input
markdown: | markdown: |
In a numerical input problem, learners enter numbers or a specific and relatively simple mathematical expression. Learners enter the response in plain text, and the system then converts the text to a symbolic expression that learners can see below the response field. You can use this template as a guide to the simple editor markdown and OLX markup to use for numerical input problems. Edit this component to replace this template with your own assessment.
The system can handle several types of characters, including basic operators, fractions, exponents, and common constants such as "i". You can refer learners to "Entering Mathematical and Scientific Expressions" in the edX Guide for Students for more information. >>Add the question text, or prompt, here. This text is required.||You can add an optional tip or note related to the prompt like this. <<
When you add the problem, be sure to select Settings to specify a Display Name and other values that apply. = 100 +-5
You can use the following example problems as models.
>>How many miles away from Earth is the sun?||Use scientific notation to answer.<<
= 9.3*10^7
or= 9.296*10^7
[explanation]
The sun is 93,000,000, or 9.3*10^7, miles away from Earth.
[explanation]
---
>>The square of what number is -100?||Use scientific notation to answer.<<
= 10*i
[explanation]
-100 is the square of 10 times the imaginary number, i.
[explanation]
data: | data: |
<problem> <problem>
<numericalresponse answer="9.3*10^7"> <numericalresponse answer="100">
<p>In a numerical input problem, learners enter numbers or a specific and relatively simple mathematical expression. Learners enter the response in plain text, and the system then converts the text to a symbolic expression that learners can see below the response field.</p> <p>You can use this template as a guide to the simple editor markdown and OLX markup to use for numerical input problems. Edit this component to replace this template with your own assessment.</p>
<p>The system can handle several types of characters, including basic operators, fractions, exponents, and common constants such as i. You can refer learners to <label>Add the question text, or prompt, here. This text is required.</label>
<a href="http://edx.readthedocs.io/projects/edx-guide-for-students/en/latest/completing_assignments/SFD_mathformatting.html#math-formatting" target="_blank">Entering Mathematical and Scientific Expressions</a>in the<i> EdX Learner's Guide</i> <description>You can add an optional tip or note related to the prompt like this.</description>
for information about how to enter text into the field.</p> <responseparam type="tolerance" default="5"/>
<p>When you add the problem, be sure to select <strong>Settings</strong> to specify a <strong>Display Name</strong> and other values that apply.</p>
<p>You can use the following example problems as models.</p>
<label>How many miles away from Earth is the sun?</label>
<description>Use scientific notation to answer.</description>
<formulaequationinput/>
<solution>
<div class="detailed-solution">
<p>Explanation</p>
<p>The sun is 93,000,000, or 9.3*10^7, miles away from Earth.</p>
</div>
</solution>
</numericalresponse>
<numericalresponse answer="10*i">
<label>The square of what number is -100?</label>
<description>Use scientific notation to answer.</description>
<formulaequationinput/> <formulaequationinput/>
<solution>
<div class="detailed-solution">
<p>Explanation</p>
<p>-100 is the square of 10 times the imaginary number, i.</p>
</div>
</solution>
</numericalresponse> </numericalresponse>
</problem> </problem>
...@@ -2,51 +2,28 @@ ...@@ -2,51 +2,28 @@
metadata: metadata:
display_name: Numerical Input with Hints and Feedback display_name: Numerical Input with Hints and Feedback
markdown: | markdown: |
You can use this template as a guide to the simple editor markdown and OLX markup to use for numerical input with hints and feedback problems. Edit this component to replace this template with your own assessment.
You can provide feedback for correct answers in numerical input problems. You cannot provide feedback for incorrect answers. >>Add the question text, or prompt, here. This text is required.||You can add an optional tip or note related to the prompt like this. <<
Use feedback for the correct answer to reinforce the process for arriving at the numerical value. = 100 +-5 {{You can specify optional feedback like this, which appears after this answer is submitted.}}
You can also add hints for learners. ||You can add an optional hint like this. Problems that have a hint include a hint button, and this text appears the first time learners select the button.||
||If you add more than one hint, a different hint appears each time learners select the hint button.||
Be sure to select Settings to specify a Display Name and other values that apply.
Use the following example problem as a model.
>>What is the arithmetic mean for the following set of numbers? (1, 5, 6, 3, 5)||Use scientific notation to answer.<<
= 4 {{The mean for this set of numbers is 20 / 5, which equals 4.}}
||The mean is calculated by summing the set of numbers and dividing by n.||
||n is the count of items in the set.||
[explanation]
The mean is calculated by summing the set of numbers and dividing by n. In this case: (1 + 5 + 6 + 3 + 5) / 5 = 20 / 5 = 4.
[explanation]
hinted: true hinted: true
data: | data: |
<problem> <problem>
<numericalresponse answer="4"> <numericalresponse answer="100">
<p>You can provide feedback for correct answers in numerical input problems. You cannot provide feedback for incorrect answers.</p> <p>You can use this template as a guide to the simple editor markdown and OLX markup to use for numerical input with hints and feedback problems. Edit this component to replace this template with your own assessment.</p>
<p>Use feedback for the correct answer to reinforce the process for arriving at the numerical value.</p> <label>Add the question text, or prompt, here. This text is required.</label>
<p>You can also add hints for learners.</p> <description>You can add an optional tip or note related to the prompt like this.</description>
<p>Be sure to select Settings to specify a Display Name and other values that apply.</p> <responseparam type="tolerance" default="5"/>
<p>Use the following example problem as a model.</p>
<label>What is the arithmetic mean for the following set of numbers? (1, 5, 6, 3, 5)</label>
<description>Use scientific notation to answer.</description>
<formulaequationinput/> <formulaequationinput/>
<correcthint>The mean for this set of numbers is 20 / 5, which equals 4.</correcthint> <correcthint>You can specify optional feedback like this, which appears after this answer is submitted.</correcthint>
<solution>
<div class="detailed-solution">
<p>Explanation</p>
<p>The mean is calculated by summing the set of numbers and dividing by n. In this case: (1 + 5 + 6 + 3 + 5) / 5 = 20 / 5 = 4.</p>
</div>
</solution>
</numericalresponse> </numericalresponse>
<demandhint> <demandhint>
<hint>The mean is calculated by summing the set of numbers and dividing by n.</hint> <hint>You can add an optional hint like this. Problems that have a hint include a hint button, and this text appears the first time learners select the button.</hint>
<hint>n is the count of items in the set.</hint> <hint>If you add more than one hint, a different hint appears each time learners select the hint button.</hint>
</demandhint> </demandhint>
</problem> </problem>
...@@ -35,7 +35,7 @@ data: | ...@@ -35,7 +35,7 @@ data: |
hint = "&lt;font color='blue'&gt;Hint: {0}&lt;/font&gt;".format(hint) hint = "&lt;font color='blue'&gt;Hint: {0}&lt;/font&gt;".format(hint)
new_cmap.set_hint_and_mode(aid,hint,'always') new_cmap.set_hint_and_mode(aid,hint,'always')
</script> </script>
<label>What is the best programming language that exists today? You may enter your answer in upper or lower case, with or without quotes.</label> <p>What is the best programming language that exists today? You may enter your answer in upper or lower case, with or without quotes.</p>
<textline correct_answer="python"/> <textline correct_answer="python"/>
<hintgroup hintfn="hint_fn"/> <hintgroup hintfn="hint_fn"/>
</customresponse> </customresponse>
......
...@@ -52,7 +52,7 @@ data: | ...@@ -52,7 +52,7 @@ data: |
<text> <text>
<p><h4>Problem With Adaptive Hint</h4></p> <p><h4>Problem With Adaptive Hint</h4></p>
<p>This problem demonstrates a question with hints, based on using the <tt class="tt">hintfn</tt> method.</p> <p>This problem demonstrates a question with hints, based on using the <tt class="tt">hintfn</tt> method.</p>
<customresponse cfn="test_str" expect="python"> <customresponse cfn="test_str" expect="python">
<script type="text/python" system_path="python_lib"> <script type="text/python" system_path="python_lib">
def test_str(expect, ans): def test_str(expect, ans):
...@@ -80,9 +80,9 @@ data: | ...@@ -80,9 +80,9 @@ data: |
hint = "&lt;font color='blue'&gt;Hint: {0}&lt;/font&gt;".format(hint) hint = "&lt;font color='blue'&gt;Hint: {0}&lt;/font&gt;".format(hint)
new_cmap.set_hint_and_mode(aid,hint,'always') new_cmap.set_hint_and_mode(aid,hint,'always')
</script> </script>
<label>What is the best programming language that exists today? You may enter your answer in upper or lower case, with or without quotes.</label> <p>What is the best programming language that exists today? You may enter your answer in upper or lower case, with or without quotes.</p>
<textline correct_answer="python"/> <textline correct_answer="python"/>
<hintgroup hintfn="hint_fn"/> <hintgroup hintfn="hint_fn"/>
</customresponse> </customresponse>
</text> </text>
</problem> </problem>
...@@ -104,7 +104,7 @@ class ProblemPage(PageObject): ...@@ -104,7 +104,7 @@ class ProblemPage(PageObject):
""" """
Fill in the answer to a numerical problem. Fill in the answer to a numerical problem.
""" """
self.q(css='div.problem section.inputtype input').fill(text) self.q(css='div.problem div.inputtype input').fill(text)
self.wait_for_element_invisibility('.loading', 'wait for loading icon to disappear') self.wait_for_element_invisibility('.loading', 'wait for loading icon to disappear')
self.wait_for_ajax() self.wait_for_ajax()
...@@ -138,7 +138,7 @@ class ProblemPage(PageObject): ...@@ -138,7 +138,7 @@ class ProblemPage(PageObject):
""" """
wait for status icon wait for status icon
""" """
self.wait_for_element_visibility('div.problem section.inputtype div .status', 'wait for status icon') self.wait_for_element_visibility('div.problem div.inputtype div .status', 'wait for status icon')
def wait_for_expected_status(self, status_selector, message): def wait_for_expected_status(self, status_selector, message):
""" """
...@@ -175,19 +175,19 @@ class ProblemPage(PageObject): ...@@ -175,19 +175,19 @@ class ProblemPage(PageObject):
""" """
Is there a "correct" status showing? Works with simple problem types. Is there a "correct" status showing? Works with simple problem types.
""" """
return self.q(css="div.problem section.inputtype div.correct span.status").is_present() return self.q(css="div.problem div.inputtype div.correct span.status").is_present()
def simpleprob_is_partially_correct(self): def simpleprob_is_partially_correct(self):
""" """
Is there a "partially correct" status showing? Works with simple problem types. Is there a "partially correct" status showing? Works with simple problem types.
""" """
return self.q(css="div.problem section.inputtype div.partially-correct span.status").is_present() return self.q(css="div.problem div.inputtype div.partially-correct span.status").is_present()
def simpleprob_is_incorrect(self): def simpleprob_is_incorrect(self):
""" """
Is there an "incorrect" status showing? Works with simple problem types. Is there an "incorrect" status showing? Works with simple problem types.
""" """
return self.q(css="div.problem section.inputtype div.incorrect span.status").is_present() return self.q(css="div.problem div.inputtype div.incorrect span.status").is_present()
def click_clarification(self, index=0): def click_clarification(self, index=0):
""" """
......
...@@ -561,3 +561,42 @@ class CAPAProblemDropDownA11yTest(CAPAProblemA11yBaseTestMixin, ProblemsTest): ...@@ -561,3 +561,42 @@ class CAPAProblemDropDownA11yTest(CAPAProblemA11yBaseTestMixin, ProblemsTest):
</problem> </problem>
""") """)
return XBlockFixtureDesc('problem', 'Problem A11Y TEST', data=xml) return XBlockFixtureDesc('problem', 'Problem A11Y TEST', data=xml)
@attr('a11y')
class ProblemNumericalInputA11yTest(CAPAProblemA11yBaseTestMixin, ProblemsTest):
"""Tests NumericalInput accessibility."""
def get_problem(self):
"""NumericalInput problem XML."""
xml = dedent("""
<problem>
<numericalresponse answer="10*i">
<label>The square of what number is -100?</label>
<description>Use scientific notation to answer.</description>
<formulaequationinput/>
</numericalresponse>
</problem>""")
return XBlockFixtureDesc('problem', 'NUMERICALINPUT PROBLEM', data=xml)
@attr('a11y')
class ProblemMathExpressionInputA11yTest(CAPAProblemA11yBaseTestMixin, ProblemsTest):
"""Tests MathExpressionInput accessibility."""
def get_problem(self):
"""MathExpressionInput problem XML."""
xml = dedent(r"""
<problem>
<script type="loncapa/python">
derivative = "n*x^(n-1)"
</script>
<formularesponse type="ci" samples="x,n@1,2:3,4#10" answer="$derivative">
<label>Let \( x\) be a variable, and let \( n\) be an arbitrary constant. What is the derivative of \( x^n\)?</label>
<description>Enter the equation</description>
<responseparam type="tolerance" default="0.00001"/>
<formulaequationinput size="40"/>
</formularesponse>
</problem>""")
return XBlockFixtureDesc('problem', 'MATHEXPRESSIONINPUT PROBLEM', data=xml)
...@@ -535,12 +535,6 @@ class NumericalProblemTypeTest(ProblemTypeTestBase, ProblemTypeTestMixin): ...@@ -535,12 +535,6 @@ class NumericalProblemTypeTest(ProblemTypeTestBase, ProblemTypeTestMixin):
Additional setup for NumericalProblemTypeTest Additional setup for NumericalProblemTypeTest
""" """
super(NumericalProblemTypeTest, self).setUp(*args, **kwargs) super(NumericalProblemTypeTest, self).setUp(*args, **kwargs)
self.problem_page.a11y_audit.config.set_rules({
'ignore': [
'section', # TODO: AC-491
'label', # TODO: AC-289
]
})
def answer_problem(self, correct): def answer_problem(self, correct):
""" """
...@@ -579,12 +573,6 @@ class FormulaProblemTypeTest(ProblemTypeTestBase, ProblemTypeTestMixin): ...@@ -579,12 +573,6 @@ class FormulaProblemTypeTest(ProblemTypeTestBase, ProblemTypeTestMixin):
Additional setup for FormulaProblemTypeTest Additional setup for FormulaProblemTypeTest
""" """
super(FormulaProblemTypeTest, self).setUp(*args, **kwargs) super(FormulaProblemTypeTest, self).setUp(*args, **kwargs)
self.problem_page.a11y_audit.config.set_rules({
'ignore': [
'section', # TODO: AC-491
'label', # TODO: AC-288
]
})
def answer_problem(self, correct): def answer_problem(self, correct):
""" """
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment