You are here

public function ElementsVerticalTabsTest::testWrapperNotShownWhenEmpty in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/system/tests/src/Functional/Form/ElementsVerticalTabsTest.php \Drupal\Tests\system\Functional\Form\ElementsVerticalTabsTest::testWrapperNotShownWhenEmpty()

Ensures that vertical tab markup is not shown if user has no tab access.

File

core/modules/system/tests/src/Functional/Form/ElementsVerticalTabsTest.php, line 70

Class

ElementsVerticalTabsTest
Tests the vertical_tabs form element for expected behavior.

Namespace

Drupal\Tests\system\Functional\Form

Code

public function testWrapperNotShownWhenEmpty() {

  // Test admin user can see vertical tabs and wrapper.
  $this
    ->drupalGet('form_test/vertical-tabs');
  $this
    ->assertSession()
    ->elementExists('xpath', "//div[@data-vertical-tabs-panes]");

  // Test wrapper markup not present for non-privileged web user.
  $this
    ->drupalLogin($this->webUser);
  $this
    ->drupalGet('form_test/vertical-tabs');
  $this
    ->assertSession()
    ->elementNotExists('xpath', "//div[@data-vertical-tabs-panes]");
}