You are here

public function ParagraphsUiTest::testDefaultWidget in Paragraphs 8

Test the default paragraphs widget used.

File

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

Class

ParagraphsUiTest
Tests the Paragraphs user interface.

Namespace

Drupal\Tests\paragraphs\Functional

Code

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

  // Create a new content type.
  $this
    ->drupalGet('admin/structure/types/add');
  $this
    ->submitForm([
    'name' => 'Test',
    'type' => 'test',
  ], 'Save and manage fields');

  // Add a new paragraphs field to the content type.
  $this
    ->clickLink('Add field');
  $this
    ->submitForm([
    'new_storage_type' => 'field_ui:entity_reference_revisions:paragraph',
    'label' => 'Paragraph',
    'field_name' => 'paragraph',
  ], 'Save and continue');
  $this
    ->submitForm([], 'Save field settings');

  // Visit the "Manage form display" page of the new content type.
  $this
    ->drupalGet('admin/structure/types/manage/test/form-display');

  // The selected widget should be "paragraphs".
  $this
    ->assertSession()
    ->fieldValueEquals('fields[field_paragraph][type]', 'paragraphs');
}