You are here

public function TwigColorTest::providerTestCssRgbToHexValues in Twig Tools 8

Provides test data for testCssRgbToHex.

Return value

array An array of test data with twig values and their hex hash equivalents.

File

tests/src/Unit/TwigColorTest.php, line 82

Class

TwigColorTest
Tests to ensure color convert filters work correctly.

Namespace

Drupal\Tests\twig_tools\Unit

Code

public function providerTestCssRgbToHexValues() {
  return [
    [
      "{{ 'rgb(255, 255, 255)'|css_rgb_to_hex }}",
      '#ffffff',
    ],
    [
      "{{ 'rgb(255,255,255)'|css_rgb_to_hex }}",
      '#ffffff',
    ],
    [
      "{{ 'style=\"rgb(255, 255, 255)\"'|css_rgb_to_hex }}",
      '#ffffff',
    ],
    [
      "{{ 'rgb(160, 198, 119)'|css_rgb_to_hex }}",
      '#a0c677',
    ],
    [
      "{{ 'rgb(142, 47, 47)'|css_rgb_to_hex }}",
      '#8e2f2f',
    ],
    [
      "{{ 'rgb(-142, -47, -47)'|css_rgb_to_hex }}",
      '',
    ],
    [
      "{{ 'rgb(0, 0, 0)'|css_rgb_to_hex }}",
      '#000000',
    ],
    [
      "{{ 'rgb(9, 10, 11)'|css_rgb_to_hex }}",
      '#090a0b',
    ],
    [
      "{{ 'rgb(99, 100, 101)'|css_rgb_to_hex }}",
      '#636465',
    ],
    [
      "{{ 'rgb(199, 200, 201)'|css_rgb_to_hex }}",
      '#c7c8c9',
    ],
    [
      "{{ 'rgb(256, 256, 256)'|css_rgb_to_hex }}",
      '',
    ],
    [
      "{{ 'rgb(1000,1000,1000)'|css_rgb_to_hex }}",
      '',
    ],
    [
      "{{ 'rgb(0, 0, 0, 0)'|css_rgb_to_hex }}",
      '',
    ],
  ];
}