Skip to content

Commit

Permalink
fixup! Implement Show Answer button
Browse files Browse the repository at this point in the history
Close feedback box when clicking Show Answer.
  • Loading branch information
arbrandes committed Sep 20, 2016
1 parent adcbf1c commit c10d1b2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions drag_and_drop_v2/public/js/drag_and_drop.js
Original file line number Diff line number Diff line change
Expand Up @@ -1125,6 +1125,7 @@ function DragAndDropBlock(runtime, element, configuration) {
}).done(function(data) {
state.items = data.items;
state.showing_answer = true;
delete state.feedback;
}).always(function() {
state.show_answer_spinner = false;
applyState();
Expand Down
15 changes: 13 additions & 2 deletions tests/integration/test_interaction_assessment.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,14 +189,25 @@ def test_show_answer(self):
show_answer_button = self._get_show_answer_button()
self.assertTrue(show_answer_button.is_displayed())

self.place_item(0, TOP_ZONE_ID)
for _ in xrange(self.MAX_ATTEMPTS):
self.place_item(0, TOP_ZONE_ID, Keys.RETURN)
for _ in xrange(self.MAX_ATTEMPTS-1):
self.assertEqual(show_answer_button.get_attribute('disabled'), 'true')
self.click_submit()

# Place an incorrect item on the final attempt.
self.place_item(1, TOP_ZONE_ID, Keys.RETURN)
self.click_submit()

# A feedback popup should open upon final submission.
popup = self._get_popup()
self.assertTrue(popup.is_displayed())

self.assertIsNone(show_answer_button.get_attribute('disabled'))
self.click_show_answer()

# The popup should be closed upon clicking Show Answer.
self.assertFalse(popup.is_displayed())

self.assertEqual(show_answer_button.get_attribute('disabled'), 'true')
self._assert_show_answer_item_placement()

Expand Down

0 comments on commit c10d1b2

Please sign in to comment.