public function AttributeTest::providerTestAttributeClassHelpers in Drupal 8
Same name and namespace in other branches
- 9 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 281
Class
- AttributeTest
- @coversDefaultClass \Drupal\Core\Template\Attribute @group Template
Namespace
Drupal\Tests\Core\TemplateCode
public function providerTestAttributeClassHelpers() {
return [
[
"{{ attributes.class }}",
'',
],
[
"{{ attributes.addClass('everest').class }}",
'everest',
],
[
"{{ attributes.addClass(['k2', 'kangchenjunga']).class }}",
'k2 kangchenjunga',
],
[
"{{ attributes.addClass('lhotse', 'makalu', 'cho-oyu').class }}",
'lhotse makalu cho-oyu',
],
[
"{{ attributes.addClass('nanga-parbat').class }}",
'dhaulagiri manaslu nanga-parbat',
[
'class' => [
'dhaulagiri',
'manaslu',
],
],
],
[
"{{ attributes.removeClass('annapurna').class }}",
'gasherbrum-i',
[
'class' => [
'annapurna',
'gasherbrum-i',
],
],
],
[
"{{ attributes.removeClass(['broad peak']).class }}",
'gasherbrum-ii',
[
'class' => [
'broad peak',
'gasherbrum-ii',
],
],
],
[
"{{ attributes.removeClass('gyachung-kang', 'shishapangma').class }}",
'',
[
'class' => [
'shishapangma',
'gyachung-kang',
],
],
],
[
"{{ attributes.removeClass('nuptse').addClass('annapurna-ii').class }}",
'himalchuli annapurna-ii',
[
'class' => [
'himalchuli',
'nuptse',
],
],
],
// Test for the removal of an empty class name.
[
"{{ attributes.addClass('rakaposhi', '').class }}",
'rakaposhi',
],
];
}