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
7fbaea1a
Commit
7fbaea1a
authored
Mar 08, 2016
by
Tim Krones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix: Show choice tips on click.
parent
3a9ded90
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
3 deletions
+41
-3
problem_builder/public/js/questionnaire.js
+6
-2
problem_builder/tests/integration/test_mentoring.py
+35
-1
No files found.
problem_builder/public/js/questionnaire.js
View file @
7fbaea1a
...
...
@@ -10,7 +10,7 @@ function display_message(message, messageView, checkmark){
checkmark
.
on
(
'click'
,
function
(
ev
)
{
ev
.
stopPropagation
();
messageView
.
showMessage
(
msg
);
})
})
;
}
}
}
...
...
@@ -140,7 +140,11 @@ function MCQBlock(runtime, element) {
choiceDOM
.
addClass
(
'incorrect'
);
choiceResultDOM
.
addClass
(
'checkmark-incorrect icon-exclamation fa-exclamation'
);
}
choiceResultDOM
.
off
(
'click'
).
on
(
'click'
,
function
()
{
if
(
choiceTipsDOM
.
html
()
!==
''
)
{
messageView
.
showMessage
(
choiceTipsDOM
);
}
});
if
(
result
.
tips
)
{
mentoring
.
setContent
(
choiceTipsDOM
,
result
.
tips
);
messageView
.
showMessage
(
choiceTipsDOM
);
...
...
problem_builder/tests/integration/test_mentoring.py
View file @
7fbaea1a
...
...
@@ -436,7 +436,7 @@ class ProblemBuilderQuestionnaireBlockTest(ProblemBuilderBaseTest):
(
"feedback_persistence_mcq_no_tips.xml"
,
'.feedback'
)
)
def
test_feedback_persistence_tips
(
self
,
scenario
,
tips_selector
):
# Tests whether feedback is hidden on reload.
# Tests whether feedback
(global message and choice tips)
is hidden on reload.
with
mock
.
patch
(
"problem_builder.mentoring.MentoringBlock.get_options"
)
as
patched_options
:
patched_options
.
return_value
=
{
'pb_mcq_hide_previous_answer'
:
True
}
mentoring
=
self
.
load_scenario
(
scenario
)
...
...
@@ -449,3 +449,37 @@ class ProblemBuilderQuestionnaireBlockTest(ProblemBuilderBaseTest):
mentoring
=
self
.
reload_student_view
()
messages
=
mentoring
.
find_element_by_css_selector
(
tips_selector
)
self
.
assertFalse
(
messages
.
is_displayed
())
@ddt.data
(
(
0
,
"Yes"
,
"Great!"
),
(
1
,
"Maybe not"
,
"Ah, damn."
),
(
2
,
"I don't understand"
,
"Really?"
)
)
@ddt.unpack
def
test_clicking_result_icon_shows_tips
(
self
,
choice_index
,
choice_text
,
expected_tip
):
mentoring
=
self
.
load_scenario
(
"feedback_persistence_mcq_tips.xml"
)
mcq
=
self
.
_get_xblock
(
mentoring
,
"feedback_mcq_2"
)
question_title
=
mentoring
.
find_element_by_css_selector
(
'.question-title'
)
choice
=
self
.
_get_choice
(
mcq
,
choice_index
)
choice_result
=
choice
.
find_element_by_css_selector
(
'.choice-result'
)
choice_tips
=
choice
.
find_element_by_css_selector
(
'.choice-tips'
)
def
assert_tip
():
self
.
wait_until_visible
(
choice_tips
)
tip
=
choice_tips
.
find_element_by_css_selector
(
'.tip'
)
self
.
assertEqual
(
tip
.
text
,
expected_tip
)
# Answer question
self
.
click_choice
(
mcq
,
choice_text
)
# Submit answer
self
.
click_submit
(
mentoring
)
# Tip for selected choice should be visible and match expected tip
assert_tip
()
# Random click to make tip disappear
question_title
.
click
()
# Tip for selected choice should be hidden
self
.
wait_until_hidden
(
choice_tips
)
# Click result icon to show tips
choice_result
.
click
()
# Tip for selected choice should be visible and match expected tip
assert_tip
()
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