MOBILE-4132 Book: Fix single activity navigation
parent
138377e504
commit
5adad7fd00
|
@ -18,6 +18,7 @@ import { AddonModBook, AddonModBookBookWSData, AddonModBookNumbering, AddonModBo
|
||||||
import { CoreCourseContentsPage } from '@features/course/pages/contents/contents';
|
import { CoreCourseContentsPage } from '@features/course/pages/contents/contents';
|
||||||
import { CoreCourse } from '@features/course/services/course';
|
import { CoreCourse } from '@features/course/services/course';
|
||||||
import { CoreNavigator } from '@services/navigator';
|
import { CoreNavigator } from '@services/navigator';
|
||||||
|
import { AddonModBookModuleHandlerService } from '../../services/handlers/module';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Component that displays a book entry page.
|
* Component that displays a book entry page.
|
||||||
|
@ -109,14 +110,11 @@ export class AddonModBookIndexComponent extends CoreCourseModuleMainResourceComp
|
||||||
*
|
*
|
||||||
* @param chapterId Chapter to open, undefined for last chapter viewed.
|
* @param chapterId Chapter to open, undefined for last chapter viewed.
|
||||||
*/
|
*/
|
||||||
openBook(chapterId?: number): void {
|
async openBook(chapterId?: number): Promise<void> {
|
||||||
CoreNavigator.navigate('contents', {
|
await CoreNavigator.navigateToSitePath(
|
||||||
params: {
|
`${AddonModBookModuleHandlerService.PAGE_NAME}/${this.courseId}/${this.module.id}/contents`,
|
||||||
cmId: this.module.id,
|
{ params: { chapterId } },
|
||||||
courseId: this.courseId,
|
);
|
||||||
chapterId,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
this.hasStartedBook = true;
|
this.hasStartedBook = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
@app @javascript @mod @mod_book
|
||||||
|
Feature: Test single activity of book type in app
|
||||||
|
In order to view a book while using the mobile app
|
||||||
|
As a student
|
||||||
|
I need single activity of book type functionality to work
|
||||||
|
|
||||||
|
Background:
|
||||||
|
Given the following "users" exist:
|
||||||
|
| username | firstname | lastname |
|
||||||
|
| student1 | First | Student |
|
||||||
|
And the following "courses" exist:
|
||||||
|
| fullname | shortname | category | format | activitytype |
|
||||||
|
| Course 1 | C1 | 0 | singleactivity | book |
|
||||||
|
And the following "course enrolments" exist:
|
||||||
|
| user | course | role |
|
||||||
|
| student1 | C1 | student |
|
||||||
|
And the following "activity" exist:
|
||||||
|
| activity | name | intro | course | idnumber | numbering | section |
|
||||||
|
| book | Single activity book | Test book description | C1 | 1 | 1 | 0 |
|
||||||
|
And the following "mod_book > chapter" exist:
|
||||||
|
| book | title | content | subchapter | hidden | pagenum |
|
||||||
|
| Single activity book | Chapt 1 | This is the first chapter | 0 | 0 | 1 |
|
||||||
|
| Single activity book | Chapt 2 | This is the second chapter | 0 | 0 | 1 |
|
||||||
|
| Single activity book | Chapt 3 | This is the third chapter | 0 | 0 | 1 |
|
||||||
|
|
||||||
|
Scenario: Single activity book
|
||||||
|
Given I entered the course "Course 1" as "student1" in the app
|
||||||
|
Then I should find "Chapt 1" in the app
|
||||||
|
And I should find "Chapt 2" in the app
|
||||||
|
And I press "Chapt 1" in the app
|
||||||
|
Then I should find "Chapt 1" in the app
|
||||||
|
And I should find "This is the first chapter" in the app
|
||||||
|
But I should not find "This is the second chapter" in the app
|
Loading…
Reference in New Issue