// 1. Check that if it exists Attribute object in the 'attributes' prop, you
// get them merged.
$build =
[ '#type' => 'inline_template',
'#context' =>
[ 'content' =>
$content,
'attributes' =>
new Attribute(['data-merged-attributes' => 'yes'
]),
],
'#template' => "{{ include('sdc_test:my-button', { text: content.label, iconType: 'external', attributes: attributes }, with_context = false) }}",
];
$crawler =
$this->
renderComponentRenderArray($build);
$this->
assertNotEmpty($crawler->
filter('#sdc-wrapper [data-merged-attributes="yes"][data-component-id="sdc_test:my-button"]'
),
$crawler->
outerHtml());
// 2. Check that if the 'attributes' exists, but there is some other data
// type, then we don't touch it.
$build =
[ '#type' => 'inline_template',
'#context' =>
[ 'content' =>
$content,
'attributes' => 'hard-coded-attr',
],
'#template' => "{{ include('sdc_theme_test_base:my-card-no-schema', { header: content.label, attributes: attributes }, with_context = false) }}",
];
$crawler =
$this->
renderComponentRenderArray($build);