Commit 485a88fa by cahrens

Prefix status with Question number.

TNL-5735
parent 971f102b
...@@ -206,8 +206,8 @@ describe 'Problem', -> ...@@ -206,8 +206,8 @@ describe 'Problem', ->
describe 'when the response is correct', -> describe 'when the response is correct', ->
it 'call render with returned content', -> it 'call render with returned content', ->
contents = '<section aria-label="Question 1"><p>Correct<span class="status">excellent</span></p></section>' + contents = '<div class="wrapper-problem-response" aria-label="Question 1"><p>Correct<span class="status">excellent</span></p></div>' +
'<section aria-label="Question 2"><p>Yep<span class="status">correct</span></p></section>' '<div class="wrapper-problem-response" aria-label="Question 2"><p>Yep<span class="status">correct</span></p></div>'
spyOn($, 'postWithPrefix').and.callFake (url, answers, callback) -> spyOn($, 'postWithPrefix').and.callFake (url, answers, callback) ->
callback(success: 'correct', contents: contents) callback(success: 'correct', contents: contents)
promise = promise =
......
...@@ -640,7 +640,7 @@ ...@@ -640,7 +640,7 @@
labeledStatus = []; labeledStatus = [];
for (i = 0, len = statusElement.length; i < len; i++) { for (i = 0, len = statusElement.length; i < len; i++) {
element = statusElement[i]; element = statusElement[i];
parentSection = $(element).closest('section'); parentSection = $(element).closest('.wrapper-problem-response');
addedStatus = false; addedStatus = false;
if (parentSection) { if (parentSection) {
ariaLabel = parentSection.attr('aria-label'); ariaLabel = parentSection.attr('aria-label');
......
...@@ -383,3 +383,10 @@ class ProblemPage(PageObject): ...@@ -383,3 +383,10 @@ class ProblemPage(PageObject):
""" """
self.wait_for_element_visibility('.problem-progress', "Problem progress is visible") self.wait_for_element_visibility('.problem-progress', "Problem progress is visible")
return self.q(css='.problem-progress').text[0] 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]
...@@ -205,17 +205,23 @@ class ProblemNotificationTests(ProblemsTest): ...@@ -205,17 +205,23 @@ class ProblemNotificationTests(ProblemsTest):
self.assertFalse(problem_page.is_success_notification_visible()) self.assertFalse(problem_page.is_success_notification_visible())
problem_page.click_submit() problem_page.click_submit()
problem_page.wait_success_notification() problem_page.wait_success_notification()
self.assertEqual('Question 1: correct', problem_page.status_sr_text)
# Clicking Save should clear the submit notification # Clicking Save should clear the submit notification
problem_page.click_save() problem_page.click_save()
self.assertFalse(problem_page.is_success_notification_visible()) self.assertFalse(problem_page.is_success_notification_visible())
problem_page.wait_for_save_notification() problem_page.wait_for_save_notification()
# Changing the answer should clear the save notification # Changing the answer should clear the save notification
problem_page.click_choice("choice_1") problem_page.click_choice("choice_1")
self.assertFalse(problem_page.is_save_notification_visible()) self.assertFalse(problem_page.is_save_notification_visible())
problem_page.click_save() problem_page.click_save()
problem_page.wait_for_save_notification()
# Submitting the problem again should clear the save notification # Submitting the problem again should clear the save notification
problem_page.click_submit() problem_page.click_submit()
problem_page.wait_incorrect_notification() problem_page.wait_incorrect_notification()
self.assertEqual('Question 1: incorrect', problem_page.status_sr_text)
self.assertFalse(problem_page.is_save_notification_visible()) self.assertFalse(problem_page.is_save_notification_visible())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment