You are here

public function UiPatternsLayoutsSettingsTest::testUiPatternsLayoutsSettings in UI Patterns 8

Tests field template settings.

File

modules/ui_patterns_layouts/tests/src/FunctionalJavascript/UiPatternsLayoutsSettingsTest.php, line 49

Class

UiPatternsLayoutsSettingsTest
Test Layouts template settings UI.

Namespace

Drupal\Tests\ui_patterns_layout\FunctionalJavascript

Code

public function testUiPatternsLayoutsSettings() {
  $page = $this
    ->getSession()
    ->getPage();
  $user = $this
    ->drupalCreateUser([], NULL, TRUE);
  $this
    ->drupalLogin($user);

  // Visit Article's default display settings page.
  $this
    ->drupalGet('/admin/structure/types/manage/article/display');

  // Click on Pattern settings.
  $page
    ->pressButton('Layout settings');
  $page
    ->pressButton('Pattern settings');

  // Select "Highlighted" field template.
  $page
    ->selectFieldOption('Variant', 'Highlighted');
  $page
    ->pressButton('Save');

  // Get default view mode for Article node bundle.
  $display = EntityViewDisplay::load("node.article.default");

  // Assert existence of third party settings.
  $third_party_settings = $display
    ->getThirdPartySettings('field_layout');

  // Assert settings value.
  $this
    ->assertEquals($third_party_settings['settings']['pattern']['variant'], 'highlighted');
}