public function DisplayTest::testDisplayAreas

Tests display areas.

File

drupal/core/modules/views_ui/lib/Drupal/views_ui/Tests/DisplayTest.php, line 233
Contains \Drupal\views_ui\Tests\DisplayTest.

Class

DisplayTest

Namespace

Drupal\views_ui\Tests

Code

public function testDisplayAreas() {

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

  // Add a new data display to the view.
  $view = views_get_view('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');

  // Create a mapping of area type => class.
  $areas = array(
    'header' => 'header',
    'footer' => 'footer',
    'empty' => 'no-results-behavior',
  );

  // Assert that the expected text is found in each area category.
  foreach ($areas as $type => $class) {
    $element = $this
      ->xpath('//div[contains(@class, :class)]/div', array(
      ':class' => $class,
    ));
    $this
      ->assertEqual((string) $element[0], "The selected display type does not utilize {$type} plugins");
  }
}