public function ParagraphsCollectionStyleTest::testStylePlugin in Paragraphs Collection 8
Same name in this branch
- 8 tests/src/Functional/ParagraphsCollectionStyleTest.php \Drupal\Tests\paragraphs_collection\Functional\ParagraphsCollectionStyleTest::testStylePlugin()
- 8 tests/src/FunctionalJavascript/ParagraphsCollectionStyleTest.php \Drupal\Tests\paragraphs_collection\FunctionalJavascript\ParagraphsCollectionStyleTest::testStylePlugin()
Test paragraphs style behavior plugin.
File
- tests/
src/ FunctionalJavascript/ ParagraphsCollectionStyleTest.php, line 43
Class
- ParagraphsCollectionStyleTest
- Test paragraphs collection style behavior.
Namespace
Drupal\Tests\paragraphs_collection\FunctionalJavascriptCode
public function testStylePlugin() {
$this
->loginAsAdmin([
'access content overview',
'edit behavior plugin settings',
]);
$page = $this
->getSession()
->getPage();
$this
->drupalGet('admin/structure/paragraphs_type/add');
$page
->fillField('label', 'TestPlugin');
$this
->assertSession()
->waitForElementVisible('css', '#edit-name-machine-name-suffix .link');
$page
->pressButton('Edit');
$page
->fillField('id', 'testplugin');
$this
->click('#edit-behavior-plugins-style-enabled');
$this
->click('#edit-behavior-plugins-style-settings-groups-regular-test-group');
$this
->assertSession()
->assertWaitOnAjaxRequest();
$page
->fillField('label', 'TestPlugin');
$this
->assertSession()
->assertWaitOnAjaxRequest();
$edit = [
'behavior_plugins[style][settings][groups_defaults][regular_test_group][default]' => '',
];
$this
->drupalPostForm(NULL, $edit, t('Save and manage fields'));
$this
->addParagraphedContentType('testcontent', 'testparagraphfield');
$this
->drupalGet('node/add/testcontent');
$this
->click('.dropbutton-toggle');
$page
->pressButton('Add TestPlugin');
$this
->assertSession()
->assertWaitOnAjaxRequest();
$this
->clickLink('Behavior');
$style_selector = $this
->getSession()
->getPage()
->find('css', '.form-item-testparagraphfield-0-behavior-plugins-style-style-wrapper-styles-regular-test-group');
$this
->assertTrue($style_selector
->isVisible());
$this
->clickLink('Content');
$this
->assertFalse($style_selector
->isVisible());
}