public function AttributeTest::providerTestAttributeClassHelpers in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/tests/Drupal/Tests/Core/Template/AttributeTest.php \Drupal\Tests\Core\Template\AttributeTest::providerTestAttributeClassHelpers()
Provides tests data for testEscaping
Return value
array An array of test data each containing of a twig template string, a resulting string of classes and an optional array of attributes.
File
- core/
tests/ Drupal/ Tests/ Core/ Template/ AttributeTest.php, line 285 - Contains \Drupal\Tests\Core\Template\AttributeTest.
Class
- AttributeTest
- @coversDefaultClass \Drupal\Core\Template\Attribute @group Template
Namespace
Drupal\Tests\Core\TemplateCode
public function providerTestAttributeClassHelpers() {
return array(
array(
"{{ attributes.class }}",
'',
),
array(
"{{ attributes.addClass('everest').class }}",
'everest',
),
array(
"{{ attributes.addClass(['k2', 'kangchenjunga']).class }}",
'k2 kangchenjunga',
),
array(
"{{ attributes.addClass('lhotse', 'makalu', 'cho-oyu').class }}",
'lhotse makalu cho-oyu',
),
array(
"{{ attributes.addClass('nanga-parbat').class }}",
'dhaulagiri manaslu nanga-parbat',
array(
'class' => array(
'dhaulagiri',
'manaslu',
),
),
),
array(
"{{ attributes.removeClass('annapurna').class }}",
'gasherbrum-i',
array(
'class' => array(
'annapurna',
'gasherbrum-i',
),
),
),
array(
"{{ attributes.removeClass(['broad peak']).class }}",
'gasherbrum-ii',
array(
'class' => array(
'broad peak',
'gasherbrum-ii',
),
),
),
array(
"{{ attributes.removeClass('gyachung-kang', 'shishapangma').class }}",
'',
array(
'class' => array(
'shishapangma',
'gyachung-kang',
),
),
),
array(
"{{ attributes.removeClass('nuptse').addClass('annapurna-ii').class }}",
'himalchuli annapurna-ii',
array(
'class' => array(
'himalchuli',
'nuptse',
),
),
),
// Test for the removal of an empty class name.
array(
"{{ attributes.addClass('rakaposhi', '').class }}",
'rakaposhi',
),
);
}