Commit 2afee49e by Matjaz Gregoric Committed by GitHub

Merge pull request #84 from open-craft/mtyaka/assessment-movable-items

Move items between zones in assessment mode
parents 30173c47 ed661bf7
...@@ -143,6 +143,11 @@ ...@@ -143,6 +143,11 @@
margin: 0; margin: 0;
transform: translate(-50%, -50%); /* These blocks are to be centered on their absolute x,y position */ transform: translate(-50%, -50%); /* These blocks are to be centered on their absolute x,y position */
} }
/* Dragging placed option to a different zone in assessment mode */
.xblock--drag-and-drop .drag-container .target .option.grabbed-with-mouse {
transform: none; /* The transform messes with jQuery UI Draggable positioning, */
/* so remove it while dragging with the mouse. */
}
/* Placed options in an aligned zone */ /* Placed options in an aligned zone */
.xblock--drag-and-drop .zone .item-wrapper { .xblock--drag-and-drop .zone .item-wrapper {
...@@ -172,21 +177,24 @@ ...@@ -172,21 +177,24 @@
} }
/* Focused option */ /* Focused option */
.xblock--drag-and-drop .drag-container .item-bank .option:focus, .xblock--drag-and-drop .drag-container .option[draggable='true']:focus,
.xblock--drag-and-drop .drag-container .item-bank .option:hover, .xblock--drag-and-drop .drag-container .option[draggable='true']:hover,
.xblock--drag-and-drop .drag-container .item-bank .option[aria-grabbed='true'] { .xblock--drag-and-drop .drag-container .option[draggable='true'][aria-grabbed='true'] {
outline-width: 2px; outline-width: 2px;
outline-style: solid; outline-style: solid;
outline-offset: -4px; outline-offset: -4px;
} }
.xblock--drag-and-drop .drag-container .ui-draggable-dragging.option { .xblock--drag-and-drop .drag-container .option.grabbed-with-mouse {
box-shadow: 0 16px 32px 0 rgba(0, 0, 0, 0.3); box-shadow: 0 16px 32px 0 rgba(0, 0, 0, 0.3);
border: 1px solid #ccc; border: 1px solid #ccc;
opacity: .65; opacity: .65;
z-index: 20 !important; z-index: 20 !important;
margin: 0; /* Allow the draggable to touch the edges of the target image */ margin: 0; /* Allow the draggable to touch the edges of the target image */
} }
.xblock--drag-and-drop .drag-container .item-align-center .option.grabbed-with-mouse {
margin: 0 auto; /* Revert to auto margin when dragging with mouse to not confuse jQuery UI draggable */
}
.xblock--drag-and-drop .drag-container .option img { .xblock--drag-and-drop .drag-container .option img {
display: inline-block; display: inline-block;
...@@ -254,8 +262,9 @@ ...@@ -254,8 +262,9 @@
} }
/* Focused zone */ /* Focused zone */
.xblock--drag-and-drop .item-bank:focus,
.xblock--drag-and-drop .zone:focus { .xblock--drag-and-drop .zone:focus {
border: 2px solid #a5a5a5; outline: 2px solid #a5a5a5;
} }
.xblock--drag-and-drop .drag-container .target .zone p { .xblock--drag-and-drop .drag-container .target .zone p {
......
...@@ -409,11 +409,15 @@ msgid "ok" ...@@ -409,11 +409,15 @@ msgid "ok"
msgstr "" msgstr ""
#: public/js/drag_and_drop.js #: public/js/drag_and_drop.js
msgid "Placed in: " msgid "Item Bank"
msgstr "" msgstr ""
#: public/js/drag_and_drop.js #: public/js/drag_and_drop.js
msgid "Correctly placed in: " msgid "Placed in: {zone_title}"
msgstr ""
#: public/js/drag_and_drop.js
msgid "Correctly placed in: {zone_title}"
msgstr "" msgstr ""
#: public/js/drag_and_drop.js #: public/js/drag_and_drop.js
......
...@@ -494,12 +494,16 @@ msgid "ok" ...@@ -494,12 +494,16 @@ msgid "ok"
msgstr "ök Ⱡ'σя#" msgstr "ök Ⱡ'σя#"
#: public/js/drag_and_drop.js #: public/js/drag_and_drop.js
msgid "Placed in: " msgid "Item Bank"
msgstr "Pläçéd ïn: Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт, #" msgstr "Ìtém Bänk Ⱡ'σяєм ιρѕυм ∂σł#"
#: public/js/drag_and_drop.js #: public/js/drag_and_drop.js
msgid "Correctly placed in: " msgid "Placed in: {zone_title}"
msgstr "Çörréçtlý pläçéd ïn: Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт, #" msgstr "Pläçéd ïn: {zone_title} Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт, #"
#: public/js/drag_and_drop.js
msgid "Correctly placed in: {zone_title}"
msgstr "Çörréçtlý pläçéd ïn: {zone_title} Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт, #"
#: public/js/drag_and_drop.js #: public/js/drag_and_drop.js
msgid "Reset problem" msgid "Reset problem"
......
...@@ -146,7 +146,6 @@ class TestDragAndDropRender(BaseIntegrationTest): ...@@ -146,7 +146,6 @@ class TestDragAndDropRender(BaseIntegrationTest):
self.assertEqual(item.get_attribute('draggable'), 'true') self.assertEqual(item.get_attribute('draggable'), 'true')
self.assertEqual(item.get_attribute('aria-grabbed'), 'false') self.assertEqual(item.get_attribute('aria-grabbed'), 'false')
self.assertEqual(item.get_attribute('data-value'), str(index)) self.assertEqual(item.get_attribute('data-value'), str(index))
self.assertIn('ui-draggable', self.get_element_classes(item))
self._test_item_style(item, color_settings) self._test_item_style(item, color_settings)
try: try:
background_image = item.find_element_by_css_selector('img') background_image = item.find_element_by_css_selector('img')
...@@ -160,8 +159,16 @@ class TestDragAndDropRender(BaseIntegrationTest): ...@@ -160,8 +159,16 @@ class TestDragAndDropRender(BaseIntegrationTest):
def test_drag_container(self): def test_drag_container(self):
self.load_scenario() self.load_scenario()
item_bank = self._page.find_element_by_css_selector('.drag-container') drag_container = self._page.find_element_by_css_selector('.drag-container')
self.assertIsNone(item_bank.get_attribute('role')) self.assertIsNone(drag_container.get_attribute('role'))
def test_item_bank(self):
self.load_scenario()
item_bank = self._page.find_element_by_css_selector('.item-bank')
description = item_bank.find_element_by_css_selector('p.zone-description')
self.assertEqual(description.text, 'Item Bank')
# Description should only be visible to screen readers:
self.assertEqual(description.get_attribute('class'), 'zone-description sr')
def test_zones(self): def test_zones(self):
self.load_scenario() self.load_scenario()
......
...@@ -187,6 +187,7 @@ class SizingTests(InteractionTestBase, BaseIntegrationTest): ...@@ -187,6 +187,7 @@ class SizingTests(InteractionTestBase, BaseIntegrationTest):
target_img_width = target_img.size["width"] target_img_width = target_img.size["width"]
item_bank = self._page.find_element_by_css_selector('.item-bank') item_bank = self._page.find_element_by_css_selector('.item-bank')
item_bank_width = item_bank.size["width"] item_bank_width = item_bank.size["width"]
item_bank_height = item_bank.size["height"]
if is_desktop: if is_desktop:
# If using a desktop-sized window, we can know the exact dimensions of various containers: # If using a desktop-sized window, we can know the exact dimensions of various containers:
...@@ -239,6 +240,10 @@ class SizingTests(InteractionTestBase, BaseIntegrationTest): ...@@ -239,6 +240,10 @@ class SizingTests(InteractionTestBase, BaseIntegrationTest):
*expect.img_pixel_size_exact *expect.img_pixel_size_exact
) )
# Test that the item bank maintains its original size.
self.assertEqual(item_bank.size["width"], item_bank_width)
self.assertEqual(item_bank.size["height"], item_bank_height)
class AlignedSizingTests(SizingTests): class AlignedSizingTests(SizingTests):
""" """
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment