You are here

public function SettingsTrayBlockFormTest::getBlockTests in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayBlockFormTest.php \Drupal\Tests\settings_tray\FunctionalJavascript\SettingsTrayBlockFormTest::getBlockTests()
  2. 9 core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayBlockFormTest.php \Drupal\Tests\settings_tray\FunctionalJavascript\SettingsTrayBlockFormTest::getBlockTests()

Creates tests for ::testBlocks().

File

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

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;
}