You are here

public function DisplayTest::testDisableDisplay 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::testDisableDisplay()

Tests disabling of a display.

File

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

Class

DisplayTest
Tests the display UI.

Namespace

Drupal\views_ui\Tests

Code

public function testDisableDisplay() {
  $view = $this
    ->randomView();
  $path_prefix = 'admin/structure/views/view/' . $view['id'] . '/edit';
  $this
    ->drupalGet($path_prefix);
  $this
    ->assertFalse($this
    ->xpath('//div[contains(@class, :class)]', array(
    ':class' => 'views-display-disabled',
  )), 'Make sure the disabled display css class does not appear after initial adding of a view.');
  $this
    ->assertFieldById('edit-displays-settings-settings-content-tab-content-details-top-actions-disable', '', 'Make sure the disable button is visible.');
  $this
    ->assertNoFieldById('edit-displays-settings-settings-content-tab-content-details-top-actions-enable', '', 'Make sure the enable button is not visible.');
  $this
    ->drupalPostForm(NULL, array(), 'Disable Page');
  $this
    ->assertTrue($this
    ->xpath('//div[contains(@class, :class)]', array(
    ':class' => 'views-display-disabled',
  )), 'Make sure the disabled display css class appears once the display is marked as such.');
  $this
    ->assertNoFieldById('edit-displays-settings-settings-content-tab-content-details-top-actions-disable', '', 'Make sure the disable button is not visible.');
  $this
    ->assertFieldById('edit-displays-settings-settings-content-tab-content-details-top-actions-enable', '', 'Make sure the enable button is visible.');
  $this
    ->drupalPostForm(NULL, array(), 'Enable Page');
  $this
    ->assertFalse($this
    ->xpath('//div[contains(@class, :class)]', array(
    ':class' => 'views-display-disabled',
  )), 'Make sure the disabled display css class does not appears once the display is enabled again.');
}