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
817febef
Commit
817febef
authored
Dec 07, 2016
by
E. Kolpakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[TNL-6030] Draggable items in bank does not replicate help content over all items
parent
0c4db58c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
15 deletions
+17
-15
drag_and_drop_v2/public/js/drag_and_drop.js
+11
-13
tests/integration/test_interaction.py
+6
-2
No files found.
drag_and_drop_v2/public/js/drag_and_drop.js
View file @
817febef
...
@@ -106,9 +106,9 @@ function DragAndDropTemplates(configuration) {
...
@@ -106,9 +106,9 @@ function DragAndDropTemplates(configuration) {
itemSpinnerTemplate
(
item
)
itemSpinnerTemplate
(
item
)
];
];
var
item_content
=
itemContentTemplate
(
item
);
var
item_content
=
itemContentTemplate
(
item
);
var
item_description
=
null
;
// Insert information about zone in which this item has been placed
// Insert information about zone in which this item has been placed
var
item_description_id
=
configuration
.
url_name
+
'-item-'
+
item
.
value
+
'-description'
;
item_content
.
properties
.
attributes
=
{
'aria-describedby'
:
item_description_id
};
if
(
item
.
is_placed
)
{
if
(
item
.
is_placed
)
{
var
zone_title
=
(
zone
.
title
||
"Unknown Zone"
);
// This "Unknown" text should never be seen, so does not need i18n
var
zone_title
=
(
zone
.
title
||
"Unknown Zone"
);
// This "Unknown" text should never be seen, so does not need i18n
var
description_content
;
var
description_content
;
...
@@ -120,25 +120,23 @@ function DragAndDropTemplates(configuration) {
...
@@ -120,25 +120,23 @@ function DragAndDropTemplates(configuration) {
// so all placed items are always in the correct zone.
// so all placed items are always in the correct zone.
description_content
=
gettext
(
'Correctly placed in: {zone_title}'
).
replace
(
'{zone_title}'
,
zone_title
);
description_content
=
gettext
(
'Correctly placed in: {zone_title}'
).
replace
(
'{zone_title}'
,
zone_title
);
}
}
var
item_description
=
h
(
var
item_description_id
=
configuration
.
url_name
+
'-item-'
+
item
.
value
+
'-description'
;
item_content
.
properties
.
attributes
=
{
'aria-describedby'
:
item_description_id
};
item_description
=
h
(
'div'
,
'div'
,
{
key
:
item
.
value
+
'-description'
,
id
:
item_description_id
,
className
:
descriptionClassName
},
{
key
:
item
.
value
+
'-description'
,
id
:
item_description_id
,
className
:
descriptionClassName
},
description_content
description_content
);
);
}
else
{
var
item_description
=
h
(
'div'
,
{
id
:
item_description_id
,
className
:
descriptionClassName
},
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
);
children
.
splice
(
1
,
0
,
item_content
);
children
.
splice
(
1
,
0
,
item_content
);
if
(
item
.
grabbed
)
{
var
itemSRNote
=
h
(
var
itemGrabbedSRNote
=
h
(
'span'
,
{
className
:
'sr dragged'
},
gettext
(
"draggable, grabbed"
));
'span'
,
children
.
splice
(
2
,
0
,
itemGrabbedSRNote
);
{
className
:
'sr draggable'
},
}
(
item
.
grabbed
)
?
gettext
(
"draggable, grabbed"
)
:
gettext
(
"draggable"
)
);
children
.
splice
(
2
,
0
,
itemSRNote
);
return
(
return
(
h
(
h
(
...
...
tests/integration/test_interaction.py
View file @
817febef
...
@@ -241,8 +241,12 @@ class StandardInteractionTest(DefaultDataTestMixin, InteractionTestBase, Paramet
...
@@ -241,8 +241,12 @@ class StandardInteractionTest(DefaultDataTestMixin, InteractionTestBase, Paramet
keyboard_help_text
=
(
u'Press Ctrl-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"
self
.
assertEqual
(
item
.
find_element_by_css_selector
(
'.sr draggable'
)
.
text
,
"draggable"
)
self
.
assertEqual
(
item
.
find_element_by_css_selector
(
'.sr.dragged'
)
.
text
,
expected_sr_text
)
item
.
send_keys
(
""
)
item
.
send_keys
(
action_key
)
# grabbed an item
self
.
assertEqual
(
item
.
find_element_by_css_selector
(
'.sr draggable'
)
.
text
,
"draggable, grabbed"
)
item
.
send_keys
(
Keys
.
ESCAPE
)
self
.
assertEqual
(
item
.
find_element_by_css_selector
(
'.sr draggable'
)
.
text
,
"draggable"
)
def
test_alt_text_for_zones
(
self
):
def
test_alt_text_for_zones
(
self
):
self
.
_get_popup
()
self
.
_get_popup
()
...
...
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