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
ef6d2e26
Commit
ef6d2e26
authored
Aug 18, 2016
by
Braden MacDonald
Committed by
GitHub
Aug 18, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #85 from open-craft/ekolpakov/sol-1806
[SOL-1806] Moved aria-live attributes to popup wrapper
parents
ecca8bf3
1cb7b9d6
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
62 additions
and
27 deletions
+62
-27
drag_and_drop_v2/public/js/drag_and_drop.js
+56
-26
tests/integration/test_base.py
+4
-1
tests/integration/test_render.py
+2
-0
No files found.
drag_and_drop_v2/public/js/drag_and_drop.js
View file @
ef6d2e26
...
@@ -227,7 +227,6 @@ function DragAndDropTemplates(configuration) {
...
@@ -227,7 +227,6 @@ function DragAndDropTemplates(configuration) {
};
};
var
feedbackTemplate
=
function
(
ctx
)
{
var
feedbackTemplate
=
function
(
ctx
)
{
var
properties
=
{
attributes
:
{
'aria-live'
:
'polite'
}
};
var
messages
=
ctx
.
overall_feedback_messages
||
[];
var
messages
=
ctx
.
overall_feedback_messages
||
[];
var
feedback_display
=
messages
.
length
>
0
?
'block'
:
'none'
;
var
feedback_display
=
messages
.
length
>
0
?
'block'
:
'none'
;
var
feedback_messages
=
messages
.
map
(
function
(
message
)
{
var
feedback_messages
=
messages
.
map
(
function
(
message
)
{
...
@@ -239,13 +238,51 @@ function DragAndDropTemplates(configuration) {
...
@@ -239,13 +238,51 @@ function DragAndDropTemplates(configuration) {
});
});
return
(
return
(
h
(
'section.feedback'
,
properties
,
[
h
(
'section.feedback'
,
{},
[
h
(
"div.feedback-content"
,
{
attributes
:
{
'aria-live'
:
'polite'
}
},
[
h
(
'h3.title1'
,
{
style
:
{
display
:
feedback_display
}
},
gettext
(
'Feedback'
)),
h
(
'h3.title1'
,
{
style
:
{
display
:
feedback_display
}
},
gettext
(
'Feedback'
)),
h
(
'div.messages'
,
{
style
:
{
display
:
feedback_display
}
},
feedback_messages
)
h
(
'div.messages'
,
{
style
:
{
display
:
feedback_display
}
},
feedback_messages
),
]
)
])
])
);
);
};
};
var
popupTemplate
=
function
(
ctx
)
{
var
popupSelector
=
'div.popup'
;
if
(
ctx
.
popup_html
&&
!
ctx
.
last_action_correct
)
{
popupSelector
+=
'.popup-incorrect'
;
}
return
(
h
(
"div.popup-wrapper"
,
{
attributes
:
{
'aria-live'
:
'polite'
,
'aria-atomic'
:
'true'
,
'aria-relevant'
:
'additions'
,
}
},
[
h
(
popupSelector
,
{
style
:
{
display
:
ctx
.
popup_html
?
'block'
:
'none'
},
},
[
h
(
'div.close.icon-remove-sign.fa-times-circle'
),
h
(
'p.popup-content'
,
{
innerHTML
:
ctx
.
popup_html
}),
]
)
]
)
)
};
var
keyboardHelpPopupTemplate
=
function
(
ctx
)
{
var
keyboardHelpPopupTemplate
=
function
(
ctx
)
{
var
labelledby_id
=
'modal-window-title-'
+
configuration
.
url_name
;
var
labelledby_id
=
'modal-window-title-'
+
configuration
.
url_name
;
return
(
return
(
...
@@ -324,10 +361,7 @@ function DragAndDropTemplates(configuration) {
...
@@ -324,10 +361,7 @@ function DragAndDropTemplates(configuration) {
var
mainTemplate
=
function
(
ctx
)
{
var
mainTemplate
=
function
(
ctx
)
{
var
problemTitle
=
ctx
.
show_title
?
h
(
'h2.problem-title'
,
{
innerHTML
:
ctx
.
title_html
})
:
null
;
var
problemTitle
=
ctx
.
show_title
?
h
(
'h2.problem-title'
,
{
innerHTML
:
ctx
.
title_html
})
:
null
;
var
problemHeader
=
ctx
.
show_problem_header
?
h
(
'h3.title1'
,
gettext
(
'Problem'
))
:
null
;
var
problemHeader
=
ctx
.
show_problem_header
?
h
(
'h3.title1'
,
gettext
(
'Problem'
))
:
null
;
var
popupSelector
=
'div.popup'
;
if
(
ctx
.
popup_html
&&
!
ctx
.
last_action_correct
)
{
popupSelector
+=
'.popup-incorrect'
;
}
// Render only items_in_bank and items_placed_unaligned here;
// Render only items_in_bank and items_placed_unaligned here;
// items placed in aligned zones will be rendered by zoneTemplate.
// items placed in aligned zones will be rendered by zoneTemplate.
var
is_item_placed
=
function
(
i
)
{
return
i
.
is_placed
;
};
var
is_item_placed
=
function
(
i
)
{
return
i
.
is_placed
;
};
...
@@ -358,24 +392,9 @@ function DragAndDropTemplates(configuration) {
...
@@ -358,24 +392,9 @@ function DragAndDropTemplates(configuration) {
renderCollection
(
itemPlaceholderTemplate
,
items_placed
,
ctx
)
renderCollection
(
itemPlaceholderTemplate
,
items_placed
,
ctx
)
]),
]),
h
(
'div.target'
,
h
(
'div.target'
,
{
{},
attributes
:
{
'aria-live'
:
'polite'
,
'aria-atomic'
:
'true'
,
'aria-relevant'
:
'additions'
,
},
},
[
h
(
popupSelector
,
{
style
:
{
display
:
ctx
.
popup_html
?
'block'
:
'none'
},
},
[
[
h
(
'div.close.icon-remove-sign.fa-times-circle'
),
popupTemplate
(
ctx
),
h
(
'p.popup-content'
,
{
innerHTML
:
ctx
.
popup_html
}),
]
),
h
(
'div.target-img-wrapper'
,
[
h
(
'div.target-img-wrapper'
,
[
h
(
'img.target-img'
,
{
src
:
ctx
.
target_img_src
,
alt
:
ctx
.
target_img_description
}),
h
(
'img.target-img'
,
{
src
:
ctx
.
target_img_src
,
alt
:
ctx
.
target_img_description
}),
]
]
...
@@ -1013,8 +1032,19 @@ function DragAndDropBlock(runtime, element, configuration) {
...
@@ -1013,8 +1032,19 @@ function DragAndDropBlock(runtime, element, configuration) {
};
};
var
canReset
=
function
()
{
var
canReset
=
function
()
{
return
Object
.
keys
(
state
.
items
).
length
>
0
&&
var
any_items_placed
=
false
;
(
configuration
.
mode
!==
DragAndDropBlock
.
ASSESSMENT_MODE
||
attemptsRemain
())
// Now set any_items_placed to true if any items have been successfully placed on the board.
// Exclude just-dropped items that are making an AJAX call to the server, or else screen readers
// will read out "Reset problem" instead of the contents of the correct popup.
for
(
var
key
in
state
.
items
)
{
if
(
state
.
items
.
hasOwnProperty
(
key
))
{
if
(
!
state
.
items
[
key
].
submitting_location
)
{
any_items_placed
=
true
;
break
;
}
}
}
return
any_items_placed
&&
(
configuration
.
mode
!==
DragAndDropBlock
.
ASSESSMENT_MODE
||
attemptsRemain
());
};
};
var
attemptsRemain
=
function
()
{
var
attemptsRemain
=
function
()
{
...
...
tests/integration/test_base.py
View file @
ef6d2e26
...
@@ -68,6 +68,9 @@ class BaseIntegrationTest(SeleniumBaseTest):
...
@@ -68,6 +68,9 @@ class BaseIntegrationTest(SeleniumBaseTest):
def
_get_popup
(
self
):
def
_get_popup
(
self
):
return
self
.
_page
.
find_element_by_css_selector
(
".popup"
)
return
self
.
_page
.
find_element_by_css_selector
(
".popup"
)
def
_get_popup_wrapper
(
self
):
return
self
.
_page
.
find_element_by_css_selector
(
".popup-wrapper"
)
def
_get_popup_content
(
self
):
def
_get_popup_content
(
self
):
return
self
.
_page
.
find_element_by_css_selector
(
".popup .popup-content"
)
return
self
.
_page
.
find_element_by_css_selector
(
".popup .popup-content"
)
...
@@ -90,7 +93,7 @@ class BaseIntegrationTest(SeleniumBaseTest):
...
@@ -90,7 +93,7 @@ class BaseIntegrationTest(SeleniumBaseTest):
return
self
.
_page
.
find_element_by_css_selector
(
'.attempts-used'
)
return
self
.
_page
.
find_element_by_css_selector
(
'.attempts-used'
)
def
_get_feedback
(
self
):
def
_get_feedback
(
self
):
return
self
.
_page
.
find_element_by_css_selector
(
".feedback"
)
return
self
.
_page
.
find_element_by_css_selector
(
".feedback
-content
"
)
def
_get_feedback_message
(
self
):
def
_get_feedback_message
(
self
):
return
self
.
_page
.
find_element_by_css_selector
(
".feedback .message"
)
return
self
.
_page
.
find_element_by_css_selector
(
".feedback .message"
)
...
...
tests/integration/test_render.py
View file @
ef6d2e26
...
@@ -205,10 +205,12 @@ class TestDragAndDropRender(BaseIntegrationTest):
...
@@ -205,10 +205,12 @@ class TestDragAndDropRender(BaseIntegrationTest):
self
.
load_scenario
()
self
.
load_scenario
()
popup
=
self
.
_get_popup
()
popup
=
self
.
_get_popup
()
popup_wrapper
=
self
.
_get_popup_wrapper
()
popup_content
=
self
.
_get_popup_content
()
popup_content
=
self
.
_get_popup_content
()
self
.
assertFalse
(
popup
.
is_displayed
())
self
.
assertFalse
(
popup
.
is_displayed
())
self
.
assertEqual
(
popup
.
get_attribute
(
'class'
),
'popup'
)
self
.
assertEqual
(
popup
.
get_attribute
(
'class'
),
'popup'
)
self
.
assertEqual
(
popup_content
.
text
,
""
)
self
.
assertEqual
(
popup_content
.
text
,
""
)
self
.
assertEqual
(
popup_wrapper
.
get_attribute
(
'aria-live'
),
'polite'
)
def
test_keyboard_help
(
self
):
def
test_keyboard_help
(
self
):
self
.
load_scenario
()
self
.
load_scenario
()
...
...
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