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
ae0832c4
Commit
ae0832c4
authored
Jan 18, 2016
by
Tim Krones
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #50 from open-craft/fix-keyboard-help
Fix keyboard help hotkey issues
parents
1a119b6e
4ea84c4d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
10 deletions
+28
-10
drag_and_drop_v2/public/js/drag_and_drop.js
+0
-4
drag_and_drop_v2/public/js/view.js
+0
-1
tests/integration/test_interaction.py
+28
-5
No files found.
drag_and_drop_v2/public/js/drag_and_drop.js
View file @
ae0832c4
...
...
@@ -18,7 +18,6 @@ function DragAndDropBlock(runtime, element, configuration) {
var
SPC
=
32
;
var
TAB
=
9
;
var
M
=
77
;
var
QUESTION_MARK
=
63
;
var
placementMode
=
false
;
var
$selectedItem
;
...
...
@@ -47,9 +46,6 @@ function DragAndDropBlock(runtime, element, configuration) {
initDroppable
();
$
(
document
).
on
(
'keydown mousedown touchstart'
,
closePopup
);
$
(
document
).
on
(
'keypress'
,
function
(
evt
)
{
runOnKey
(
evt
,
QUESTION_MARK
,
showKeyboardHelp
);
});
$element
.
on
(
'click'
,
'.keyboard-help-button'
,
showKeyboardHelp
);
$element
.
on
(
'keydown'
,
'.keyboard-help-button'
,
function
(
evt
)
{
runOnKey
(
evt
,
RET
,
showKeyboardHelp
);
...
...
drag_and_drop_v2/public/js/view.js
View file @
ae0832c4
...
...
@@ -180,7 +180,6 @@
h
(
'li'
,
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.'
)),
h
(
'li'
,
gettext
(
'Press "Enter", "Space", "Ctrl-m", or "⌘-m" to drop the item on the current zone.'
)),
h
(
'li'
,
gettext
(
'Press "Escape" if you want to cancel the drop operation (e.g. because you would like to select a different item).'
)),
h
(
'li'
,
gettext
(
'Press "?" at any time to bring up this dialog.'
)),
])
]),
h
(
'div.modal-actions'
,
[
...
...
tests/integration/test_interaction.py
View file @
ae0832c4
...
...
@@ -80,6 +80,14 @@ class InteractionTestBase(object):
element
=
self
.
_get_item_by_value
(
item_value
)
return
element
.
find_element_by_class_name
(
'numerical-input'
)
def
_get_dialog_components
(
self
,
dialog
):
# pylint: disable=no-self-use
dialog_modal_overlay
=
dialog
.
find_element_by_css_selector
(
'.modal-window-overlay'
)
dialog_modal
=
dialog
.
find_element_by_css_selector
(
'.modal-window'
)
return
dialog_modal_overlay
,
dialog_modal
def
_get_dialog_dismiss_button
(
self
,
dialog_modal
):
# pylint: disable=no-self-use
return
dialog_modal
.
find_element_by_css_selector
(
'.modal-dismiss-button'
)
def
_get_zone_position
(
self
,
zone_id
):
return
self
.
browser
.
execute_script
(
'return $("div[data-zone=
\'
{zone_id}
\'
]").prevAll(".zone").length'
.
format
(
zone_id
=
zone_id
)
...
...
@@ -268,9 +276,8 @@ class InteractionTestBase(object):
def
interact_with_keyboard_help
(
self
,
scroll_down
=
250
,
use_keyboard
=
False
):
keyboard_help_button
=
self
.
_get_keyboard_help_button
()
keyboard_help_dialog
=
self
.
_get_keyboard_help_dialog
()
dialog_modal_overlay
=
keyboard_help_dialog
.
find_element_by_css_selector
(
'.modal-window-overlay'
)
dialog_modal
=
keyboard_help_dialog
.
find_element_by_css_selector
(
'.modal-window'
)
dialog_dismiss_button
=
dialog_modal
.
find_element_by_css_selector
(
'.modal-dismiss-button'
)
dialog_modal_overlay
,
dialog_modal
=
self
.
_get_dialog_components
(
keyboard_help_dialog
)
dialog_dismiss_button
=
self
.
_get_dialog_dismiss_button
(
dialog_modal
)
# Scroll "Keyboard help" button into view to make sure Selenium can successfully click it
self
.
scroll_down
(
pixels
=
scroll_down
)
...
...
@@ -291,12 +298,17 @@ class InteractionTestBase(object):
self
.
assertFalse
(
dialog_modal_overlay
.
is_displayed
())
self
.
assertFalse
(
dialog_modal
.
is_displayed
())
if
use_keyboard
:
#
Try again with "?" key
self
.
_page
.
send_keys
(
"?"
)
if
use_keyboard
:
#
Check if "Keyboard Help" dialog can be dismissed using "ESC"
keyboard_help_button
.
send_keys
(
Keys
.
RETURN
)
self
.
assertTrue
(
dialog_modal_overlay
.
is_displayed
())
self
.
assertTrue
(
dialog_modal
.
is_displayed
())
self
.
_page
.
send_keys
(
Keys
.
ESCAPE
)
self
.
assertFalse
(
dialog_modal_overlay
.
is_displayed
())
self
.
assertFalse
(
dialog_modal
.
is_displayed
())
class
BasicInteractionTest
(
InteractionTestBase
):
"""
...
...
@@ -482,3 +494,14 @@ class MultipleBlocksDataInteraction(InteractionTestBase, BaseIntegrationTest):
self
.
parameterized_final_feedback_and_reset
(
self
.
item_maps
[
'block1'
],
self
.
feedback
[
'block1'
])
self
.
_switch_to_block
(
1
)
self
.
parameterized_final_feedback_and_reset
(
self
.
item_maps
[
'block2'
],
self
.
feedback
[
'block2'
],
scroll_down
=
900
)
def
test_keyboard_help
(
self
):
self
.
_switch_to_block
(
0
)
# Test mouse and keyboard interaction
self
.
interact_with_keyboard_help
()
self
.
interact_with_keyboard_help
(
use_keyboard
=
True
)
self
.
_switch_to_block
(
1
)
# Test mouse and keyboard interaction
self
.
interact_with_keyboard_help
(
scroll_down
=
900
)
self
.
interact_with_keyboard_help
(
scroll_down
=
0
,
use_keyboard
=
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