This commit is contained in:
Sara Arjona 2025-01-29 16:47:35 +01:00
commit 68156941ff
No known key found for this signature in database
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

View file

@ -471,8 +471,16 @@ export default class {
* @param {bool} complete the new completion value
*/
cmCompletion(stateManager, cmIds, complete) {
const newValue = (complete) ? 1 : 0;
this._setElementsValue(stateManager, 'cm', cmIds, 'completionstate', newValue);
const newState = (complete) ? 1 : 0;
stateManager.setReadOnly(false);
cmIds.forEach((id) => {
const element = stateManager.get('cm', id);
if (element) {
element.isoverallcomplete = complete;
element.completionstate = newState;
}
});
stateManager.setReadOnly(true);
}
/**

View file

@ -43,12 +43,24 @@ Feature: Course index completion icons
Scenario: Manual completion should update the course index completion
Given I am on the "C1" "Course" page logged in as "student1"
And "To do" "icon" should exist in the "courseindex-content" "region"
# Mark an uncompleted activity as completed.
When I press "Mark as done"
And I wait until "Done" "button" exists
Then "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"
# 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
Scenario: Manual completion in an activity page should update the course index