You are here

protected function PanelsIPETestTrait::changeLayout in Panels 8.3

Same name and namespace in other branches
  1. 8.4 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. "onecol".

1 call to PanelsIPETestTrait::changeLayout()
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 76

Class

PanelsIPETestTrait
Trait which can be used to test Panels IPE components.

Namespace

Drupal\Tests\panels_ipe\FunctionalJavascript

Code

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');

  // Wait for the edit tab to become active (happens automatically after
  // form submit).
  $this
    ->waitUntilVisible('[data-tab-id="edit"].active');
}