You are here

public function WidgetTest::testConfigurationFormOptions in Block field 8

Test configuration form options.

File

tests/src/Functional/WidgetTest.php, line 115

Class

WidgetTest
Test the block field widget.

Namespace

Drupal\Tests\block_field\Functional

Code

public function testConfigurationFormOptions() {
  $assert = $this
    ->assertSession();

  // Configuration form: full (the default).
  $this
    ->drupalGet($this->blockNode
    ->toUrl('edit-form'));
  $assert
    ->fieldExists('field_block[0][settings][label_display]');
  $assert
    ->fieldExists('field_block[0][settings][override][items_per_page]');
  $assert
    ->fieldExists('field_block[0][settings][views_label_checkbox]');
  $assert
    ->fieldExists('field_block[0][settings][views_label]');

  // Configuration form: hidden.
  $this
    ->drupalGet('admin/structure/types/manage/block_node/form-display');
  $this
    ->submitForm([], 'field_block_settings_edit');
  $edit = [
    'fields[field_block][settings_edit_form][settings][configuration_form]' => 'hidden',
  ];
  $this
    ->submitForm($edit, 'Save');
  $this
    ->drupalGet($this->blockNode
    ->toUrl('edit-form'));
  $assert
    ->fieldNotExists('field_block[0][settings][label_display]');
  $assert
    ->fieldNotExists('field_block[0][settings][override][items_per_page]');
  $assert
    ->fieldNotExists('field_block[0][settings][views_label_checkbox]');
  $assert
    ->fieldNotExists('field_block[0][settings][views_label]');
}