protected function TextareaWithSummaryTest::assertSummaryToggle in Drupal 8
Same name and namespace in other branches
- 9 core/modules/text/tests/src/FunctionalJavascript/TextareaWithSummaryTest.php \Drupal\Tests\text\FunctionalJavascript\TextareaWithSummaryTest::assertSummaryToggle()
Helper to test toggling the summary area.
1 call to TextareaWithSummaryTest::assertSummaryToggle()
- TextareaWithSummaryTest::testTextSummaryBehavior in core/
modules/ text/ tests/ src/ FunctionalJavascript/ TextareaWithSummaryTest.php - Tests the textSummary javascript behavior.
File
- core/
modules/ text/ tests/ src/ FunctionalJavascript/ TextareaWithSummaryTest.php, line 43
Class
- TextareaWithSummaryTest
- Tests the JavaScript functionality of the text_textarea_with_summary widget.
Namespace
Drupal\Tests\text\FunctionalJavascriptCode
protected function assertSummaryToggle() {
$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.');
}