trait PanelsIPETrait in Lightning Layout 8
Hierarchy
- trait \Drupal\Tests\lightning_layout\Traits\PanelsIPETrait
4 files declare their use of PanelsIPETrait
- IpeQuickEditTest.php in tests/
src/ FunctionalJavascript/ IpeQuickEditTest.php - PanelizerTest.php in tests/
src/ FunctionalJavascript/ PanelizerTest.php - PanelizerWizardTest.php in tests/
src/ FunctionalJavascript/ PanelizerWizardTest.php - PanelsInPlaceEditorTest.php in tests/
src/ FunctionalJavascript/ PanelsInPlaceEditorTest.php
File
- tests/
src/ Traits/ PanelsIPETrait.php, line 5
Namespace
Drupal\Tests\lightning_layout\TraitsView source
trait PanelsIPETrait {
/**
* Saves the Panels IPE layout.
*/
protected function saveLayout() {
$this
->assertSession()
->elementExists('named', [
'link',
'Save',
], $this
->getTray())
->click();
$this
->assertSession()
->waitForElement('css', '#panels-ipe-tray:not(.unsaved)');
}
/**
* Opens the form to add a block to the Panels IPE layout.
*
* @param string $plugin_id
* The block plugin ID.
* @param string $category
* The category of the block.
*
* @return \Behat\Mink\Element\NodeElement
* The block form.
*/
protected function getBlockForm($plugin_id, $category) {
$assert = $this
->assertSession();
$tab = $this
->getTab('Manage Content');
$category = $assert
->elementExists('css', '.ipe-category[data-category="' . $category . '"]', $tab);
if (!$category
->hasClass('active')) {
$category
->click();
$assert
->assertWaitOnAjaxRequest();
}
$assert
->elementExists('css', '.ipe-block-plugin a[data-plugin-id="' . $plugin_id . '"]', $tab)
->click();
$block_form = $assert
->waitForElementVisible('css', '.panels-ipe-block-plugin-form');
$this
->assertNotEmpty($block_form);
return $block_form;
}
/**
* Opens a tab in the Panels IPE tray and returns its contents.
*
* @param string $label
* The label of the tab.
*
* @return \Behat\Mink\Element\NodeElement
* The tab contents.
*/
protected function getTab($label) {
$tray = $this
->getTray();
$tray
->clickLink($label);
$assert = $this
->assertSession();
$assert
->assertWaitOnAjaxRequest();
return $assert
->elementExists('css', '.ipe-tabs-content', $tray);
}
/**
* Returns the Panels IPE tray.
*
* @return \Behat\Mink\Element\NodeElement
* The tray element.
*/
protected function getTray() {
return $this
->assertSession()
->elementExists('css', '#panels-ipe-tray');
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PanelsIPETrait:: |
protected | function | Opens the form to add a block to the Panels IPE layout. | |
PanelsIPETrait:: |
protected | function | Opens a tab in the Panels IPE tray and returns its contents. | |
PanelsIPETrait:: |
protected | function | Returns the Panels IPE tray. | |
PanelsIPETrait:: |
protected | function | Saves the Panels IPE layout. |