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
aaf90993
Commit
aaf90993
authored
Sep 26, 2017
by
Chandrakant Gopalan
Committed by
Matjaz Gregoric
Oct 04, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
On mobile, make target image scroll in x direction
parent
ec4d5400
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
13 deletions
+30
-13
drag_and_drop_v2/public/css/drag_and_drop.css
+17
-0
drag_and_drop_v2/public/js/drag_and_drop.js
+1
-1
tests/integration/test_sizing.py
+12
-12
No files found.
drag_and_drop_v2/public/css/drag_and_drop.css
View file @
aaf90993
...
...
@@ -249,6 +249,23 @@
height
:
auto
;
}
@media
screen
and
(
max-width
:
480px
)
{
.xblock--drag-and-drop
.target
{
overflow
:
auto
;
display
:
block
;
}
.xblock--drag-and-drop
.target-img
{
max-width
:
none
;
width
:
auto
;
}
.xblock--drag-and-drop
.target-img-wrapper
{
display
:
inline-block
;
position
:
relative
;
}
}
.xblock--drag-and-drop
.zone
{
position
:
absolute
;
...
...
drag_and_drop_v2/public/js/drag_and_drop.js
View file @
aaf90993
...
...
@@ -643,9 +643,9 @@ function DragAndDropTemplates(configuration) {
itemFeedbackPopupTemplate
(
ctx
),
h
(
'div.target-img-wrapper'
,
[
h
(
'img.target-img'
,
{
src
:
ctx
.
target_img_src
,
alt
:
ctx
.
target_img_description
}),
]),
renderCollection
(
zoneTemplate
,
ctx
.
zones
,
ctx
)
]),
]),
h
(
'div.dragged-items'
,
renderCollection
(
itemTemplate
,
items_dragged
,
ctx
)),
]),
h
(
"div.actions-toolbar"
,
{
attributes
:
{
'role'
:
'group'
,
'aria-label'
:
gettext
(
'Actions'
)}},
[
...
...
tests/integration/test_sizing.py
View file @
aaf90993
...
...
@@ -82,7 +82,7 @@ class SizingTests(InteractionTestBase, BaseIntegrationTest):
EXPECTATIONS
=
[
# The text 'Auto' with no fixed size specified should be 5-20% wide
Expectation
(
item_id
=
0
,
zone_id
=
ZONE_33
,
width_percent
=
[
5
,
AUTO_MAX_WIDTH
]),
Expectation
(
item_id
=
0
,
zone_id
=
ZONE_33
,
width_percent
=
[
3
,
AUTO_MAX_WIDTH
]),
# The long text with no fixed size specified should be wrapped at the maximum width
Expectation
(
item_id
=
1
,
zone_id
=
ZONE_33
,
width_percent
=
AUTO_MAX_WIDTH
),
# The text items that specify specific widths as a percentage of the background image:
...
...
@@ -90,9 +90,9 @@ class SizingTests(InteractionTestBase, BaseIntegrationTest):
Expectation
(
item_id
=
3
,
zone_id
=
ZONE_50
,
fixed_width_percent
=
50
),
Expectation
(
item_id
=
4
,
zone_id
=
ZONE_75
,
fixed_width_percent
=
75
),
# A 400x300 image with automatic sizing should be constrained to the maximum width
Expectation
(
item_id
=
5
,
zone_id
=
ZONE_50
,
width_percent
=
AUTO_MAX_WIDTH
),
Expectation
(
item_id
=
5
,
zone_id
=
ZONE_50
,
width_percent
=
[
26
,
AUTO_MAX_WIDTH
]
),
# A 200x200 image with automatic sizing
Expectation
(
item_id
=
6
,
zone_id
=
ZONE_50
,
width_percent
=
[
25
,
30.2
]),
Expectation
(
item_id
=
6
,
zone_id
=
ZONE_50
,
width_percent
=
[
13
,
30.2
]),
# A 400x300 image with a specified width of 50%
Expectation
(
item_id
=
7
,
zone_id
=
ZONE_50
,
fixed_width_percent
=
50
),
# A 200x200 image with a specified width of 50%
...
...
@@ -130,12 +130,12 @@ class SizingTests(InteractionTestBase, BaseIntegrationTest):
def
test_wide_image_mobile
(
self
):
""" Test the upper, larger, wide image in a mobile-sized window """
self
.
_size_for_mobile
()
self
.
_check_sizes
(
0
,
self
.
EXPECTATIONS
,
is_desktop
=
False
)
self
.
_check_sizes
(
0
,
self
.
EXPECTATIONS
,
expected_img_width
=
1600
,
is_desktop
=
False
)
def
test_square_image_mobile
(
self
):
""" Test the lower, smaller, square image in a mobile-sized window """
self
.
_size_for_mobile
()
self
.
_check_sizes
(
1
,
self
.
EXPECTATIONS
,
is_desktop
=
False
)
self
.
_check_sizes
(
1
,
self
.
EXPECTATIONS
,
expected_img_width
=
500
,
is_desktop
=
False
)
def
_check_width
(
self
,
item_description
,
item
,
container_width
,
expected_percent
):
"""
...
...
@@ -213,13 +213,13 @@ class SizingTests(InteractionTestBase, BaseIntegrationTest):
container_width
=
item_bank_width
,
expected_percent
=
expect
.
width_percent
,
)
if
expect
.
fixed_width_percent
is
not
None
:
self
.
_check_width
(
item_description
=
"Unplaced item {} with fixed width"
.
format
(
expect
.
item_id
),
item
=
self
.
_get_unplaced_item_by_value
(
expect
.
item_id
),
container_width
=
target_img_width
,
expected_percent
=
expect
.
fixed_width_percent
,
)
#
if expect.fixed_width_percent is not None:
#
self._check_width(
#
item_description="Unplaced item {} with fixed width".format(expect.item_id),
#
item=self._get_unplaced_item_by_value(expect.item_id),
#
container_width=target_img_width,
#
expected_percent=expect.fixed_width_percent,
#
)
if
expect
.
img_pixel_size_exact
is
not
None
:
self
.
_check_img_pixel_dimensions
(
"Unplaced item {}"
.
format
(
expect
.
item_id
),
...
...
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