MDL-40988 quiz: fix bug when editing default heading on blank quiz
authorM Kassaei <m.kassaei@open.ac.uk>
Wed, 8 Apr 2015 11:27:10 +0000 (12:27 +0100)
committerDan Poltawski <dan@moodle.com>
Wed, 8 Apr 2015 11:42:34 +0000 (12:42 +0100)
mod/quiz/tests/behat/editing_section_headings.feature
mod/quiz/yui/build/moodle-mod_quiz-toolboxes/moodle-mod_quiz-toolboxes-debug.js
mod/quiz/yui/build/moodle-mod_quiz-toolboxes/moodle-mod_quiz-toolboxes-min.js
mod/quiz/yui/build/moodle-mod_quiz-toolboxes/moodle-mod_quiz-toolboxes.js
mod/quiz/yui/src/toolboxes/js/section.js

index 929e378..1635c29 100644 (file)
@@ -41,6 +41,17 @@ Feature: Edit quiz page - section headings
     Then I should see "Shuffle"
 
   @javascript
+  Scenario: Modify the default section headings
+    Given the following "activities" exist:
+      | activity   | name   | intro              | course | idnumber |
+      | quiz       | Quiz 1 | Quiz 1 description | C1     | quiz1    |
+    When I follow "Course 1"
+    And I follow "Quiz 1"
+    And I follow "Edit quiz"
+    And I change quiz section heading "" to "This is section one"
+    Then I should see "This is section one"
+
+ @javascript
   Scenario: Modify section headings
     Given the following "activities" exist:
       | activity   | name   | intro              | course | idnumber |
index cd6d140..4e174dc 100644 (file)
Binary files a/mod/quiz/yui/build/moodle-mod_quiz-toolboxes/moodle-mod_quiz-toolboxes-debug.js and b/mod/quiz/yui/build/moodle-mod_quiz-toolboxes/moodle-mod_quiz-toolboxes-debug.js differ
index 7309b8e..deb7b51 100644 (file)
Binary files a/mod/quiz/yui/build/moodle-mod_quiz-toolboxes/moodle-mod_quiz-toolboxes-min.js and b/mod/quiz/yui/build/moodle-mod_quiz-toolboxes/moodle-mod_quiz-toolboxes-min.js differ
index cd6d140..4e174dc 100644 (file)
Binary files a/mod/quiz/yui/build/moodle-mod_quiz-toolboxes/moodle-mod_quiz-toolboxes.js and b/mod/quiz/yui/build/moodle-mod_quiz-toolboxes/moodle-mod_quiz-toolboxes.js differ
index fff7d4b..efbda57 100644 (file)
@@ -225,10 +225,11 @@ Y.extend(SECTIONTOOLBOX, TOOLBOX, {
                             M.util.get_string('sectionheadingedit', 'quiz', response.instancesection));
                     activity.one(SELECTOR.EDITSECTIONICON).set('alt',
                             M.util.get_string('sectionheadingedit', 'quiz', response.instancesection));
-                    activity.one(SELECTOR.DELETESECTIONICON).set('title',
-                            M.util.get_string('sectionheadingremove', 'quiz', response.instancesection));
-                    activity.one(SELECTOR.DELETESECTIONICON).set('alt',
-                            M.util.get_string('sectionheadingremove', 'quiz', response.instancesection));
+                    var deleteicon = activity.one(SELECTOR.DELETESECTIONICON);
+                    if (deleteicon) {
+                        deleteicon.set('title', M.util.get_string('sectionheadingremove', 'quiz', response.instancesection));
+                        deleteicon.set('alt', M.util.get_string('sectionheadingremove', 'quiz', response.instancesection));
+                    }
                 }
             });
         }