Tests header actions with multi fields.
public function testHeaderActionsWithMultiFields() {
$this
->addParagraphedContentType('paragraphed_test');
$this
->loginAsAdmin([
'create paragraphed_test content',
'edit any paragraphed_test content',
]);
$this
->drupalGet('/admin/structure/types/manage/paragraphed_test/fields/add-field');
// Add a Paragraph type.
$paragraph_type = 'text_paragraph';
$this
->addParagraphsType($paragraph_type);
static::fieldUIAddNewField('admin/structure/types/manage/paragraphed_test', 'second', 'Second paragraph', 'field_ui:entity_reference_revisions:paragraph', [], []);
// Add a text field to the text_paragraph type.
static::fieldUIAddNewField('admin/structure/paragraphs_type/' . $paragraph_type, 'text', 'Text', 'text_long', [], []);
$this
->drupalGet('node/add/paragraphed_test');
$this
->submitForm([], 'field_paragraphs_text_paragraph_add_more');
$this
->submitForm([], 'field_second_text_paragraph_add_more');
// Checks that we have Collapse\Edit all for each field.
$this
->assertSession()
->responseContains('field_paragraphs_collapse_all');
$this
->assertSession()
->responseContains('field_paragraphs_edit_all');
$this
->assertSession()
->responseContains('field_second_collapse_all');
$this
->assertSession()
->responseContains('field_second_edit_all');
$edit = [
'field_second[0][subform][field_text][0][value]' => 'Second field',
];
$this
->submitForm($edit, 'field_second_collapse_all');
// Checks that we collapsed only children from second field.
$this
->assertSession()
->responseNotContains('field_paragraphs_0_edit');
$this
->assertSession()
->responseContains('field_second_0_edit');
$this
->submitForm([], 'field_paragraphs_collapse_all');
$this
->assertSession()
->responseContains('field_paragraphs_0_edit');
$this
->assertSession()
->responseContains('field_second_0_edit');
$this
->submitForm([], 'field_second_edit_all');
$this
->assertSession()
->responseContains('field_second_0_collapse');
$edit = [
'title[0][value]' => 'Test',
];
$this
->submitForm($edit, 'Save');
$this
->assertSession()
->pageTextContains('paragraphed_test Test has been created.');
$node = $this
->getNodeByTitle('Test');
$this
->drupalGet('node/' . $node
->id());
$this
->clickLink('Edit');
$this
->assertSession()
->pageTextNotContains('No Paragraph added yet.');
}