Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xblock-drag-and-drop-v2
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
OpenEdx
xblock-drag-and-drop-v2
Commits
3dfe5ac9
Commit
3dfe5ac9
authored
Dec 07, 2016
by
E. Kolpakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[TNL-6021] Disabled Space, Enter and Command+M dragging
parent
ab7f7b74
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
17 deletions
+17
-17
drag_and_drop_v2/public/js/drag_and_drop.js
+2
-6
tests/integration/test_interaction.py
+8
-6
tests/integration/test_interaction_assessment.py
+7
-5
No files found.
drag_and_drop_v2/public/js/drag_and_drop.js
View file @
3dfe5ac9
...
@@ -126,7 +126,7 @@ function DragAndDropTemplates(configuration) {
...
@@ -126,7 +126,7 @@ function DragAndDropTemplates(configuration) {
var
item_description
=
h
(
var
item_description
=
h
(
'div'
,
'div'
,
{
id
:
item_description_id
,
className
:
descriptionClassName
},
{
id
:
item_description_id
,
className
:
descriptionClassName
},
gettext
(
'Press
"Enter", "Space", "Ctrl-m", or "⌘-m"
on an item to select it for dropping, then navigate to the zone you want to drop it on.'
)
gettext
(
'Press
Ctrl-m
on an item to select it for dropping, then navigate to the zone you want to drop it on.'
)
);
);
}
}
children
.
splice
(
1
,
0
,
item_description
);
children
.
splice
(
1
,
0
,
item_description
);
...
@@ -858,11 +858,7 @@ function DragAndDropBlock(runtime, element, configuration) {
...
@@ -858,11 +858,7 @@ function DragAndDropBlock(runtime, element, configuration) {
};
};
var
isActionKey
=
function
(
evt
)
{
var
isActionKey
=
function
(
evt
)
{
var
key
=
evt
.
which
;
return
evt
.
which
==
RET
||
(
evt
.
ctrlKey
&&
evt
.
which
==
M
);
if
(
evt
.
ctrlKey
||
evt
.
metaKey
)
{
return
key
===
M
;
}
return
key
===
RET
||
key
===
SPC
;
};
};
var
isSpaceKey
=
function
(
evt
)
{
var
isSpaceKey
=
function
(
evt
)
{
...
...
tests/integration/test_interaction.py
View file @
3dfe5ac9
...
@@ -23,6 +23,8 @@ loader = ResourceLoader(__name__)
...
@@ -23,6 +23,8 @@ loader = ResourceLoader(__name__)
# Classes ###########################################################
# Classes ###########################################################
ITEM_DRAG_KEYBOARD_KEYS
=
(
None
,
Keys
.
RETURN
,
Keys
.
CONTROL
+
'm'
)
class
ParameterizedTestsMixin
(
object
):
class
ParameterizedTestsMixin
(
object
):
def
parameterized_item_positive_feedback_on_good_move
(
def
parameterized_item_positive_feedback_on_good_move
(
...
@@ -211,15 +213,15 @@ class StandardInteractionTest(DefaultDataTestMixin, InteractionTestBase, Paramet
...
@@ -211,15 +213,15 @@ class StandardInteractionTest(DefaultDataTestMixin, InteractionTestBase, Paramet
All interactions are tested using mouse (action_key=None) and four different keyboard action keys.
All interactions are tested using mouse (action_key=None) and four different keyboard action keys.
If default data changes this will break.
If default data changes this will break.
"""
"""
@data
(
None
,
Keys
.
RETURN
,
Keys
.
SPACE
,
Keys
.
CONTROL
+
'm'
,
Keys
.
COMMAND
+
'm'
)
@data
(
*
ITEM_DRAG_KEYBOARD_KEYS
)
def
test_item_positive_feedback_on_good_move
(
self
,
action_key
):
def
test_item_positive_feedback_on_good_move
(
self
,
action_key
):
self
.
parameterized_item_positive_feedback_on_good_move
(
self
.
items_map
,
action_key
=
action_key
)
self
.
parameterized_item_positive_feedback_on_good_move
(
self
.
items_map
,
action_key
=
action_key
)
@data
(
None
,
Keys
.
RETURN
,
Keys
.
SPACE
,
Keys
.
CONTROL
+
'm'
,
Keys
.
COMMAND
+
'm'
)
@data
(
*
ITEM_DRAG_KEYBOARD_KEYS
)
def
test_item_negative_feedback_on_bad_move
(
self
,
action_key
):
def
test_item_negative_feedback_on_bad_move
(
self
,
action_key
):
self
.
parameterized_item_negative_feedback_on_bad_move
(
self
.
items_map
,
self
.
all_zones
,
action_key
=
action_key
)
self
.
parameterized_item_negative_feedback_on_bad_move
(
self
.
items_map
,
self
.
all_zones
,
action_key
=
action_key
)
@data
(
None
,
Keys
.
RETURN
,
Keys
.
SPACE
,
Keys
.
CONTROL
+
'm'
,
Keys
.
COMMAND
+
'm'
)
@data
(
*
ITEM_DRAG_KEYBOARD_KEYS
)
def
test_cannot_move_items_between_zones
(
self
,
action_key
):
def
test_cannot_move_items_between_zones
(
self
,
action_key
):
self
.
parameterized_cannot_move_items_between_zones
(
self
.
parameterized_cannot_move_items_between_zones
(
self
.
items_map
,
self
.
all_zones
,
action_key
=
action_key
self
.
items_map
,
self
.
all_zones
,
action_key
=
action_key
...
@@ -236,7 +238,7 @@ class StandardInteractionTest(DefaultDataTestMixin, InteractionTestBase, Paramet
...
@@ -236,7 +238,7 @@ class StandardInteractionTest(DefaultDataTestMixin, InteractionTestBase, Paramet
for
_
,
definition
in
self
.
items_map
.
items
():
for
_
,
definition
in
self
.
items_map
.
items
():
item
=
self
.
_get_unplaced_item_by_value
(
definition
.
item_id
)
item
=
self
.
_get_unplaced_item_by_value
(
definition
.
item_id
)
ActionChains
(
self
.
browser
)
.
move_to_element
(
item
)
.
perform
()
ActionChains
(
self
.
browser
)
.
move_to_element
(
item
)
.
perform
()
keyboard_help_text
=
(
u'Press
"Enter", "Space", "Ctrl-m", or "⌘-m"
on an item to select it for dropping, '
keyboard_help_text
=
(
u'Press
Ctrl-m
on an item to select it for dropping, '
'then navigate to the zone you want to drop it on.'
)
'then navigate to the zone you want to drop it on.'
)
self
.
assertEqual
(
item
.
find_element_by_css_selector
(
'.sr.description'
)
.
text
,
keyboard_help_text
)
self
.
assertEqual
(
item
.
find_element_by_css_selector
(
'.sr.description'
)
.
text
,
keyboard_help_text
)
expected_sr_text
=
"draggable, grabbed"
expected_sr_text
=
"draggable, grabbed"
...
@@ -266,7 +268,7 @@ class StandardInteractionTest(DefaultDataTestMixin, InteractionTestBase, Paramet
...
@@ -266,7 +268,7 @@ class StandardInteractionTest(DefaultDataTestMixin, InteractionTestBase, Paramet
self
.
wait_until_visible
(
item_content
)
self
.
wait_until_visible
(
item_content
)
self
.
assertTrue
(
item_content
.
text
in
zone_description
)
self
.
assertTrue
(
item_content
.
text
in
zone_description
)
@data
(
None
,
Keys
.
RETURN
,
Keys
.
SPACE
,
Keys
.
CONTROL
+
'm'
,
Keys
.
COMMAND
+
'm'
)
@data
(
*
ITEM_DRAG_KEYBOARD_KEYS
)
def
test_final_feedback_and_reset
(
self
,
action_key
):
def
test_final_feedback_and_reset
(
self
,
action_key
):
self
.
parameterized_final_feedback_and_reset
(
self
.
items_map
,
self
.
feedback
,
action_key
=
action_key
)
self
.
parameterized_final_feedback_and_reset
(
self
.
items_map
,
self
.
feedback
,
action_key
=
action_key
)
...
@@ -479,7 +481,7 @@ class ZoneAlignInteractionTest(InteractionTestBase, BaseIntegrationTest):
...
@@ -479,7 +481,7 @@ class ZoneAlignInteractionTest(InteractionTestBase, BaseIntegrationTest):
"""
"""
PAGE_TITLE
=
'Drag and Drop v2'
PAGE_TITLE
=
'Drag and Drop v2'
PAGE_ID
=
'drag_and_drop_v2'
PAGE_ID
=
'drag_and_drop_v2'
ACTION_KEYS
=
(
None
,
Keys
.
RETURN
,
Keys
.
SPACE
,
Keys
.
CONTROL
+
'm'
,
Keys
.
COMMAND
+
'm'
)
ACTION_KEYS
=
ITEM_DRAG_KEYBOARD_KEYS
def
setUp
(
self
):
def
setUp
(
self
):
super
(
ZoneAlignInteractionTest
,
self
)
.
setUp
()
super
(
ZoneAlignInteractionTest
,
self
)
.
setUp
()
...
...
tests/integration/test_interaction_assessment.py
View file @
3dfe5ac9
...
@@ -18,7 +18,9 @@ from drag_and_drop_v2.default_data import (
...
@@ -18,7 +18,9 @@ from drag_and_drop_v2.default_data import (
)
)
from
drag_and_drop_v2.utils
import
FeedbackMessages
,
Constants
from
drag_and_drop_v2.utils
import
FeedbackMessages
,
Constants
from
.test_base
import
BaseIntegrationTest
from
.test_base
import
BaseIntegrationTest
from
.test_interaction
import
InteractionTestBase
,
DefaultDataTestMixin
,
ParameterizedTestsMixin
,
TestMaxItemsPerZone
from
.test_interaction
import
(
InteractionTestBase
,
DefaultDataTestMixin
,
ParameterizedTestsMixin
,
TestMaxItemsPerZone
,
ITEM_DRAG_KEYBOARD_KEYS
)
# Globals ###########################################################
# Globals ###########################################################
...
@@ -76,25 +78,25 @@ class AssessmentInteractionTest(
...
@@ -76,25 +78,25 @@ class AssessmentInteractionTest(
All interactions are tested using mouse (action_key=None) and four different keyboard action keys.
All interactions are tested using mouse (action_key=None) and four different keyboard action keys.
If default data changes this will break.
If default data changes this will break.
"""
"""
@data
(
None
,
Keys
.
RETURN
,
Keys
.
SPACE
,
Keys
.
CONTROL
+
'm'
,
Keys
.
COMMAND
+
'm'
)
@data
(
*
ITEM_DRAG_KEYBOARD_KEYS
)
def
test_item_no_feedback_on_good_move
(
self
,
action_key
):
def
test_item_no_feedback_on_good_move
(
self
,
action_key
):
self
.
parameterized_item_positive_feedback_on_good_move
(
self
.
parameterized_item_positive_feedback_on_good_move
(
self
.
items_map
,
action_key
=
action_key
,
assessment_mode
=
True
self
.
items_map
,
action_key
=
action_key
,
assessment_mode
=
True
)
)
@data
(
None
,
Keys
.
RETURN
,
Keys
.
SPACE
,
Keys
.
CONTROL
+
'm'
,
Keys
.
COMMAND
+
'm'
)
@data
(
*
ITEM_DRAG_KEYBOARD_KEYS
)
def
test_item_no_feedback_on_bad_move
(
self
,
action_key
):
def
test_item_no_feedback_on_bad_move
(
self
,
action_key
):
self
.
parameterized_item_negative_feedback_on_bad_move
(
self
.
parameterized_item_negative_feedback_on_bad_move
(
self
.
items_map
,
self
.
all_zones
,
action_key
=
action_key
,
assessment_mode
=
True
self
.
items_map
,
self
.
all_zones
,
action_key
=
action_key
,
assessment_mode
=
True
)
)
@data
(
None
,
Keys
.
RETURN
,
Keys
.
SPACE
,
Keys
.
CONTROL
+
'm'
,
Keys
.
COMMAND
+
'm'
)
@data
(
*
ITEM_DRAG_KEYBOARD_KEYS
)
def
test_move_items_between_zones
(
self
,
action_key
):
def
test_move_items_between_zones
(
self
,
action_key
):
self
.
parameterized_move_items_between_zones
(
self
.
parameterized_move_items_between_zones
(
self
.
items_map
,
self
.
all_zones
,
action_key
=
action_key
self
.
items_map
,
self
.
all_zones
,
action_key
=
action_key
)
)
@data
(
None
,
Keys
.
RETURN
,
Keys
.
SPACE
,
Keys
.
CONTROL
+
'm'
,
Keys
.
COMMAND
+
'm'
)
@data
(
*
ITEM_DRAG_KEYBOARD_KEYS
)
def
test_final_feedback_and_reset
(
self
,
action_key
):
def
test_final_feedback_and_reset
(
self
,
action_key
):
self
.
parameterized_final_feedback_and_reset
(
self
.
parameterized_final_feedback_and_reset
(
self
.
items_map
,
self
.
feedback
,
action_key
=
action_key
,
assessment_mode
=
True
self
.
items_map
,
self
.
feedback
,
action_key
=
action_key
,
assessment_mode
=
True
...
...
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