Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
b78fb8df
Commit
b78fb8df
authored
Nov 01, 2012
by
Victor Shnayder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactored the rest of the input types
parent
3a099970
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
110 additions
and
130 deletions
+110
-130
common/lib/capa/capa/inputtypes.py
+93
-125
common/lib/capa/capa/templates/crystallography.html
+1
-1
common/lib/capa/capa/templates/vsepr_input.html
+1
-1
common/lib/capa/capa/tests/test_inputtypes.py
+15
-3
No files found.
common/lib/capa/capa/inputtypes.py
View file @
b78fb8df
This diff is collapsed.
Click to expand it.
common/lib/capa/capa/templates/crystallography.html
View file @
b78fb8df
...
...
@@ -19,7 +19,7 @@
<div
style=
"display:none;"
name=
"${hidden}"
inputid=
"input_${id}"
/>
% endif
<input
type=
"text"
name=
"input_${id}"
id=
"input_${id}"
value=
"${value}"
<input
type=
"text"
name=
"input_${id}"
id=
"input_${id}"
value=
"${value
|h
}"
%
if
size:
size=
"${size}"
%
endif
...
...
common/lib/capa/capa/templates/vsepr_input.html
View file @
b78fb8df
...
...
@@ -21,7 +21,7 @@
<div
class=
"incorrect"
id=
"status_${id}"
>
% endif
<input
type=
"text"
name=
"input_${id}"
id=
"input_${id}"
value=
"${value}"
<input
type=
"text"
name=
"input_${id}"
id=
"input_${id}"
value=
"${value
|h
}"
style=
"display:none;"
/>
...
...
common/lib/capa/capa/tests/test_inputtypes.py
View file @
b78fb8df
...
...
@@ -2,9 +2,18 @@
Tests of input types.
TODO:
- refactor: so much repetive code (have factory methods that build xml elements directly, etc)
- test error cases
- check rendering -- e.g. msg should appear in the rendered output. If possible, test that
templates are escaping things properly.
- test unicode in values, parameters, etc.
- test various html escapes
- test funny xml chars -- should never get xml parse error if things are escaped properly.
"""
from
lxml
import
etree
...
...
@@ -267,14 +276,15 @@ class CodeInputTest(unittest.TestCase):
'status'
:
'incomplete'
,
'feedback'
:
{
'message'
:
'3'
},
}
the_input
=
lookup_tag
(
'codeinput'
)(
test_system
,
element
,
state
)
input_class
=
lookup_tag
(
'codeinput'
)
the_input
=
input_class
(
test_system
,
element
,
state
)
context
=
the_input
.
_get_render_context
()
expected
=
{
'id'
:
'prob_1_2'
,
'value'
:
'print "good evening"'
,
'status'
:
'queued'
,
'msg'
:
'Submitted to grader.'
,
'msg'
:
input_class
.
submitted_msg
,
'mode'
:
mode
,
'linenumbers'
:
linenumbers
,
'rows'
:
rows
,
...
...
@@ -323,8 +333,9 @@ class SchematicTest(unittest.TestCase):
expected
=
{
'id'
:
'prob_1_2'
,
'value'
:
value
,
'initial_value'
:
initial_value
,
'status'
:
'unsubmitted'
,
'msg'
:
''
,
'initial_value'
:
initial_value
,
'width'
:
width
,
'height'
:
height
,
'parts'
:
parts
,
...
...
@@ -488,6 +499,7 @@ class ChemicalEquationTest(unittest.TestCase):
expected
=
{
'id'
:
'prob_1_2'
,
'value'
:
'H2OYeah'
,
'status'
:
'unanswered'
,
'msg'
:
''
,
'size'
:
size
,
'previewer'
:
'/static/js/capa/chemical_equation_preview.js'
,
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment