public function FieldOutputTest::fieldTestCases in Fences 8.2
Test cases for the field output test.
File
- tests/
src/ Kernel/ FieldOutputTest.php, line 69
Class
- FieldOutputTest
- Test the field output under different configurations.
Namespace
Drupal\Tests\fences\KernelCode
public function fieldTestCases() {
return [
'No field markup' => [
[
'fences_field_tag' => 'none',
'fences_field_classes' => '',
'fences_field_item_tag' => 'none',
'fences_field_item_classes' => '',
'fences_label_tag' => 'none',
'fences_label_classes' => '',
],
TRUE,
'lorem ipsum',
],
'Only a field tag' => [
[
'fences_field_tag' => 'article',
'fences_field_classes' => '',
'fences_field_item_tag' => 'none',
'fences_field_item_classes' => '',
'fences_label_tag' => 'none',
'fences_label_classes' => '',
],
TRUE,
'<article class="field field--name-field-test field--type-text field--label-above field__items">lorem ipsum</article>',
],
'Only a field and label tag' => [
[
'fences_field_tag' => 'article',
'fences_field_classes' => '',
'fences_field_item_tag' => 'none',
'fences_field_item_classes' => '',
'fences_label_tag' => 'h3',
'fences_label_classes' => '',
],
TRUE,
'<article class="field field--name-field-test field--type-text field--label-above field__items"><h3 class="field__label">field_test</h3>lorem ipsum</article>',
],
'Only a field and field item tag' => [
[
'fences_field_tag' => 'article',
'fences_field_classes' => '',
'fences_field_item_tag' => 'h2',
'fences_field_item_classes' => '',
'fences_label_tag' => '',
'fences_label_classes' => '',
],
TRUE,
'<article class="field field--name-field-test field--type-text field--label-above field__items"><div class="field__label">field_test</div><h2 class="field__item">lorem ipsum</h2></article>',
],
'Default field, no label' => [
[
'fences_field_tag' => '',
'fences_field_classes' => '',
'fences_field_item_tag' => '',
'fences_field_item_classes' => '',
'fences_label_tag' => '',
'fences_label_classes' => '',
],
FALSE,
'<div class="field field--name-field-test field--type-text field--label-hidden field__items"><div class="field__item">lorem ipsum</div></div>',
],
'Default field, with label' => [
[
'fences_field_tag' => '',
'fences_field_classes' => '',
'fences_field_item_tag' => '',
'fences_field_item_classes' => '',
'fences_label_tag' => '',
'fences_label_classes' => '',
],
TRUE,
'<div class="field field--name-field-test field--type-text field--label-above field__items"><div class="field__label">field_test</div><div class="field__item">lorem ipsum</div></div>',
],
'Classes and tags' => [
[
'fences_field_tag' => 'ul',
'fences_field_classes' => 'item-list',
'fences_field_item_tag' => 'li',
'fences_field_item_classes' => 'item-list__item',
'fences_label_tag' => 'li',
'fences_label_classes' => 'item-list__label',
],
TRUE,
'<ul class="item-list field field--name-field-test field--type-text field--label-above field__items"><li class="item-list__label field__label">field_test</li><li class="item-list__item field__item">lorem ipsum</li></ul>',
],
];
}