function ManageDisplayTest::testViewModeLocalTasksOrder

Same name and namespace in other branches
  1. 11.x core/modules/field_ui/tests/src/Functional/ManageDisplayTest.php \Drupal\Tests\field_ui\Functional\ManageDisplayTest::testViewModeLocalTasksOrder()
  2. 10 core/modules/field_ui/tests/src/Functional/ManageDisplayTest.php \Drupal\Tests\field_ui\Functional\ManageDisplayTest::testViewModeLocalTasksOrder()

Tests if display mode local tasks appear in alphabetical order by label.

File

core/modules/field_ui/tests/src/Functional/ManageDisplayTest.php, line 249

Class

ManageDisplayTest
Tests the Field UI "Manage display" and "Manage form display" screens.

Namespace

Drupal\Tests\field_ui\Functional

Code

public function testViewModeLocalTasksOrder() : void {
  $manage_display = 'admin/structure/types/manage/' . $this->type . '/display';
  // Specify the 'rss' and 'teaser' modes.
  $this->drupalGet($manage_display);
  $page = $this->getSession()
    ->getPage();
  $type_normalized = str_replace([
    '.',
    '_',
  ], '-', $this->type);
  $enable_rss_link = $page->find('xpath', "//tr[contains(@id, 'display-mode-node-{$type_normalized}-rss')]//a[contains(., 'Enable')]");
  $this->assertNotNull($enable_rss_link, 'Enable link should exist for the RSS view mode.');
  $enable_rss_link->click();
  $this->assertOrderInPage([
    'RSS',
    'Teaser',
  ], '#enabled-display-modes-wrapper');
  $edit = [
    'label' => 'Breezier',
  ];
  $this->drupalGet('admin/structure/display-modes/view/manage/node.teaser');
  $this->submitForm($edit, 'Save');
  $this->drupalGet($manage_display);
  $this->assertOrderInPage([
    'Breezier',
    'RSS',
  ], '#enabled-display-modes-wrapper');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.