public function PanelsIPEContext::changeLayout in Lightning Layout 8
Changes the Panels IPE layout.
@When I change the layout to :layout_id from the :category category
Parameters
string $category: The layout's category.
string $layout_id: The layout's data-layout-id value.
File
- tests/
contexts/ PanelsIPEContext.behat.inc, line 186
Class
- PanelsIPEContext
- Contains step definitions for interacting with Panels IPE.
Namespace
Acquia\LightningExtension\ContextCode
public function changeLayout($category, $layout_id) {
$page = $this
->getSession()
->getPage();
$assert = $this
->assertSession();
$page
->clickLink('Change Layout');
$this
->awaitAjax();
$assert
->elementExists('css', "a[data-category='{$category}']")
->click();
$this
->awaitAjax();
$assert
->elementExists('css', "a[data-layout-id='{$layout_id}']")
->click();
$this
->awaitAjax();
// If the layout is configurable (as it may be in Drupal 8.8 and later), we
// need to click another button.
$layout_class = \Drupal::service('plugin.manager.core.layout')
->getDefinition($layout_id)
->getClass();
if (is_a($layout_class, PluginFormInterface::class, TRUE)) {
$page
->pressButton('Change Layout');
$this
->awaitAjax();
}
}