Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xblock-poll
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
xblock-poll
Commits
721db61d
Commit
721db61d
authored
Mar 13, 2017
by
Matjaz Gregoric
Committed by
GitHub
Mar 13, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #24 from arizzitano/arizzitano/a11y-fixes
survey a11y improvements
parents
67933f1e
086b8039
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
9 deletions
+13
-9
poll/public/html/survey.html
+8
-4
setup.py
+1
-1
tests/integration/test_functions.py
+4
-4
No files found.
poll/public/html/survey.html
View file @
721db61d
...
...
@@ -9,13 +9,13 @@
<tr>
<td></td>
{% for answer, label in answers %}
<th
id=
"poll-{{block_id}}-{{answer}}"
class=
"survey-answer"
>
{{label}}
</th>
<th
id=
"poll-{{block_id}}-{{answer}}"
class=
"survey-answer"
scope=
"col"
>
{{label}}
</th>
{% endfor %}
</tr>
</thead>
{% for key, question in questions %}
<tr
class=
"survey-row"
role=
"group"
aria-labelledby=
"poll-{{block_id}}-{{key}}"
>
<th
id=
"poll-{{block_id}}-{{key}}"
class=
"survey-question"
>
<th
id=
"poll-{{block_id}}-{{key}}"
class=
"survey-question"
scope=
"row"
>
{% if question.img %}
<div
class=
"poll-image-td"
>
<img
src=
"{{question.img}}"
alt=
"{{question.img_alt|default_if_none:''}}"
/>
...
...
@@ -24,12 +24,16 @@
{{question.label|safe}}
</th>
{% for answer, label in answers %}
<td
class=
"survey-option"
>
<td
class=
"survey-option"
headers=
"poll-{{block_id}}-{{key}} poll-{{block_id}}-{{answer}}"
>
<label>
<input
type=
"radio"
name=
"{{key}}"
value=
"{{answer}}"
{%
if
question
.
choice =
=
answer
%}
checked
{%
endif
%}
aria-labelledby=
"poll-{{block_id}}-{{answer}}"
{%
if
question
.
img_alt
%}
aria-label=
"{{question.img_alt}} {{label}}"
{%
else
%}
aria-label=
"{{question.label|striptags}} {{label}}"
{%
endif
%}
/>
</label>
</td>
...
...
setup.py
View file @
721db61d
...
...
@@ -44,7 +44,7 @@ def package_data(pkg, roots):
setup
(
name
=
'xblock-poll'
,
version
=
'1.2.
5
'
,
version
=
'1.2.
6
'
,
description
=
'An XBlock for polling users.'
,
packages
=
[
'poll'
,
...
...
tests/integration/test_functions.py
View file @
721db61d
...
...
@@ -176,17 +176,17 @@ class TestSurveyFunctions(PollBaseTest):
self
.
go_to_page
(
'Survey Functions'
)
questions
=
self
.
browser
.
find_elements_by_css_selector
(
'.survey-question'
)
answers
=
self
.
browser
.
find_elements_by_css_selector
(
'.survey-answer'
)
question_
ids
=
[
question
.
get_attribute
(
'id'
)
for
question
in
questions
]
answer_
ids
=
[
answer
.
get_attribute
(
'id'
)
for
answer
in
answers
]
question_
text
=
[
question
.
text
for
question
in
questions
]
answer_
text
=
[
answer
.
text
for
answer
in
answers
]
rows
=
self
.
browser
.
find_elements_by_css_selector
(
'.survey-row'
)
self
.
assertEqual
(
len
(
rows
),
len
(
questions
))
for
i
,
row
in
enumerate
(
rows
):
self
.
assertEqual
(
row
.
get_attribute
(
'role'
),
'group'
)
self
.
assertEqual
(
row
.
get_attribute
(
'aria-labelledby'
),
question_ids
[
i
])
options
=
row
.
find_elements_by_css_selector
(
'.survey-option input'
)
self
.
assertEqual
(
len
(
options
),
len
(
answers
))
for
j
,
option
in
enumerate
(
options
):
self
.
assertEqual
(
option
.
get_attribute
(
'aria-labelledby'
),
answer_ids
[
j
])
self
.
assertIn
(
answer_text
[
j
],
option
.
get_attribute
(
'aria-label'
))
self
.
assertIn
(
question_text
[
i
],
option
.
get_attribute
(
'aria-label'
))
def
fill_survey
(
self
,
assert_submit
=
False
):
"""
...
...
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