You are here

public function ParagraphsUiTest::testParagraphTypeClass in Paragraphs 8

Tests if the paragraph type class is present when added.

File

tests/src/Functional/ParagraphsUiTest.php, line 30

Class

ParagraphsUiTest
Tests the Paragraphs user interface.

Namespace

Drupal\Tests\paragraphs\Functional

Code

public function testParagraphTypeClass() {
  $this
    ->loginAsAdmin();

  // Add a Paragraphed test content.
  $this
    ->addParagraphedContentType('paragraphed_test', 'paragraphs');
  $this
    ->addParagraphsType('test_paragraph');
  $this
    ->addParagraphsType('text');

  // Add paragraphs to a node and check if their type is present as a class.
  $this
    ->drupalGet('node/add/paragraphed_test');
  $this
    ->getSession()
    ->getPage()
    ->findButton('paragraphs_test_paragraph_add_more')
    ->press();
  $this
    ->assertSession()
    ->responseContains('paragraph-type--test-paragraph');
  $this
    ->getSession()
    ->getPage()
    ->findButton('paragraphs_text_add_more')
    ->press();
  $this
    ->assertSession()
    ->responseContains('paragraph-type--text');
  $this
    ->getSession()
    ->getPage()
    ->findButton('paragraphs_0_remove')
    ->press();
  $this
    ->assertSession()
    ->responseContains('paragraph-type--text');
}