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
f5f9f386
Commit
f5f9f386
authored
Jan 18, 2016
by
Braden MacDonald
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix corner case: image smaller than author-specified draggable width
parent
6b977414
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
0 deletions
+21
-0
drag_and_drop_v2/public/css/drag_and_drop.css
+4
-0
drag_and_drop_v2/public/js/view.js
+3
-0
tests/integration/test_sizing.py
+14
-0
No files found.
drag_and_drop_v2/public/css/drag_and_drop.css
View file @
f5f9f386
...
@@ -80,6 +80,10 @@
...
@@ -80,6 +80,10 @@
z-index
:
10
!important
;
z-index
:
10
!important
;
}
}
.xblock--drag-and-drop
.drag-container
.option.specified-width
img
{
width
:
100%
;
/* If the image is smaller than the specified width, make it larger */
}
.xblock--drag-and-drop
.drag-container
.option
.spinner-wrapper
{
.xblock--drag-and-drop
.drag-container
.option
.spinner-wrapper
{
margin-right
:
3px
;
margin-right
:
3px
;
float
:
left
;
float
:
left
;
...
...
drag_and_drop_v2/public/js/view.js
View file @
f5f9f386
...
@@ -58,6 +58,9 @@
...
@@ -58,6 +58,9 @@
if
(
item
.
has_image
)
{
if
(
item
.
has_image
)
{
className
+=
" "
+
"option-with-image"
;
className
+=
" "
+
"option-with-image"
;
}
}
if
(
item
.
widthPercent
)
{
className
+=
" specified-width"
;
// The author has specified a width for this item.
}
var
attributes
=
{
var
attributes
=
{
'draggable'
:
!
item
.
drag_disabled
,
'draggable'
:
!
item
.
drag_disabled
,
'aria-grabbed'
:
item
.
grabbed
,
'aria-grabbed'
:
item
.
grabbed
,
...
...
tests/integration/test_sizing.py
View file @
f5f9f386
...
@@ -40,6 +40,9 @@ class SizingTests(InteractionTestBase, BaseIntegrationTest):
...
@@ -40,6 +40,9 @@ class SizingTests(InteractionTestBase, BaseIntegrationTest):
Tip: To see how these tests work, throw in an 'import time; time.sleep(200)' at the start of
Tip: To see how these tests work, throw in an 'import time; time.sleep(200)' at the start of
one of the tests, so you can check it out in the selenium browser window that opens.
one of the tests, so you can check it out in the selenium browser window that opens.
These tests intentionally do not use ddt in order to run faster. Instead, each test iterates
through data and uses verbose assertion messages to clearly indicate where failures occur.
"""
"""
PAGE_TITLE
=
'Drag and Drop v2 Sizing'
PAGE_TITLE
=
'Drag and Drop v2 Sizing'
PAGE_ID
=
'drag_and_drop_v2_sizing'
PAGE_ID
=
'drag_and_drop_v2_sizing'
...
@@ -121,6 +124,17 @@ class SizingTests(InteractionTestBase, BaseIntegrationTest):
...
@@ -121,6 +124,17 @@ class SizingTests(InteractionTestBase, BaseIntegrationTest):
)
)
)
)
if
item
.
find_elements_by_css_selector
(
"img"
):
# This item contains an image. The image should always fill the width of the draggable.
image
=
item
.
find_element_by_css_selector
(
"img"
)
image_width_expected
=
item
.
size
[
"width"
]
-
22
self
.
assertAlmostEqual
(
image
.
size
[
"width"
],
image_width_expected
,
delta
=
1
,
msg
=
"{} image does not take up the full width of the draggable (width is {}px; expected {}px)"
.
format
(
item_description
,
image
.
size
[
"width"
],
image_width_expected
,
)
)
def
_check_sizes
(
self
,
block_index
,
expectations
,
expected_img_width
=
755
,
is_desktop
=
True
):
def
_check_sizes
(
self
,
block_index
,
expectations
,
expected_img_width
=
755
,
is_desktop
=
True
):
""" Test the actual dimensions that each draggable has, in the bank and when placed """
""" Test the actual dimensions that each draggable has, in the bank and when placed """
# Check assumptions - the container wrapping this XBlock should be 770px wide
# Check assumptions - the container wrapping this XBlock should be 770px wide
...
...
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