function HtmxAttributesTest::hxSimpleStringAttributesDataProvider

Provides data to ::testHxSimpleStringAttributes.

Return value

array{string, ?string, string, string|bool}[] Array of method, value, attribute, expected.

File

core/tests/Drupal/Tests/Core/Htmx/HtmxAttributesTest.php, line 358

Class

HtmxAttributesTest
Test all attribute-related Htmx public methods.

Namespace

Drupal\Tests\Core\Htmx

Code

public static function hxSimpleStringAttributesDataProvider() : array {
  return [
    [
      'select',
      '#info-details',
      'data-hx-select',
      '#info-details',
    ],
    [
      'select',
      'info[data-drupal-selector="edit-select"]',
      'data-hx-select',
      'info[data-drupal-selector="edit-select"]',
    ],
    [
      'selectOob',
      '#info-details',
      'data-hx-select-oob',
      '#info-details',
    ],
    [
      'selectOob',
      [
        '#info-details:afterbegin',
        '#alert',
      ],
      'data-hx-select-oob',
      '#info-details:afterbegin,#alert',
    ],
    [
      'target',
      'descriptor',
      'data-hx-target',
      'descriptor',
    ],
    [
      'trigger',
      'event',
      'data-hx-trigger',
      'event',
    ],
    [
      'trigger',
      [
        'load',
        'click delay:1s',
      ],
      'data-hx-trigger',
      'load,click delay:1s',
    ],
    [
      'confirm',
      'A confirmation message',
      'data-hx-confirm',
      'A confirmation message',
    ],
    [
      'disable',
      NULL,
      'data-hx-disable',
      TRUE,
    ],
    [
      'disabledElt',
      'descriptor',
      'data-hx-disabled-elt',
      'descriptor',
    ],
    [
      'disinherit',
      'descriptor',
      'data-hx-disinherit',
      'descriptor',
    ],
    [
      'encoding',
      NULL,
      'data-hx-encoding',
      'multipart/form-data',
    ],
    [
      'encoding',
      'application/x-www-form-urlencoded',
      'data-hx-encoding',
      'application/x-www-form-urlencoded',
    ],
    [
      'ext',
      'name, name',
      'data-hx-ext',
      'name, name',
    ],
    [
      'historyElt',
      NULL,
      'data-hx-history-elt',
      TRUE,
    ],
    [
      'include',
      'descriptor',
      'data-hx-include',
      'descriptor',
    ],
    [
      'indicator',
      'descriptor',
      'data-hx-indicator',
      'descriptor',
    ],
    [
      'inherit',
      'descriptor',
      'data-hx-inherit',
      'descriptor',
    ],
    [
      'params',
      '*',
      'data-hx-params',
      '*',
    ],
    [
      'params',
      [
        'not param1',
        'param2',
        'param3',
      ],
      'data-hx-params',
      'not param1,param2,param3',
    ],
    [
      'params',
      [
        'param1',
        'param2',
        'param3',
      ],
      'data-hx-params',
      'param1,param2,param3',
    ],
    [
      'preserve',
      NULL,
      'data-hx-preserve',
      TRUE,
    ],
    [
      'history',
      NULL,
      'data-hx-history',
      'false',
    ],
    [
      'prompt',
      'A prompt message',
      'data-hx-prompt',
      'A prompt message',
    ],
    [
      'sync',
      'closest form:abort',
      'data-hx-sync',
      'closest form:abort',
    ],
  ];
}

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