function SettingsTrayBlockFormTest::getBlockTests

Same name in other branches
  1. 8.9.x core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayBlockFormTest.php \Drupal\Tests\settings_tray\FunctionalJavascript\SettingsTrayBlockFormTest::getBlockTests()
  2. 10 core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayBlockFormTest.php \Drupal\Tests\settings_tray\FunctionalJavascript\SettingsTrayBlockFormTest::getBlockTests()
  3. 11.x core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayBlockFormTest.php \Drupal\Tests\settings_tray\FunctionalJavascript\SettingsTrayBlockFormTest::getBlockTests()

Creates tests for ::testBlocks().

1 call to SettingsTrayBlockFormTest::getBlockTests()
SettingsTrayBlockFormTest::testBlocks in core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayBlockFormTest.php
Tests opening off-canvas dialog by click blocks and elements in the blocks.

File

core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayBlockFormTest.php, line 166

Class

SettingsTrayBlockFormTest
Testing opening and saving block forms in the off-canvas dialog.

Namespace

Drupal\Tests\settings_tray\FunctionalJavascript

Code

public function getBlockTests() {
    $blocks = [];
    foreach ($this->getTestThemes() as $theme) {
        $blocks += [
            "{$theme}: block-powered" => [
                'theme' => $theme,
                'block_plugin' => 'system_powered_by_block',
                'new_page_text' => 'Can you imagine anyone showing the label on this block',
                'element_selector' => 'span a',
                'label_selector' => 'h2',
                'button_text' => 'Save Powered by Drupal',
                'toolbar_item' => '#toolbar-item-user',
                NULL,
            ],
            "{$theme}: block-branding" => [
                'theme' => $theme,
                'block_plugin' => 'system_branding_block',
                'new_page_text' => 'The site that will live a very short life',
                'element_selector' => "a[rel='home']:last-child",
                'label_selector' => "a[rel='home']:last-child",
                'button_text' => 'Save Site branding',
                'toolbar_item' => '#toolbar-item-administration',
                [
                    'administer site configuration',
                ],
            ],
            "{$theme}: block-search" => [
                'theme' => $theme,
                'block_plugin' => 'search_form_block',
                'new_page_text' => NULL,
                'element_selector' => '[data-drupal-selector="edit-submit"]',
                'label_selector' => 'h2',
                'button_text' => 'Save Search form',
                'toolbar_item' => NULL,
                NULL,
            ],
            // This is the functional JS test coverage accompanying
            // \Drupal\Tests\settings_tray\Functional\SettingsTrayTest::testPossibleAnnotations().
"{$theme}: " . SettingsTrayFormAnnotationIsClassBlock::class => [
                'theme' => $theme,
                'block_plugin' => 'settings_tray_test_class',
                'new_page_text' => NULL,
                'element_selector' => 'span',
                'label_selector' => NULL,
                'button_text' => NULL,
                'toolbar_item' => NULL,
                NULL,
            ],
            // This is the functional JS test coverage accompanying
            // \Drupal\Tests\settings_tray\Functional\SettingsTrayTest::testPossibleAnnotations().
"{$theme}: " . SettingsTrayFormAnnotationNoneBlock::class => [
                'theme' => $theme,
                'block_plugin' => 'settings_tray_test_none',
                'new_page_text' => NULL,
                'element_selector' => 'span',
                'label_selector' => NULL,
                'button_text' => NULL,
                'toolbar_item' => NULL,
                NULL,
            ],
        ];
    }
    return $blocks;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.