3 namespace Drupal\paragraphs\Tests\Classic;
5 use Drupal\contact\Entity\ContactForm;
8 * Tests paragraphs with contact forms.
12 class ParagraphsContactTest extends ParagraphsTestBase {
19 public static $modules = array(
24 * Tests adding paragraphs in contact forms.
26 public function testContactForm() {
28 'administer contact forms',
29 'access site-wide contact form'
31 // Add a paragraph type.
32 $this->addParagraphsType('paragraphs_contact');
33 $this->addParagraphsType('text');
35 // Create a contact form.
36 $contact_form = ContactForm::create(['id' => 'test_contact_form']);
37 $contact_form->save();
38 // Add a paragraphs field to the contact form.
39 $this->addParagraphsField($contact_form->id(), 'paragraphs', 'contact_message');
41 // Add a paragraph to the contact form.
42 $this->drupalGet('contact/test_contact_form');
43 $this->drupalPostAjaxForm(NULL, [], 'paragraphs_paragraphs_contact_add_more');
44 // Check that the paragraph is displayed.
45 $this->assertText('paragraphs_contact');
46 $this->drupalPostAjaxForm(NULL, [], 'paragraphs_0_remove');
47 $this->assertText('Deleted Paragraph: paragraphs_contact');