You are here

public function DisplayTest::testDisplayAreas in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/views_ui/tests/src/Functional/DisplayTest.php \Drupal\Tests\views_ui\Functional\DisplayTest::testDisplayAreas()
  2. 9 core/modules/views_ui/tests/src/Functional/DisplayTest.php \Drupal\Tests\views_ui\Functional\DisplayTest::testDisplayAreas()

Tests display areas.

File

core/modules/views_ui/tests/src/Functional/DisplayTest.php, line 131

Class

DisplayTest
Tests the display UI.

Namespace

Drupal\Tests\views_ui\Functional

Code

public function testDisplayAreas() {

  // Show the advanced column.
  $this
    ->config('views.settings')
    ->set('ui.show.advanced_column', TRUE)
    ->save();

  // Add a new data display to the view.
  $view = Views::getView('test_display');
  $view->storage
    ->addDisplay('display_no_area_test');
  $view
    ->save();
  $this
    ->drupalGet('admin/structure/views/view/test_display/edit/display_no_area_test_1');
  $areas = [
    'header',
    'footer',
    'empty',
  ];

  // Assert that the expected text is found in each area category.
  foreach ($areas as $type) {
    $this
      ->assertSession()
      ->elementTextEquals('xpath', "//div[contains(@class, '{$type}')]/div", "The selected display type does not use {$type} plugins");
  }
}