function TextareaWithSummaryTest::assertSummaryToggle
Same name in other branches
- 9 core/modules/text/tests/src/FunctionalJavascript/TextareaWithSummaryTest.php \Drupal\Tests\text\FunctionalJavascript\TextareaWithSummaryTest::assertSummaryToggle()
- 8.9.x core/modules/text/tests/src/FunctionalJavascript/TextareaWithSummaryTest.php \Drupal\Tests\text\FunctionalJavascript\TextareaWithSummaryTest::assertSummaryToggle()
- 11.x core/modules/text/tests/src/FunctionalJavascript/TextareaWithSummaryTest.php \Drupal\Tests\text\FunctionalJavascript\TextareaWithSummaryTest::assertSummaryToggle()
Helper to test toggling the summary area.
@internal
2 calls to TextareaWithSummaryTest::assertSummaryToggle()
- TextareaWithSummaryTest::testTextSummaryBehavior in core/
modules/ text/ tests/ src/ FunctionalJavascript/ TextareaWithSummaryTest.php - Tests the textSummary javascript behavior.
- TextareaWithSummaryTest::testTextSummaryRequiredBehavior in core/
modules/ text/ tests/ src/ FunctionalJavascript/ TextareaWithSummaryTest.php - Tests that the textSummary behavior is not run for required summary fields.
File
-
core/
modules/ text/ tests/ src/ FunctionalJavascript/ TextareaWithSummaryTest.php, line 48
Class
- TextareaWithSummaryTest
- Tests the JavaScript functionality of the text_textarea_with_summary widget.
Namespace
Drupal\Tests\text\FunctionalJavascriptCode
protected function assertSummaryToggle() : void {
$this->drupalGet('node/add/page');
$widget = $this->getSession()
->getPage()
->findById('edit-body-wrapper');
$summary_field = $widget->findField('edit-body-0-summary');
$this->assertEquals(FALSE, $summary_field->isVisible(), 'Summary field is hidden by default.');
$this->assertEquals(FALSE, $widget->hasButton('Hide summary'), 'No Hide summary link by default.');
$widget->pressButton('Edit summary');
$this->assertEquals(FALSE, $widget->hasButton('Edit summary'), 'Edit summary link is removed after clicking.');
$this->assertEquals(TRUE, $summary_field->isVisible(), 'Summary field is shown.');
$widget->pressButton('Hide summary');
$this->assertEquals(FALSE, $widget->hasButton('Hide summary'), 'Hide summary link is removed after clicking.');
$this->assertEquals(FALSE, $summary_field->isVisible(), 'Summary field is hidden again.');
$this->assertEquals(TRUE, $widget->hasButton('Edit summary'), 'Edit summary link is visible again.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.