Merge pull request #3932 from NoelDeMartin/MOBILE-4350

MOBILE-4350: Sequential Navigation
main
Dani Palou 2024-02-21 15:49:16 +01:00 committed by GitHub
commit 609e0a3e6e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 58 additions and 51 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View File

@ -85,7 +85,9 @@ Feature: It navigates properly in pages with a split-view component.
And I should find "Course 1" in the app
And I should find "Course 2" in the app
And I should find "Grade category C1" in the app
And the UI should match the snapshot
When I replace "/.*/" within "core-user-avatar .userinitials" with "M"
Then the UI should match the snapshot
# Open C1 course grades
When I press "Grade item C1" in the app

View File

@ -1522,9 +1522,10 @@ html.ios div.fake-ion-item {
// Disabled items.
ion-item.item-disabled,
ion-button.button-disabled,
ion-item.item-interactive-disabled:not(.item-multiple-inputs) ion-label,
ion-datetime.datetime-disabled {
opacity: .8 !important;
opacity: .65 !important;
}
// Hide details on items to align badges.