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
62d129fd
Commit
62d129fd
authored
Jan 10, 2017
by
Jeff LaJoie
Committed by
GitHub
Jan 10, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #14298 from edx/jlajoie/TNL-6095
Adds trailing_text id to input describedby
parents
adad6b2e
1c0a60eb
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
5 deletions
+14
-5
common/lib/capa/capa/inputtypes.py
+8
-1
common/lib/capa/capa/templates/formulaequationinput.html
+1
-1
common/lib/capa/capa/templates/textline.html
+1
-1
common/lib/capa/capa/tests/test_inputtypes.py
+4
-2
No files found.
common/lib/capa/capa/inputtypes.py
View file @
62d129fd
...
@@ -328,9 +328,16 @@ class InputTypeBase(object):
...
@@ -328,9 +328,16 @@ class InputTypeBase(object):
}
}
# Generate the list of ids to be used with the aria-describedby field.
# Generate the list of ids to be used with the aria-describedby field.
descriptions
=
list
()
# If there is trailing text, add the id as the first element to the list before adding the status id
if
'trailing_text'
in
self
.
loaded_attributes
and
self
.
loaded_attributes
[
'trailing_text'
]:
trailing_text_id
=
'trailing_text_'
+
self
.
input_id
descriptions
.
append
(
trailing_text_id
)
# Every list should contain the status id
# Every list should contain the status id
status_id
=
'status_'
+
self
.
input_id
status_id
=
'status_'
+
self
.
input_id
descriptions
=
list
([
status_id
]
)
descriptions
.
append
(
status_id
)
descriptions
.
extend
(
self
.
response_data
.
get
(
'descriptions'
,
{})
.
keys
())
descriptions
.
extend
(
self
.
response_data
.
get
(
'descriptions'
,
{})
.
keys
())
description_ids
=
' '
.
join
(
descriptions
)
description_ids
=
' '
.
join
(
descriptions
)
context
.
update
(
context
.
update
(
...
...
common/lib/capa/capa/templates/formulaequationinput.html
View file @
62d129fd
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
size=
"${size}"
size=
"${size}"
%
endif
%
endif
/>
/>
<span
class=
"trailing_text"
>
${trailing_text}
</span>
<span
class=
"trailing_text"
id=
"trailing_text_${id}"
>
${trailing_text}
</span>
<
%
include
file=
"status_span.html"
args=
"status=status, status_id=id"
/>
<
%
include
file=
"status_span.html"
args=
"status=status, status_id=id"
/>
...
...
common/lib/capa/capa/templates/textline.html
View file @
62d129fd
...
@@ -34,7 +34,7 @@
...
@@ -34,7 +34,7 @@
style=
"display:none;"
style=
"display:none;"
%
endif
%
endif
/>
/>
<span
class=
"trailing_text"
>
${trailing_text}
</span>
<span
class=
"trailing_text"
id=
"trailing_text_${id}"
>
${trailing_text}
</span>
<
%
include
file=
"status_span.html"
args=
"status=status, status_id=id"
/>
<
%
include
file=
"status_span.html"
args=
"status=status, status_id=id"
/>
...
...
common/lib/capa/capa/tests/test_inputtypes.py
View file @
62d129fd
...
@@ -37,6 +37,8 @@ lookup_tag = inputtypes.registry.get_class_for_tag
...
@@ -37,6 +37,8 @@ lookup_tag = inputtypes.registry.get_class_for_tag
DESCRIBEDBY
=
HTML
(
'aria-describedby="status_{status_id} desc-1 desc-2"'
)
DESCRIBEDBY
=
HTML
(
'aria-describedby="status_{status_id} desc-1 desc-2"'
)
# Use TRAILING_TEXT_DESCRIBEDBY when trailing_text is not null
TRAILING_TEXT_DESCRIBEDBY
=
HTML
(
'aria-describedby="trailing_text_{trailing_text_id} status_{status_id} desc-1 desc-2"'
)
DESCRIPTIONS
=
OrderedDict
([(
'desc-1'
,
'description text 1'
),
(
'desc-2'
,
'description text 2'
)])
DESCRIPTIONS
=
OrderedDict
([(
'desc-1'
,
'description text 1'
),
(
'desc-2'
,
'description text 2'
)])
RESPONSE_DATA
=
{
RESPONSE_DATA
=
{
'label'
:
'question text 101'
,
'label'
:
'question text 101'
,
...
@@ -361,7 +363,7 @@ class TextLineTest(unittest.TestCase):
...
@@ -361,7 +363,7 @@ class TextLineTest(unittest.TestCase):
'trailing_text'
:
expected_text
,
'trailing_text'
:
expected_text
,
'preprocessor'
:
None
,
'preprocessor'
:
None
,
'response_data'
:
RESPONSE_DATA
,
'response_data'
:
RESPONSE_DATA
,
'describedby_html'
:
DESCRIBEDBY
.
format
(
status_id
=
prob_id
)
'describedby_html'
:
TRAILING_TEXT_DESCRIBEDBY
.
format
(
trailing_text_id
=
prob_id
,
status_id
=
prob_id
)
}
}
self
.
assertEqual
(
context
,
expected
)
self
.
assertEqual
(
context
,
expected
)
...
@@ -1295,7 +1297,7 @@ class FormulaEquationTest(unittest.TestCase):
...
@@ -1295,7 +1297,7 @@ class FormulaEquationTest(unittest.TestCase):
'inline'
:
False
,
'inline'
:
False
,
'trailing_text'
:
expected_text
,
'trailing_text'
:
expected_text
,
'response_data'
:
RESPONSE_DATA
,
'response_data'
:
RESPONSE_DATA
,
'describedby_html'
:
DESCRIBEDBY
.
format
(
status_id
=
prob_id
)
'describedby_html'
:
TRAILING_TEXT_DESCRIBEDBY
.
format
(
trailing_text_id
=
prob_id
,
status_id
=
prob_id
)
}
}
self
.
assertEqual
(
context
,
expected
)
self
.
assertEqual
(
context
,
expected
)
...
...
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