Skip to content

Commit

Permalink
MDL-74465 block_html: display config when adding
Browse files Browse the repository at this point in the history
  • Loading branch information
marinaglancy committed Mar 30, 2023
1 parent 6b081d2 commit 04c3cd2
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 24 deletions.
9 changes: 9 additions & 0 deletions blocks/html/edit_form.php
Expand Up @@ -88,4 +88,13 @@ function set_data($defaults) {
$this->block->config->title = $title;
}
}

/**
* Display the configuration form when block is being added to the page
*
* @return bool
*/
public static function display_form_when_adding(): bool {
return true;
}
}
8 changes: 3 additions & 5 deletions blocks/html/tests/behat/configuring_html_block.feature
Expand Up @@ -9,11 +9,9 @@ Feature: Adding and configuring Text blocks
Given I log in as "admin"
And I am on site homepage
When I turn editing mode on
And I add the "Text" block
And I configure the "(new text block)" block
And I set the field "Content" to "Static text without a header"
Then I should see "Text block title"
And I press "Save changes"
And I add the "Text" block to the default region with:
| Text block title | |
| Content | Static text without a header |
Then I should not see "(new text block)"
And I configure the "block_html" block
And I set the field "Text block title" to "The Text block header"
Expand Down
8 changes: 3 additions & 5 deletions blocks/tests/behat/configure_block_throughout_site.feature
Expand Up @@ -64,10 +64,8 @@ Feature: Add and configure blocks throughout the site
Given I log in as "admin"
And I am on homepage
And I turn editing mode on
And I add the "Text" block
And I configure the "(new text block)" block
And I set the following fields to these values:
And I add the "Text" block to the default region with:
| Text block title | Foo " onload="document.getElementsByTagName('body')[0].remove()" alt=" |
| Content | Example |
When I press "Save changes"
Then I should see "Example"
Then I should see "Example" in the "block_html" "block"
Then I should see "document.getElementsByTagName"
10 changes: 6 additions & 4 deletions filter/displayh5p/tests/behat/inline_editing_content.feature
Expand Up @@ -221,16 +221,18 @@ Feature: Inline editing H5P content anywhere
Given I am on the "C1" "Course" page logged in as "admin"
# Add H5P content to the block.
And I turn editing mode on
And I add the "Text" block
And I configure the "(new text block)" block
And I click on "Insert H5P" "button" in the "#fitem_id_config_text" "css_element"
And I add the "Text" block to the default region with:
| Text block title | H5PTest |
| Content | - |
And I configure the "H5PTest" block
And I click on "Insert H5P" "button" in the "//div[contains(@id,'fitem_id_config_text')]" "xpath_element"
And I click on "Browse repositories..." "button" in the "Insert H5P" "dialogue"
And I select "Content bank" repository in file picker
And I click on "Greeting card" "file" in repository content area
And I click on "Make a copy of the file" "radio"
And I click on "Select this file" "button"
And I click on "Insert H5P" "button" in the "Insert H5P" "dialogue"
And I press "Save changes"
And I click on "Save changes" "button" in the "Configure H5PTest block" "dialogue"
And I switch to "h5p-iframe" class iframe
And I switch to "h5p-iframe" class iframe
And I should see "Hello world!"
Expand Down
10 changes: 5 additions & 5 deletions my/tests/behat/my_courses.feature
Expand Up @@ -92,14 +92,14 @@ Feature: Run tests over my courses.
Given I log in as "admin"
And I am on site homepage
And I turn editing mode on
And I add the "Text" block
And I configure the "(new text block)" block
And I set the following fields to these values:
| Page contexts | Display throughout the entire site |
And I add the "Text" block to the default region with:
| Text block title | Text on all pages |
| Content | This is visible on all pages |
And I configure the "Text on all pages" block
And I set the following fields to these values:
| Page contexts | Display throughout the entire site |
| Default region | Right |
And I press "Save changes"
And I click on "Save changes" "button" in the "Configure Text on all pages block" "dialogue"
And I should see "This is visible on all pages"
And "Move Text on all pages block" "menuitem" should exist in the "Text on all pages" "block"
When I am on the "My courses" page
Expand Down
10 changes: 5 additions & 5 deletions theme/boost/tests/behat/mycoursesblocks.feature
Expand Up @@ -11,14 +11,14 @@ Feature: My courses page block layout in Boost theme
And I log in as "admin"
And I am on site homepage
And I turn editing mode on
And I add the "Text" block
And I configure the "(new text block)" block
And I set the following fields to these values:
| Page contexts | Display throughout the entire site |
And I add the "Text" block to the default region with:
| Text block title | Text on all pages |
| Content | This is visible on all pages |
And I configure the "Text on all pages" block
And I set the following fields to these values:
| Page contexts | Display throughout the entire site |
| Default region | Right |
And I press "Save changes"
And I click on "Save changes" "button" in the "Configure Text on all pages block" "dialogue"

Scenario: Student can see relevant blocks with correct placement on my courses page
When I log in as "student1"
Expand Down

0 comments on commit 04c3cd2

Please sign in to comment.