From 485a88fabceb72e6b8377b329baaeeee6cc4a45e Mon Sep 17 00:00:00 2001 From: cahrens Date: Fri, 14 Oct 2016 15:14:06 -0400 Subject: [PATCH] Prefix status with Question number. TNL-5735 --- .../lib/xmodule/xmodule/js/spec/capa/display_spec.coffee | 4 ++-- common/lib/xmodule/xmodule/js/src/capa/display.js | 2 +- common/test/acceptance/pages/lms/problem.py | 7 +++++++ common/test/acceptance/tests/lms/test_lms_problems.py | 6 ++++++ 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/common/lib/xmodule/xmodule/js/spec/capa/display_spec.coffee b/common/lib/xmodule/xmodule/js/spec/capa/display_spec.coffee index ce50dfd0c1..6ba5a613e5 100644 --- a/common/lib/xmodule/xmodule/js/spec/capa/display_spec.coffee +++ b/common/lib/xmodule/xmodule/js/spec/capa/display_spec.coffee @@ -206,8 +206,8 @@ describe 'Problem', -> describe 'when the response is correct', -> it 'call render with returned content', -> - contents = '

Correctexcellent

' + - '

Yepcorrect

' + contents = '

Correctexcellent

' + + '

Yepcorrect

' spyOn($, 'postWithPrefix').and.callFake (url, answers, callback) -> callback(success: 'correct', contents: contents) promise = diff --git a/common/lib/xmodule/xmodule/js/src/capa/display.js b/common/lib/xmodule/xmodule/js/src/capa/display.js index edd233b5e0..d24e4f98e3 100644 --- a/common/lib/xmodule/xmodule/js/src/capa/display.js +++ b/common/lib/xmodule/xmodule/js/src/capa/display.js @@ -640,7 +640,7 @@ labeledStatus = []; for (i = 0, len = statusElement.length; i < len; i++) { element = statusElement[i]; - parentSection = $(element).closest('section'); + parentSection = $(element).closest('.wrapper-problem-response'); addedStatus = false; if (parentSection) { ariaLabel = parentSection.attr('aria-label'); diff --git a/common/test/acceptance/pages/lms/problem.py b/common/test/acceptance/pages/lms/problem.py index 7ffbd19005..dfe7f74b38 100644 --- a/common/test/acceptance/pages/lms/problem.py +++ b/common/test/acceptance/pages/lms/problem.py @@ -383,3 +383,10 @@ class ProblemPage(PageObject): """ self.wait_for_element_visibility('.problem-progress', "Problem progress is visible") return self.q(css='.problem-progress').text[0] + + @property + def status_sr_text(self): + """ + Returns the text in the special "sr" region used for display status. + """ + return self.q(css='#reader-feedback').text[0] diff --git a/common/test/acceptance/tests/lms/test_lms_problems.py b/common/test/acceptance/tests/lms/test_lms_problems.py index ef1b4af535..26d0156698 100644 --- a/common/test/acceptance/tests/lms/test_lms_problems.py +++ b/common/test/acceptance/tests/lms/test_lms_problems.py @@ -205,17 +205,23 @@ class ProblemNotificationTests(ProblemsTest): self.assertFalse(problem_page.is_success_notification_visible()) problem_page.click_submit() problem_page.wait_success_notification() + self.assertEqual('Question 1: correct', problem_page.status_sr_text) + # Clicking Save should clear the submit notification problem_page.click_save() self.assertFalse(problem_page.is_success_notification_visible()) problem_page.wait_for_save_notification() + # Changing the answer should clear the save notification problem_page.click_choice("choice_1") self.assertFalse(problem_page.is_save_notification_visible()) problem_page.click_save() + problem_page.wait_for_save_notification() + # Submitting the problem again should clear the save notification problem_page.click_submit() problem_page.wait_incorrect_notification() + self.assertEqual('Question 1: incorrect', problem_page.status_sr_text) self.assertFalse(problem_page.is_save_notification_visible())