diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Core/Form/FormGroupingElementsTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Core/Form/FormGroupingElementsTest.php new file mode 100644 index 0000000..b2c20e8 --- /dev/null +++ b/core/tests/Drupal/FunctionalJavascriptTests/Core/Form/FormGroupingElementsTest.php @@ -0,0 +1,63 @@ +drupalCreateUser(); + $this->drupalLogin($account); + } + + /** + * Tests that a fragment link to a child of an inactive vertical tab works. + * + * Makes sure that a field, that is not visible due to the state of a grouping + * element, becomes visible when a fragment link to it is clicked or when the + * url fragment changes. + */ + public function testVerticalTabChildFragmentLink() { + $session = $this->getSession(); + + // Visit the group vertical tabs testing page. + $this->drupalGet('form-test/group-vertical-tabs'); + + $page = $session->getPage(); + + $element_1_selector = '#edit-element'; + $element_1 = $page->find('css', $element_1_selector); + + // Assert that the element in the first vertical tab is visible. + $this->assertTrue($element_1->isVisible(), 'Element 1 is visible.'); + + $element_2_selector = '#edit-element-2'; + $element_2 = $page->find('css', $element_2_selector); + + // Click on a fragment link pointing to an invisible field inside an + // inactive vertical. + $session->executeScript("jQuery('').insertAfter('h1')[0].click()"); + + // Assert that the element in the second vertical tab is visible. + $this->assertTrue($element_2->isVisible(), 'Element 2 is visible.'); + } + +}