Tests the default paragraph type behavior for a field with a single type.
public function testDefaultParagraphTypeWithSingleType() {
$this
->addParagraphedContentType('paragraphed_test', 'paragraphs', 'entity_reference_paragraphs');
$this
->loginAsAdmin([
'administer content types',
'administer node form display',
'edit any paragraphed_test content',
]);
// Add a Paragraphed test content.
$paragraphs_type_text = ParagraphsType::create([
'id' => 'text',
'label' => 'Text',
]);
$paragraphs_type_text
->save();
// Check that when only one paragraph type is allowed in a content type,
// one instance is automatically added in the 'Add content' dialogue.
$this
->drupalGet('node/add/paragraphed_test');
$this
->assertSession()
->pageTextNotContains('No Paragraph added yet.');
// Check that no paragraph type is automatically added, if the defaut
// setting was set to '- None -'.
$this
->setDefaultParagraphType('paragraphed_test', 'paragraphs', 'paragraphs_settings_edit', '_none');
$this
->drupalGet('node/add/paragraphed_test');
$this
->assertSession()
->pageTextContains('No Paragraph added yet.');
}