You are here

public function ParagraphsFeaturesSingleActionTest::testAddAboveSupport in Paragraphs Features 8

Same name and namespace in other branches
  1. 2.x tests/src/FunctionalJavascript/ParagraphsFeaturesSingleActionTest.php \Drupal\Tests\paragraphs_features\FunctionalJavascript\ParagraphsFeaturesSingleActionTest::testAddAboveSupport()

Test "add above" feature in combination with single action to button.

File

tests/src/FunctionalJavascript/ParagraphsFeaturesSingleActionTest.php, line 62

Class

ParagraphsFeaturesSingleActionTest
Test display of single actions according to the dropdown_to_button setting.

Namespace

Drupal\Tests\paragraphs_features\FunctionalJavascript

Code

public function testAddAboveSupport() {

  // Create content type with paragraphs field.
  $content_type = 'test_single_action';

  // Create nested paragraph with addition of one text test paragraph.
  $this
    ->createTestConfiguration($content_type, 1);

  // Enable setting to show single action as button.
  $this
    ->enableDropdownToButton();

  // Setup content type settings, this will disable all paragraph actions.
  $this
    ->setupParagraphSettings($content_type);

  // Check that dropdown toggle is not displayed.
  $this
    ->drupalGet("node/add/{$content_type}");
  $this
    ->assertSession()
    ->elementNotExists('xpath', '//div[contains(@class, "paragraphs-dropdown")]');

  // Enable Add Above.
  $this
    ->setParagraphFeature($content_type, 'add_above', 'add_above');

  // Check that dropdown toggle is displayed.
  $this
    ->drupalGet("node/add/{$content_type}");
  $this
    ->assertSession()
    ->elementExists('xpath', '//div[contains(@class, "paragraphs-dropdown")]');
}