You are here

public function ElementsVerticalTabsTest::testJavaScriptOrdering in Drupal 10

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

Ensures that vertical-tabs.js is included before collapse.js.

Otherwise, collapse.js adds "SHOW" or "HIDE" labels to the tabs.

File

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

Class

ElementsVerticalTabsTest
Tests the vertical_tabs form element for expected behavior.

Namespace

Drupal\Tests\system\Functional\Form

Code

public function testJavaScriptOrdering() {
  $this
    ->drupalGet('form_test/vertical-tabs');
  $content = $this
    ->getSession()
    ->getPage()
    ->getContent();
  $position1 = strpos($content, 'core/misc/vertical-tabs.js');
  $position2 = strpos($content, 'core/misc/collapse.js');
  $this
    ->assertNotFalse($position1);
  $this
    ->assertNotFalse($position2);
  $this
    ->assertGreaterThan($position1, $position2, 'vertical-tabs.js is included before collapse.js');
}