You are here

public function ConfigurationUiTest::providerTestValidations in Entity Embed 8

Data provider for testValidationWhenAdding() and testValidationWhenEditing().

File

tests/src/FunctionalJavascript/ConfigurationUiTest.php, line 231

Class

ConfigurationUiTest
Tests text format & text editor configuration UI validation.

Namespace

Drupal\Tests\entity_embed\FunctionalJavascript

Code

public function providerTestValidations() {
  return [
    'Tests that no filter_html occurs when filter_html not enabled.' => [
      'filters[filter_html][status]' => FALSE,
      'filters[entity_embed][status]' => TRUE,
      'allowed_html' => FALSE,
      'expected_error_message' => FALSE,
    ],
    'Tests validation when both filter_html and entity_embed are disabled.' => [
      'filters[filter_html][status]' => FALSE,
      'filters[entity_embed][status]' => FALSE,
      'allowed_html' => FALSE,
      'expected_error_message' => FALSE,
    ],
    'Tests validation when entity_embed filter not enabled and filter_html is enabled.' => [
      'filters[filter_html][status]' => TRUE,
      'filters[entity_embed][status]' => FALSE,
      'allowed_html' => 'default',
      'expected_error_message' => FALSE,
    ],
    'Tests validation when drupal-entity element has no attributes.' => [
      'filters[filter_html][status]' => TRUE,
      'filters[entity_embed][status]' => TRUE,
      'allowed_html' => "<a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type='1 A I'> <li> <dl> <dt> <dd> <h2 id='jump-*'> <h3 id> <h4 id> <h5 id> <h6 id> <drupal-entity>",
      'expected_error_message' => 'The <drupal-entity> tag in the allowed HTML tags is missing the following attributes: data-entity-type, data-entity-uuid, data-entity-embed-display, data-entity-embed-display-settings, data-align, data-caption, data-embed-button, alt, title.',
    ],
    'Tests validation when drupal-entity element lacks some required attributes.' => [
      'filters[filter_html][status]' => TRUE,
      'filters[entity_embed][status]' => TRUE,
      'allowed_html' => "<a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type='1 A I'> <li> <dl> <dt> <dd> <h2 id='jump-*'> <h3 id> <h4 id> <h5 id> <h6 id> <drupal-entity data-entity-type data-entity-uuid data-entity-embed-display data-entity-embed-display-settings data-align data-embed-button data-langcode>",
      'expected_error_message' => 'The <drupal-entity> tag in the allowed HTML tags is missing the following attributes: data-caption, alt, title.',
    ],
    'Tests that wildcard for required attributes works' => [
      'filters[filter_html][status]' => TRUE,
      'filters[entity_embed][status]' => TRUE,
      'allowed_html' => "<a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type='1 A I'> <li> <dl> <dt> <dd> <h2 id='jump-*'> <h3 id> <h4 id> <h5 id> <h6 id> <drupal-entity data-* alt title>",
      'expected_error_message' => FALSE,
    ],
  ];
}