public function DisplayTest::testLinkDisplay

Tests the link-display setting.

File

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

Class

DisplayTest

Namespace

Drupal\views_ui\Tests

Code

public function testLinkDisplay() {

  // Test setting the link display in the UI form.
  $path = 'admin/structure/views/view/test_display/edit/block_1';
  $link_display_path = 'admin/structure/views/nojs/display/test_display/block_1/link_display';
  $this
    ->drupalPost($link_display_path, array(
    'link_display' => 'page_1',
  ), t('Apply'));

  // The form redirects to the master display.
  $this
    ->drupalGet($path);
  $result = $this
    ->xpath("//a[contains(@href, :path)]", array(
    ':path' => $link_display_path,
  ));
  $this
    ->assertEqual($result[0], 'Page', 'Make sure that the link option summary shows the right linked display.');
  $link_display_path = 'admin/structure/views/nojs/display/test_display/block_1/link_display';
  $this
    ->drupalPost($link_display_path, array(
    'link_display' => 'custom_url',
  ), t('Apply'));

  // The form redirects to the master display.
  $this
    ->drupalGet($path);
  $this
    ->assertLink(t('Custom URL'), 0, 'The link option has custom url as summary.');
}