PanelsIPETrait.php in Lightning Layout 8
File
tests/src/Traits/PanelsIPETrait.php
View source
<?php
namespace Drupal\Tests\lightning_layout\Traits;
trait PanelsIPETrait {
protected function saveLayout() {
$this
->assertSession()
->elementExists('named', [
'link',
'Save',
], $this
->getTray())
->click();
$this
->assertSession()
->waitForElement('css', '#panels-ipe-tray:not(.unsaved)');
}
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;
}
protected function getTab($label) {
$tray = $this
->getTray();
$tray
->clickLink($label);
$assert = $this
->assertSession();
$assert
->assertWaitOnAjaxRequest();
return $assert
->elementExists('css', '.ipe-tabs-content', $tray);
}
protected function getTray() {
return $this
->assertSession()
->elementExists('css', '#panels-ipe-tray');
}
}