Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xblock-vectordraw
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-vectordraw
Commits
461371b2
Commit
461371b2
authored
Dec 09, 2015
by
Tim Krones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Address upstream review comments.
parent
c03551d9
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
16 deletions
+23
-16
tests/integration/test_vectordraw.py
+12
-10
tests/integration/xml/custom.xml
+1
-1
vectordraw/public/css/vectordraw.css
+1
-1
vectordraw/templates/html/vectordraw.html
+2
-2
vectordraw/vectordraw.py
+7
-2
No files found.
tests/integration/test_vectordraw.py
View file @
461371b2
...
@@ -89,7 +89,8 @@ class TestVectorDraw(StudioEditableBaseTest):
...
@@ -89,7 +89,8 @@ class TestVectorDraw(StudioEditableBaseTest):
self
.
assertEquals
(
add_vector
.
text
,
add_vector_label
)
self
.
assertEquals
(
add_vector
.
text
,
add_vector_label
)
# "Reset" button
# "Reset" button
reset
=
controls
.
find_element_by_css_selector
(
".reset"
)
reset
=
controls
.
find_element_by_css_selector
(
".reset"
)
self
.
assertEquals
(
reset
.
text
,
"Reset"
)
reset_label
=
reset
.
find_element_by_css_selector
(
'.reset-label'
)
self
.
assertEquals
(
reset_label
.
text
,
"Reset"
)
reset
.
find_element_by_css_selector
(
".sr"
)
reset
.
find_element_by_css_selector
(
".sr"
)
self
.
assert_hidden_text
(
".reset > .sr"
,
"Reset board to initial state"
)
self
.
assert_hidden_text
(
".reset > .sr"
,
"Reset board to initial state"
)
# "Redo" button
# "Redo" button
...
@@ -173,7 +174,8 @@ class TestVectorDraw(StudioEditableBaseTest):
...
@@ -173,7 +174,8 @@ class TestVectorDraw(StudioEditableBaseTest):
actions
=
self
.
exercise
.
find_element_by_css_selector
(
".action"
)
actions
=
self
.
exercise
.
find_element_by_css_selector
(
".action"
)
self
.
assertTrue
(
actions
.
is_displayed
())
self
.
assertTrue
(
actions
.
is_displayed
())
check
=
actions
.
find_element_by_css_selector
(
".check"
)
check
=
actions
.
find_element_by_css_selector
(
".check"
)
self
.
assertEquals
(
check
.
text
,
"CHECK"
)
check_label
=
check
.
find_element_by_css_selector
(
".check-label"
)
self
.
assertEquals
(
check_label
.
text
,
"CHECK"
)
check
.
find_element_by_css_selector
(
".sr"
)
check
.
find_element_by_css_selector
(
".sr"
)
self
.
assert_hidden_text
(
".check > .sr"
,
"Check your answer"
)
self
.
assert_hidden_text
(
".check > .sr"
,
"Check your answer"
)
...
@@ -191,11 +193,11 @@ class TestVectorDraw(StudioEditableBaseTest):
...
@@ -191,11 +193,11 @@ class TestVectorDraw(StudioEditableBaseTest):
non_fixed_points
=
[
point
for
point
in
points
if
not
point
[
"fixed"
]]
non_fixed_points
=
[
point
for
point
in
points
if
not
point
[
"fixed"
]]
self
.
assert_add_options
(
dropdown
,
non_fixed_points
,
"point"
)
self
.
assert_add_options
(
dropdown
,
non_fixed_points
,
"point"
)
# Check label
# Check label
label_id
=
"element-list-add-label"
label_selector
=
"label.sr"
label_selector
=
"#"
+
label_id
select_label
=
controls
.
find_element_by_css_selector
(
label_selector
)
controls
.
find_element_by_css_selector
(
label_selector
)
self
.
assert_hidden_text
(
label_selector
,
"Select element to add to board"
)
self
.
assert_hidden_text
(
label_selector
,
"Select element to add to board"
)
self
.
assertEquals
(
dropdown
.
get_attribute
(
"aria-labelledby"
),
label_id
)
select_id
=
"element-list"
self
.
assertEquals
(
select_label
.
get_attribute
(
"for"
),
select_id
)
def
assert_add_options
(
self
,
dropdown
,
elements
,
element_type
):
def
assert_add_options
(
self
,
dropdown
,
elements
,
element_type
):
element_options
=
dropdown
.
find_elements_by_css_selector
(
'option[value^="{}-"]'
.
format
(
element_type
))
element_options
=
dropdown
.
find_elements_by_css_selector
(
'option[value^="{}-"]'
.
format
(
element_type
))
...
@@ -407,19 +409,19 @@ class TestVectorDraw(StudioEditableBaseTest):
...
@@ -407,19 +409,19 @@ class TestVectorDraw(StudioEditableBaseTest):
# Check board
# Check board
board
=
self
.
exercise
.
find_element_by_css_selector
(
"#jxgboard1"
)
board
=
self
.
exercise
.
find_element_by_css_selector
(
"#jxgboard1"
)
self
.
assert_dimensions
(
board
)
self
.
assert_dimensions
(
board
)
self
.
assert_axis
(
board
)
self
.
assert_axis
(
board
,
is_present
=
True
)
self
.
assert_navigation_bar
(
board
)
self
.
assert_navigation_bar
(
board
)
self
.
assert_background
(
board
)
self
.
assert_background
(
board
)
# - Vectors
# - Vectors
self
.
assert_not_present
(
self
.
assert_not_present
(
board
,
board
,
"line
"
,
"line
[aria-labelledby]"
,
# axes (which are present by default) don't have aria-labelledby attribute
"Board should not contain any vectors or lines by default."
"Board should not contain any vectors or lines by default."
)
)
# - Points
# - Points
self
.
assert_not_present
(
self
.
assert_not_present
(
board
,
board
,
"ellipse
"
,
"ellipse
:not([display])"
,
# points don't have in-line "display" property
"Board should not contain any points by default."
"Board should not contain any points by default."
)
)
...
@@ -509,7 +511,7 @@ class TestVectorDraw(StudioEditableBaseTest):
...
@@ -509,7 +511,7 @@ class TestVectorDraw(StudioEditableBaseTest):
# Check board
# Check board
board
=
self
.
exercise
.
find_element_by_css_selector
(
"#jxgboard1"
)
board
=
self
.
exercise
.
find_element_by_css_selector
(
"#jxgboard1"
)
self
.
assert_dimensions
(
board
,
expected_width
=
"600px"
,
expected_height
=
"450px"
)
self
.
assert_dimensions
(
board
,
expected_width
=
"600px"
,
expected_height
=
"450px"
)
self
.
assert_axis
(
board
,
is_present
=
True
)
self
.
assert_axis
(
board
)
self
.
assert_navigation_bar
(
board
,
is_present
=
True
)
self
.
assert_navigation_bar
(
board
,
is_present
=
True
)
self
.
assert_background
(
board
,
is_present
=
True
)
self
.
assert_background
(
board
,
is_present
=
True
)
# - Vectors
# - Vectors
...
...
tests/integration/xml/custom.xml
View file @
461371b2
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
description=
"Custom exercise description"
description=
"Custom exercise description"
width=
"600"
width=
"600"
height=
"450"
height=
"450"
axis=
"
tru
e"
axis=
"
fals
e"
show_navigation=
"true"
show_navigation=
"true"
show_vector_properties=
"{{ show_vector_properties }}"
show_vector_properties=
"{{ show_vector_properties }}"
show_slope_for_lines=
"true"
show_slope_for_lines=
"true"
...
...
vectordraw/public/css/vectordraw.css
View file @
461371b2
...
@@ -63,6 +63,7 @@
...
@@ -63,6 +63,7 @@
text-decoration
:
none
;
text-decoration
:
none
;
}
}
.vectordraw_block
.menu
button
:focus
,
.vectordraw_block
.menu
button
:hover
{
.vectordraw_block
.menu
button
:hover
{
background
:
#c2e0f4
;
background
:
#c2e0f4
;
background-image
:
-webkit-linear-gradient
(
top
,
#c2e0f4
,
#add5f0
);
background-image
:
-webkit-linear-gradient
(
top
,
#c2e0f4
,
#add5f0
);
...
@@ -143,7 +144,6 @@
...
@@ -143,7 +144,6 @@
/* Make sure screen-reader content is hidden in the workbench: */
/* Make sure screen-reader content is hidden in the workbench: */
.vectordraw_block
.sr
{
.vectordraw_block
.sr
{
display
:
none
;
border
:
0
;
border
:
0
;
clip
:
rect
(
0
0
0
0
);
clip
:
rect
(
0
0
0
0
);
height
:
1px
;
height
:
1px
;
...
...
vectordraw/templates/html/vectordraw.html
View file @
461371b2
...
@@ -12,8 +12,8 @@
...
@@ -12,8 +12,8 @@
<div
id=
"vectordraw"
>
<div
id=
"vectordraw"
>
<div
class=
"menu"
style=
"width: {{ self.width }}px;"
>
<div
class=
"menu"
style=
"width: {{ self.width }}px;"
>
<div
class=
"controls"
>
<div
class=
"controls"
>
<
span
class=
"sr"
id=
"element-list-add-label"
>
{% trans "Select element to add to board" %}
</span
>
<
label
class=
"sr"
for=
"element-list"
>
{% trans "Select element to add to board" %}
</label
>
<select
class=
"element-list-add"
aria-labelledby=
"element-list-add-label
"
>
<select
id=
"element-list"
class=
"element-list-add
"
>
{% for vector in self.get_vectors %}
{% for vector in self.get_vectors %}
<option
value=
"vector-{{ forloop.counter0 }}"
>
<option
value=
"vector-{{ forloop.counter0 }}"
>
{{ vector.description }}
{{ vector.description }}
...
...
vectordraw/vectordraw.py
View file @
461371b2
...
@@ -74,8 +74,13 @@ class VectorDrawXBlock(StudioEditableXBlockMixin, XBlock):
...
@@ -74,8 +74,13 @@ class VectorDrawXBlock(StudioEditableXBlockMixin, XBlock):
axis
=
Boolean
(
axis
=
Boolean
(
display_name
=
"Show axis"
,
display_name
=
"Show axis"
,
help
=
"Show the graph axis"
,
help
=
(
default
=
False
,
"Show the graph axis. "
"Will also show grid lines (but note that the background image might cover them). "
"Enabling this option makes the exercise more accessible for users "
"relying on the keyboard for manipulating vectors."
),
default
=
True
,
scope
=
Scope
.
content
scope
=
Scope
.
content
)
)
...
...
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