function AjaxCommandsTest::providerCss

Same name in other branches
  1. 11.x core/tests/Drupal/Tests/Core/Ajax/AjaxCommandsTest.php \Drupal\Tests\Core\Ajax\AjaxCommandsTest::providerCss()

Return value

array

  • Array of css elements
  • Expected value

File

core/tests/Drupal/Tests/Core/Ajax/AjaxCommandsTest.php, line 46

Class

AjaxCommandsTest
Test coverage for various classes in the \Drupal\Core\Ajax namespace.

Namespace

Drupal\Tests\Core\Ajax

Code

public static function providerCss() {
    return [
        'empty' => [
            [],
            [
                'command' => 'add_css',
                'data' => [],
            ],
        ],
        'single' => [
            [
                [
                    'href' => 'core/misc/example.css',
                    'media' => 'all',
                ],
            ],
            [
                'command' => 'add_css',
                'data' => [
                    [
                        'href' => 'core/misc/example.css',
                        'media' => 'all',
                    ],
                ],
            ],
        ],
        'single-data-property' => [
            [
                [
                    'href' => 'core/misc/example.css',
                    'media' => 'all',
                    'data-test' => 'test',
                ],
            ],
            [
                'command' => 'add_css',
                'data' => [
                    [
                        'href' => 'core/misc/example.css',
                        'media' => 'all',
                        'data-test' => 'test',
                    ],
                ],
            ],
        ],
        'multiple' => [
            [
                [
                    'href' => 'core/misc/example1.css',
                    'media' => 'all',
                ],
                [
                    'href' => 'core/misc/example2.css',
                    'media' => 'all',
                ],
            ],
            [
                'command' => 'add_css',
                'data' => [
                    [
                        'href' => 'core/misc/example1.css',
                        'media' => 'all',
                    ],
                    [
                        'href' => 'core/misc/example2.css',
                        'media' => 'all',
                    ],
                ],
            ],
        ],
    ];
}

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