Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
problem-builder
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
problem-builder
Commits
21f1beab
Commit
21f1beab
authored
Oct 21, 2014
by
E. Kolpakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Closing item feedback popups by clicking anywhere on the page
Added test to verify expected behavior of item feedback popups
parent
5a5c3c3c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
16 deletions
+43
-16
mentoring/public/js/mentoring.js
+14
-16
tests/integration/test_mcq.py
+29
-0
No files found.
mentoring/public/js/mentoring.js
View file @
21f1beab
...
...
@@ -15,26 +15,24 @@ function MentoringBlock(runtime, element) {
$
(
document
).
on
(
"click"
,
function
(
event
,
ui
)
{
var
target
=
$
(
event
.
target
);
var
feedback_box
=
".mentoring .feedback"
;
if
(
target
.
is
(
feedback_box
))
{
return
;
}
var
question_feedback_selector
=
".mentoring .feedback"
;
var
item_feedback_parent_selector
=
'.choice'
;
var
item_feedback_selector
=
".choice .choice-tips"
;
if
(
target
.
parents
(
feedback_box
).
length
>
0
)
{
return
;
function
clickedInside
(
selector
,
parent_selector
)
{
return
target
.
is
(
selector
)
||
target
.
parents
(
parent_selector
).
length
>
0
;
}
$
(
feedback_box
).
each
(
function
(
i
,
el
)
{
el
=
$
(
el
);
if
(
el
.
is
(
":hidden"
))
{
return
;
}
el
.
hide
();
publish_event
({
event_type
:
'xblock.mentoring.feedback.closed'
,
content
:
el
.
text
()
if
(
!
clickedInside
(
question_feedback_selector
,
question_feedback_selector
))
{
$
(
question_feedback_selector
).
not
(
':hidden'
).
each
(
function
(
i
,
el
)
{
$
(
el
).
hide
();
publish_event
({
event_type
:
'xblock.mentoring.feedback.closed'
,
content
:
$
(
el
).
text
()});
});
});
}
if
(
!
clickedInside
(
item_feedback_selector
,
item_feedback_parent_selector
))
{
$
(
item_feedback_selector
).
not
(
':hidden'
).
hide
();
}
});
function
callIfExists
(
obj
,
fn
)
{
...
...
tests/integration/test_mcq.py
View file @
21f1beab
...
...
@@ -154,3 +154,32 @@ class MCQBlockTest(MentoringBaseTest):
self
.
assertEqual
(
mcq_choices_input
[
1
]
.
get_attribute
(
'value'
),
'beauty'
)
self
.
assertEqual
(
mcq_choices_input
[
2
]
.
get_attribute
(
'value'
),
'gracefulness'
)
self
.
assertEqual
(
mcq_choices_input
[
3
]
.
get_attribute
(
'value'
),
'bugs'
)
def
test_mcq_feedback_popups
(
self
):
mentoring
=
self
.
go_to_page
(
'Mcq With Comments 1'
)
choices_list
=
mentoring
.
find_element_by_css_selector
(
".choices-list"
)
item_feedbacks
=
[
"This is something everyone has to like about this MRQ"
,
"This is something everyone has to like about beauty"
,
"This MRQ is indeed very graceful"
,
"Nah, there isn
\\
't any!"
]
submit
=
mentoring
.
find_element_by_css_selector
(
'.submit input.input-main'
)
for
index
,
expected_feedback
in
enumerate
(
item_feedbacks
):
choice_wrapper
=
choices_list
.
find_elements_by_css_selector
(
".choice"
)[
index
]
choice_wrapper
.
find_element_by_css_selector
(
".choice-selector"
)
.
click
()
# clicking on actual radio button
submit
.
click
()
item_feedback_icon
=
choice_wrapper
.
find_element_by_css_selector
(
".choice-result"
)
choice_wrapper
.
click
()
item_feedback_icon
.
click
()
# clicking on item feedback icon
item_feedback_popup
=
choice_wrapper
.
find_element_by_css_selector
(
".choice-tips"
)
self
.
assertTrue
(
item_feedback_popup
.
is_displayed
())
self
.
assertEqual
(
item_feedback_popup
.
text
,
expected_feedback
)
item_feedback_popup
.
click
()
self
.
assertTrue
(
item_feedback_popup
.
is_displayed
())
mentoring
.
click
()
self
.
assertFalse
(
item_feedback_popup
.
is_displayed
())
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