protected function PanelizerIntegrationTest::changeLayout in Panelizer 8.5
Same name and namespace in other branches
- 8.4 tests/src/FunctionalJavascript/PanelizerIntegrationTest.php \Drupal\Tests\panelizer\FunctionalJavascript\PanelizerIntegrationTest::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 PanelizerIntegrationTest::changeLayout()
- PanelizerIntegrationTest::testIPEChangeLayout in tests/
src/ FunctionalJavascript/ PanelizerIntegrationTest.php - Tests that changing layout from one (default) to two columns works.
- PanelizerIntegrationTest::testUserEditSession in tests/
src/ FunctionalJavascript/ PanelizerIntegrationTest.php - Tests that the IPE editing session is specific to a user.
File
- tests/
src/ FunctionalJavascript/ PanelizerIntegrationTest.php, line 128
Class
- PanelizerIntegrationTest
- Tests the JavaScript functionality of Panels IPE with Panelizer.
Namespace
Drupal\Tests\panelizer\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');
// Layouts can carry administrative labels, so enter one if needed.
$page = $this
->getSession()
->getPage();
$label_field = $page
->findField('Administrative label');
if ($label_field) {
$label_field
->setValue($this
->randomString());
$page
->pressButton('Change Layout');
}
// Wait for the edit tab to become active (happens automatically after
// form submit).
$this
->waitUntilVisible('[data-tab-id="edit"].active');
}