You are here

public function DisplayTest::testActionLinks in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views_ui/src/Tests/DisplayTest.php \Drupal\views_ui\Tests\DisplayTest::testActionLinks()

Tests the action links on the edit display UI.

File

core/modules/views_ui/src/Tests/DisplayTest.php, line 280
Contains \Drupal\views_ui\Tests\DisplayTest.

Class

DisplayTest
Tests the display UI.

Namespace

Drupal\views_ui\Tests

Code

public function testActionLinks() {

  // Change the display title of a display so it contains characters that will
  // be escaped when rendered.
  $display_title = "'<test>'";
  $this
    ->drupalGet('admin/structure/views/view/test_display');
  $display_title_path = 'admin/structure/views/nojs/display/test_display/block_1/display_title';
  $this
    ->drupalPostForm($display_title_path, array(
    'display_title' => $display_title,
  ), t('Apply'));

  // Ensure that the title is escaped as expected.
  $this
    ->assertEscaped($display_title);
  $this
    ->assertNoRaw($display_title);

  // Ensure that the dropdown buttons are displayed correctly.
  $this
    ->assertFieldByXpath('//input[@type="submit"]', 'Duplicate ' . $display_title);
  $this
    ->assertFieldByXpath('//input[@type="submit"]', 'Delete ' . $display_title);
  $this
    ->assertFieldByXpath('//input[@type="submit"]', 'Disable ' . $display_title);
  $this
    ->assertNoFieldByXpath('//input[@type="submit"]', 'Enable ' . $display_title);

  // Disable the display so we can test the rendering of the "Enable" button.
  $this
    ->drupalPostForm(NULL, NULL, 'Disable ' . $display_title);
  $this
    ->assertFieldByXpath('//input[@type="submit"]', 'Enable ' . $display_title);
  $this
    ->assertNoFieldByXpath('//input[@type="submit"]', 'Disable ' . $display_title);

  // Ensure that the title is escaped as expected.
  $this
    ->assertEscaped($display_title);
  $this
    ->assertNoRaw($display_title);
}