MOBILE-4350 quiz: Disable sequential navigation items

main
Noel De Martin 2024-02-15 13:08:27 +01:00
parent c41ac5a3cf
commit 5c1606e595
5 changed files with 53 additions and 49 deletions

View File

@ -15,7 +15,8 @@
<ion-list>
<ion-item button class="ion-text-wrap {{question.stateClass}}" *ngFor="let question of navigation"
[attr.aria-current]="!summaryShown && currentPage === question.page ? 'page' : 'false'"
(click)="loadPage(question.page, question.slot)" [detail]="false">
[disabled]="!isReview && isSequential && currentPage !== question.page" (click)="loadPage(question.page, question.slot)"
[detail]="false">
<ion-label class="ion-text-wrap">
<span *ngIf="question.type !== 'description' && question.questionnumber">

View File

@ -30,6 +30,7 @@ export class AddonModQuizNavigationModalComponent {
@Input() summaryShown?: boolean; // Whether summary is currently being shown.
@Input() currentPage?: number; // Current page.
@Input() isReview?: boolean; // Whether the user is reviewing the attempt.
@Input() isSequential?: boolean; // Whether quiz navigation is sequential.
/**
* Close modal.

View File

@ -559,8 +559,6 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave {
return;
}
// @todo MOBILE-4350: This is called before getting the attempt data in sequential quizzes as a workaround for a bug
// in the LMS. Once the bug has been fixed, this should be reverted.
if (this.isSequential) {
await this.logViewPage(page);
}
@ -594,7 +592,6 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave {
// Mark the page as viewed.
if (!this.isSequential) {
// @todo MOBILE-4350: Undo workaround.
await this.logViewPage(page);
}
@ -734,6 +731,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave {
summaryShown: this.showSummary,
currentPage: this.attempt?.currentpage,
isReview: false,
isSequential: this.isSequential,
},
});

View File

@ -345,6 +345,7 @@ export class AddonModQuizReviewPage implements OnInit {
summaryShown: false,
currentPage: this.attempt?.currentpage,
isReview: true,
isSequential: this.quiz && AddonModQuiz.isNavigationSequential(this.quiz),
},
});

View File

@ -83,55 +83,58 @@ Feature: Navigate through a quiz in the app
And I should find "Text of the first question" in the app
And I should find "Text of the second question" in the app
# @todo MOBILE-4350 uncomment and update this test.
# Scenario: Sequential navigation
# Given I entered the quiz activity "Quiz 2" on course "Course 1" as "student1" in the app
# And I press "Attempt quiz now" in the app
# Then I should find "Text of the first question" in the app
# But I should not find "Text of the second question" in the app
# And I should not find "Text of the third question" in the app
Scenario: Sequential navigation
Given I entered the quiz activity "Quiz 2" on course "Course 1" as "student1" in the app
And I press "Attempt quiz now" in the app
Then I should find "Text of the first question" in the app
But I should not find "Text of the second question" in the app
And I should not find "Text of the third question" in the app
# When I press "Open navigation popover" in the app
# Then I should find "Question 1" in the app
# But I should not find "Question 2" in the app
# And I should not find "Question 3" in the app
When I press "Open navigation popover" in the app
Then I should find "Question 1" in the app
And I should find "Question 2" in the app
And I should find "Question 3" in the app
But I should not be able to press "Question 2" in the app
And I should not be able to press "Question 3" in the app
# When I press "Close" in the app
# And I press "Next" in the app
# Then I should find "Text of the second question" in the app
# But I should not find "Text of the first question" in the app
# And I should not find "Text of the third question" in the app
# And I should not find "Previous" in the app
When I press "Close" in the app
And I press "Next" in the app
Then I should find "Text of the second question" in the app
But I should not find "Text of the first question" in the app
And I should not find "Text of the third question" in the app
And I should not find "Previous" in the app
# When I press "Open navigation popover" in the app
# Then I should find "Question 2" in the app
# But I should not find "Question 1" in the app
# And I should not find "Question 3" in the app
When I press "Open navigation popover" in the app
Then I should find "Question 1" in the app
And I should find "Question 2" in the app
And I should find "Question 3" in the app
But I should not be able to press "Question 1" in the app
And I should not be able to press "Question 3" in the app
# When I press "Close" in the app
# And I press "Next" in the app
# Then I should find "Text of the third question" in the app
# But I should not find "Text of the first question" in the app
# And I should not find "Text of the second question" in the app
# And I should not find "Previous" in the app
When I press "Close" in the app
And I press "Next" in the app
Then I should find "Text of the third question" in the app
But I should not find "Text of the first question" in the app
And I should not find "Text of the second question" in the app
And I should not find "Previous" in the app
# When I press "Open navigation popover" in the app
# Then I should find "Question 3" in the app
# But I should not find "Question 1" in the app
# And I should not find "Question 2" in the app
When I press "Open navigation popover" in the app
Then I should find "Question 1" in the app
And I should find "Question 2" in the app
And I should find "Question 3" in the app
But I should not be able to press "Question 1" in the app
And I should not be able to press "Question 2" in the app
# When I press "Close" in the app
# And I press "Submit" in the app
# Then I should find "Summary of attempt" in the app
# # @todo MOBILE-4350: Uncomment these.
# # And I should find "Not yet answered" within "1" "ion-item" in the app
# # And I should find "Not yet answered" within "2" "ion-item" in the app
# # And I should find "Not yet answered" within "3" "ion-item" in the app
When I press "Close" in the app
And I press "Submit" in the app
Then I should find "Summary of attempt" in the app
And I should find "Not yet answered" within "1" "ion-item" in the app
And I should find "Not yet answered" within "2" "ion-item" in the app
And I should find "Not yet answered" within "3" "ion-item" in the app
# When I press "Submit all and finish" in the app
# And I press "Submit" near "Once you submit" in the app
# Then I should find "Review" in the app
# # @todo MOBILE-4350: Uncomment these.
# # And I should find "Text of the first question" in the app
# # And I should find "Text of the second question" in the app
# # And I should find "Text of the third question" in the app
When I press "Submit all and finish" in the app
And I press "Submit" near "Once you submit" in the app
Then I should find "Review" in the app
And I should find "Text of the first question" in the app
And I should find "Text of the second question" in the app
And I should find "Text of the third question" in the app