function TextareaWithSummaryTest::testTextSummaryBehavior
Same name in other branches
- 9 core/modules/text/tests/src/FunctionalJavascript/TextareaWithSummaryTest.php \Drupal\Tests\text\FunctionalJavascript\TextareaWithSummaryTest::testTextSummaryBehavior()
- 8.9.x core/modules/text/tests/src/FunctionalJavascript/TextareaWithSummaryTest.php \Drupal\Tests\text\FunctionalJavascript\TextareaWithSummaryTest::testTextSummaryBehavior()
- 11.x core/modules/text/tests/src/FunctionalJavascript/TextareaWithSummaryTest.php \Drupal\Tests\text\FunctionalJavascript\TextareaWithSummaryTest::testTextSummaryBehavior()
Tests the textSummary javascript behavior.
File
-
core/
modules/ text/ tests/ src/ FunctionalJavascript/ TextareaWithSummaryTest.php, line 69
Class
- TextareaWithSummaryTest
- Tests the JavaScript functionality of the text_textarea_with_summary widget.
Namespace
Drupal\Tests\text\FunctionalJavascriptCode
public function testTextSummaryBehavior() : void {
// Test with field defaults.
$this->assertSummaryToggle();
// Repeat test with non-empty field description.
$body_field = FieldConfig::loadByName('node', 'page', 'body');
$body_field->set('description', 'Text with Summary field description.');
$body_field->save();
$this->assertSummaryToggle();
// Repeat test with unlimited cardinality field.
$body_field_storage = FieldStorageConfig::loadByName('node', 'body');
$body_field_storage->setCardinality(-1);
$body_field_storage->save();
$this->assertSummaryToggle();
// Test summary is shown when non-empty.
$node = $this->createNode([
'body' => [
[
'value' => $this->randomMachineName(32),
'summary' => $this->randomMachineName(32),
'format' => filter_default_format(),
],
],
]);
$this->drupalGet('node/' . $node->id() . '/edit');
$summary_field = $this->getSession()
->getPage()
->findField('edit-body-0-summary');
$this->assertEquals(TRUE, $summary_field->isVisible());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.