mirror of
https://github.com/moodle/moodle.git
synced 2025-08-07 18:06:51 +02:00
Merge branch 'MDL-84243-main' of https://github.com/ferranrecio/moodle
This commit is contained in:
commit
68156941ff
4 changed files with 24 additions and 4 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -471,8 +471,16 @@ export default class {
|
||||||
* @param {bool} complete the new completion value
|
* @param {bool} complete the new completion value
|
||||||
*/
|
*/
|
||||||
cmCompletion(stateManager, cmIds, complete) {
|
cmCompletion(stateManager, cmIds, complete) {
|
||||||
const newValue = (complete) ? 1 : 0;
|
const newState = (complete) ? 1 : 0;
|
||||||
this._setElementsValue(stateManager, 'cm', cmIds, 'completionstate', newValue);
|
stateManager.setReadOnly(false);
|
||||||
|
cmIds.forEach((id) => {
|
||||||
|
const element = stateManager.get('cm', id);
|
||||||
|
if (element) {
|
||||||
|
element.isoverallcomplete = complete;
|
||||||
|
element.completionstate = newState;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
stateManager.setReadOnly(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -43,12 +43,24 @@ Feature: Course index completion icons
|
||||||
Scenario: Manual completion should update the course index completion
|
Scenario: Manual completion should update the course index completion
|
||||||
Given I am on the "C1" "Course" page logged in as "student1"
|
Given I am on the "C1" "Course" page logged in as "student1"
|
||||||
And "To do" "icon" should exist in the "courseindex-content" "region"
|
And "To do" "icon" should exist in the "courseindex-content" "region"
|
||||||
|
# Mark an uncompleted activity as completed.
|
||||||
When I press "Mark as done"
|
When I press "Mark as done"
|
||||||
And I wait until "Done" "button" exists
|
And I wait until "Done" "button" exists
|
||||||
Then "Done" "icon" should exist in the "courseindex-content" "region"
|
Then "Done" "icon" should exist in the "courseindex-content" "region"
|
||||||
And I press "Done"
|
And I press "Done"
|
||||||
And I wait until "Mark as done" "button" exists
|
And I wait until "Mark as done" "button" exists
|
||||||
And "To do" "icon" should exist in the "courseindex-content" "region"
|
And "To do" "icon" should exist in the "courseindex-content" "region"
|
||||||
|
# Mark an completed activity as uncompleted (to discard any possible JS dependency, see MDL-84243).
|
||||||
|
And I press "Mark as done"
|
||||||
|
And I wait until "Done" "button" exists
|
||||||
|
And I reload the page
|
||||||
|
And "Done" "icon" should exist in the "courseindex-content" "region"
|
||||||
|
And I press "Done"
|
||||||
|
And I wait until "Mark as done" "button" exists
|
||||||
|
And "To do" "icon" should exist in the "courseindex-content" "region"
|
||||||
|
And I press "Mark as done"
|
||||||
|
And I wait until "Done" "button" exists
|
||||||
|
Then "Done" "icon" should exist in the "courseindex-content" "region"
|
||||||
|
|
||||||
@javascript
|
@javascript
|
||||||
Scenario: Manual completion in an activity page should update the course index
|
Scenario: Manual completion in an activity page should update the course index
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue