function SettingsTrayTestBase::assertOffCanvasBlockFormIsValid

Same name in other branches
  1. 9 core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayTestBase.php \Drupal\Tests\settings_tray\FunctionalJavascript\SettingsTrayTestBase::assertOffCanvasBlockFormIsValid()
  2. 10 core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayTestBase.php \Drupal\Tests\settings_tray\FunctionalJavascript\SettingsTrayTestBase::assertOffCanvasBlockFormIsValid()
  3. 11.x core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayTestBase.php \Drupal\Tests\settings_tray\FunctionalJavascript\SettingsTrayTestBase::assertOffCanvasBlockFormIsValid()

Asserts that Off-Canvas block form is valid.

1 call to SettingsTrayTestBase::assertOffCanvasBlockFormIsValid()
SettingsTrayTestBase::openBlockForm in core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayTestBase.php
Open block form by clicking the element found with a css selector.

File

core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayTestBase.php, line 134

Class

SettingsTrayTestBase
Base class for Settings Tray tests.

Namespace

Drupal\Tests\settings_tray\FunctionalJavascript

Code

protected function assertOffCanvasBlockFormIsValid() {
    $web_assert = $this->assertSession();
    // Confirm that Block title display label has been changed.
    $web_assert->elementTextContains('css', '.form-item-settings-label-display label', 'Display block title');
    // Confirm Block title label is shown if checkbox is checked.
    if ($this->getSession()
        ->getPage()
        ->find('css', 'input[name="settings[label_display]"]')
        ->isChecked()) {
        $this->assertEquals($this->isLabelInputVisible(), TRUE, 'Label is visible');
        $web_assert->elementTextContains('css', '.form-item-settings-label label', 'Block title');
    }
    else {
        $this->assertEquals($this->isLabelInputVisible(), FALSE, 'Label is not visible');
    }
    // Check that common block form elements exist.
    $web_assert->elementExists('css', static::LABEL_INPUT_SELECTOR);
    $web_assert->elementExists('css', 'input[data-drupal-selector="edit-settings-label-display"]');
    // Check that advanced block form elements do not exist.
    $web_assert->elementNotExists('css', 'input[data-drupal-selector="edit-visibility-request-path-pages"]');
    $web_assert->elementNotExists('css', 'select[data-drupal-selector="edit-region"]');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.