namespace Drupal\paragraphs_demo\Tests;
use Drupal\filter\Entity\FilterFormat;
+use Drupal\paragraphs\Tests\Classic\ParagraphsCoreVersionUiTestTrait;
use Drupal\simpletest\WebTestBase;
/**
*/
class ParagraphsDemoTest extends WebTestBase {
+ use ParagraphsCoreVersionUiTestTrait;
+
/**
* Modules to enable.
*
$basic_html_format->save();
$admin_user = $this->drupalCreateUser(array(
'administer site configuration',
- 'administer nodes',
'create paragraphed_content_demo content',
'edit any paragraphed_content_demo content',
'delete any paragraphed_content_demo content',
));
$this->drupalLogin($admin_user);
+
+ // Set edit mode to open.
+ $this->drupalGet('admin/structure/types/manage/paragraphed_content_demo/form-display');
+ $this->drupalPostAjaxForm(NULL, [], "field_paragraphs_demo_settings_edit");
+ $edit = ['fields[field_paragraphs_demo][settings_edit_form][settings][edit_mode]' => 'open'];
+ $this->drupalPostForm(NULL, $edit, t('Save'));
+
// Check for all pre-configured paragraphs_types.
$this->drupalGet('admin/structure/paragraphs_type');
$this->assertText('Image + Text');
// Check that title and the descriptions are set.
$this->drupalGet('admin/structure/types/manage/paragraphed_content_demo');
$this->assertText('Paragraphed article');
- $this->assertText('Article with paragraphs.');
+ $this->assertText('Article with Paragraphs.');
// Check that the Paragraph field is added.
$this->clickLink('Manage fields');
$edit = [
'field_paragraphs_demo[1][subform][field_user_demo][0][target_id]' => $admin_user->label() . ' (' . $admin_user->id() . ')',
];
- $this->drupalPostForm(NULL, $edit, t('Save and publish'));
+ $this->drupalPostForm(NULL, $edit, t('Save'));
$this->assertText('Paragraphed article Paragraph title has been created.');
$this->assertText('Paragraph title');
$this->assertText('Paragraph text');
// Search a nested Paragraph text.
- /**
- * @todo Reinstate this after search_api is fixed.
- *
- * search_api issue: https://www.drupal.org/node/2792277
- * paragraphs issue: https://www.drupal.org/node/2791315
$this->drupalGet('paragraphs_search', ['query' => ['search_api_fulltext' => 'A search api example']]);
$this->assertRaw('Welcome to the Paragraphs Demo module!');
// Search a node paragraph field text.
$this->drupalGet('paragraphs_search', ['query' => ['search_api_fulltext' => 'It allows you']]);
$this->assertRaw('Welcome to the Paragraphs Demo module!');
- */
// Search non existent text.
$this->drupalGet('paragraphs_search', ['query' => ['search_api_fulltext' => 'foo']]);
$this->assertNoRaw('Welcome to the Paragraphs Demo module!');
+
+ // Check that the dropbutton of Nested Paragraph has the Duplicate function.
+ // For now, this indicates that it is using the EXPERIMENTAL widget.
+ $this->drupalGet('node/1/edit');
+ $this->assertFieldByName('field_paragraphs_demo_3_subform_field_paragraphs_demo_0_duplicate');
}
}