From 4ec5aac73470b418defac7d465428420cd0db7c7 Mon Sep 17 00:00:00 2001 From: Huong Nguyen Date: Mon, 24 Apr 2023 15:53:37 +0700 Subject: [PATCH] MDL-78007 tiny_media: Fix wrong condition for the Tiny Media Including in this commit: - Switched to Tiny editor in manually_mark_question.feature --- .../tiny/plugins/media/classes/plugininfo.php | 2 +- .../behat/manually_mark_question.feature | 19 +++++++------------ 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/lib/editor/tiny/plugins/media/classes/plugininfo.php b/lib/editor/tiny/plugins/media/classes/plugininfo.php index 3cbc92951df..0085b48dc07 100644 --- a/lib/editor/tiny/plugins/media/classes/plugininfo.php +++ b/lib/editor/tiny/plugins/media/classes/plugininfo.php @@ -53,7 +53,7 @@ class plugininfo extends plugin implements plugin_with_buttons, plugin_with_menu $canhavefiles = !empty($options['maxfiles']); $canhaveexternalfiles = !empty($options['return_types']) && ($options['return_types'] & FILE_EXTERNAL); - return isloggedin() && !isguestuser() && $canhavefiles && $canhaveexternalfiles; + return isloggedin() && !isguestuser() && ($canhavefiles || $canhaveexternalfiles); } public static function get_available_buttons(): array { diff --git a/mod/quiz/tests/behat/manually_mark_question.feature b/mod/quiz/tests/behat/manually_mark_question.feature index 4c92475eac6..d8bc6e80ae6 100644 --- a/mod/quiz/tests/behat/manually_mark_question.feature +++ b/mod/quiz/tests/behat/manually_mark_question.feature @@ -56,8 +56,7 @@ Feature: Teachers can override the grade for any question And I switch to "commentquestion" window And I should see "Teacher 1" in the "Manually graded 10 with comment: " "table_row" - # This scenario has Atto-specific steps. See MDL-75913 for further details. - @javascript @_switch_window @_file_upload @_bug_phantomjs @editor_atto + @javascript @_switch_window @_file_upload @_bug_phantomjs @editor_tiny Scenario: Comment on a response to an essay question attempt. When I log in as "teacher1" And I follow "Manage private files" @@ -67,21 +66,17 @@ Feature: Teachers can override the grade for any question And I follow "Make comment or override mark" And I switch to "commentquestion" window And I set the field "Comment" to "Administrator's comment" - # Atto needs focus to add image, select empty p tag to do so. - And I select the text in the "Comment" Atto editor - And I click on "Insert or edit image" "button" in the "[data-fieldtype=editor]" "css_element" - And I click on "Browse repositories..." "button" + And I select the "p" element in position "0" of the "Comment" TinyMCE editor + And I click on the "Image" button for the "Comment" TinyMCE editor + And I click on "Browse repositories..." "button" in the "Image properties" "dialogue" And I click on "Private files" "link" in the ".fp-repo-area" "css_element" And I click on "moodle_logo.jpg" "link" And I click on "Select this file" "button" And I set the field "Describe this image for someone who cannot see it" to "It's the logo" - And I click on "Save image" "button" - # Editor is not inserting the html for the image correctly - # when running under behat so line below manually inserts it. - And I set the field "Comment" to "\"It's" + And I click on "Save image" "button" in the "Image properties" "dialogue" And I press "Save" and switch to main window And I switch to the main window - And I should see "Commented: [It's the logo]" in the ".history table" "css_element" - And "img[contains(@src, 'moodle_logo.jpg')]" "xpath_element" should exist in the ".comment" "css_element" + Then I should see "Commented: [It's the logo]" in the ".history table" "css_element" + And "//img[contains(@src, 'moodle_logo.jpg')]" "xpath_element" should exist in the ".comment" "css_element" # This time is same as time the window is open. So wait for it to close before proceeding. And I wait "2" seconds