function ElementsVerticalTabsTest::testJavaScriptOrdering

Same name in other branches
  1. 8.9.x 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 60

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');
}

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