function ElementsVerticalTabsTest::testJavaScriptOrdering

Same name in other branches
  1. 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->assertTrue($position1 !== FALSE && $position2 !== FALSE && $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.