protected function PanelsIPETestTrait::changeLayout in Panels 8.4
Same name and namespace in other branches
- 8.3 panels_ipe/tests/src/FunctionalJavascript/PanelsIPETestTrait.php \Drupal\Tests\panels_ipe\FunctionalJavascript\PanelsIPETestTrait::changeLayout()
Changes the IPE layout.
This function assumes you're using Panels layouts and as a result expects the PanelsIPELayoutForm to auto-submit.
Parameters
string $category: The name of the category, i.e. "One Column".
string $layout_id: The ID of the layout, i.e. "layout_onecol".
2 calls to PanelsIPETestTrait::changeLayout()
- PageManagerIntegrationTest::testUserEditSession in panels_ipe/
tests/ src/ FunctionalJavascript/ PageManagerIntegrationTest.php - Tests that the IPE editing session is specific to a user.
- PanelsIPETestBase::testIPEChangeLayout in panels_ipe/
tests/ src/ FunctionalJavascript/ PanelsIPETestBase.php - Tests that changing layout from one (default) to two columns works.
File
- panels_ipe/
tests/ src/ FunctionalJavascript/ PanelsIPETestTrait.php, line 96
Class
- PanelsIPETestTrait
- Trait which can be used to test Panels IPE components.
Namespace
Drupal\Tests\panels_ipe\FunctionalJavascriptCode
protected function changeLayout($category, $layout_id) {
// Open the "Change Layout" tab.
$this
->clickAndWait('[data-tab-id="change_layout"]');
// Wait for layouts to be pulled into our collection.
$this
->waitUntilNotPresent('.ipe-icon-loading');
// Select the target category.
$this
->clickAndWait('[data-category="' . $category . '"]');
// Select the target layout.
$this
->clickAndWait('[data-layout-id="' . $layout_id . '"]');
// Wait for the form to load/submit.
$this
->waitUntilNotPresent('.ipe-icon-loading');
// In Drupal 8.8 and later, the layout may have settings of its own. If this
// is the case, submit the layout settings form with no changes.
$button = $this
->getSession()
->getPage()
->findButton('Change Layout');
if ($button) {
$button
->press();
}
// Wait for the edit tab to become active (happens automatically after
// form submit).
$this
->waitUntilVisible('[data-tab-id="edit"].active');
}