MDL-82282 question: consider only editable flags in JS module.

This commit is contained in:
Paul Holden
2024-07-04 10:19:36 +01:00
parent dc6dda1726
commit e2a7ef37db
2 changed files with 14 additions and 10 deletions
+9 -6
View File
@@ -46,12 +46,10 @@ Feature: Flag quiz questions
Scenario: Flag a quiz during and after quiz attempt
Given I am on the "Quiz 1" "quiz activity" page logged in as student1
And I press "Attempt quiz"
# flag question 1
When I press "Flag question"
When I click on "Flag question" "button" in the "First question" "question"
Then I should see "Remove flag" in the "First question" "question"
# Confirm question 1 is flagged in navigation
Then "Question 1 This page Flagged" "link" should exist
# Confirm that link in question 1 is changed to Remove flag
And I should see "Remove flag" in the "First question" "question"
And "Question 1 This page Flagged" "link" should exist
# Answer questions
And I click on "True" "radio" in the "First question" "question"
And I press "Next page"
@@ -64,9 +62,14 @@ Feature: Flag quiz questions
# Confirm only flagged question is flagged
And I should see "Remove flag" in the "First question" "question"
And I should see "Flag question" in the "Second question" "question"
And I should see "Flag question" in the "Third question" "question"
And I click on "Flagged" "button" in the "Second question" "question"
And I should see "Remove flag" in the "Second question" "question"
And I should see "Flag question" in the "Third question" "question"
And I am on the "Quiz 1" "mod_quiz > Grades report" page logged in as teacher1
And "Flagged" "icon" should exist in the "Student 1" "table_row"
And I am on the "Quiz 1" "mod_quiz > Responses report" page
And "Flagged" "icon" should exist in the "Student 1" "table_row"
And I am on the "Quiz 1 > student1 > Attempt 1" "mod_quiz > Attempt review" page
And I should see "Remove flag" in the "First question" "question"
And I should see "Remove flag" in the "Second question" "question"
And I should see "Flag question" in the "Third question" "question"
+5 -4
View File
@@ -29,12 +29,13 @@ M.core_question_flags = {
flagattributes: null,
actionurl: null,
listeners: [],
editableSelector: 'div.questionflag.editable',
init: function(Y, actionurl, flagattributes) {
M.core_question_flags.flagattributes = flagattributes;
M.core_question_flags.actionurl = actionurl;
Y.all('div.questionflag').each(function(flagdiv, i) {
Y.all(M.core_question_flags.editableSelector).each(function(flagdiv) {
var checkbox = flagdiv.one('input[type=checkbox]');
if (!checkbox) {
return;
@@ -64,17 +65,17 @@ M.core_question_flags = {
Y.delegate('click', function(e) {
e.halt();
M.core_question_flags.process(this);
}, document.body, 'div.questionflag');
}, document.body, M.core_question_flags.editableSelector);
Y.delegate('key', function(e) {
e.halt();
if (e.keyCode == 13) {
M.core_question_flags.process(this);
}
}, document.body, 'down:enter, space', 'div.questionflag');
}, document.body, 'down:enter, space', M.core_question_flags.editableSelector);
Y.delegate('key', function(e) {
e.halt();
M.core_question_flags.process(this);
}, document.body, 'up:space', 'div.questionflag');
}, document.body, 'up:space', M.core_question_flags.editableSelector);
},
update_flag: function(input, toggle) {