Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit 7bb597fc authored by escuriola's avatar escuriola
Browse files

OEL-1147: Missing template on theme hook. Fixing and add test to neutral footer.

parent 9ac5618a
No related branches found
No related tags found
1 merge request!81OEL-1147 - Footer
......@@ -26,5 +26,15 @@ function oe_whitelabel_helper_theme($existing, $type, $theme, $path) {
'address_delimiter' => NULL,
],
],
'oe_corporate_blocks_neutral_footer' => [
'variables' => [
'corporate_footer' => [],
'site_specific_footer' => [],
],
'preprocess functions' => [
'oe_corporate_blocks_preprocess_set_site_owner',
],
],
];
}
......@@ -10,7 +10,7 @@ use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\oe_corporate_blocks\Plugin\Block\FooterBlockBase;
/**
* Provides the corporate EU footer block.
* Provides the Neutral footer block.
*
* @Block(
* id = "oe_corporate_blocks_neutral_footer",
......
......@@ -17,16 +17,12 @@ class FooterBlockTest extends SparqlKernelTestBase {
*/
protected static $modules = [
'block',
'multivalue_form_element',
'oe_bootstrap_theme_helper',
'oe_corporate_blocks',
'oe_corporate_site_info',
'oe_whitelabel_helper',
'rdf_skos',
'system',
'ui_patterns',
'ui_patterns_library',
'ui_patterns_settings',
'user',
];
......@@ -63,6 +59,7 @@ class FooterBlockTest extends SparqlKernelTestBase {
$crawler = new Crawler($render->__toString());
// For now we assert only minimal till we have a footer component.
$this->assertCount(1, $crawler->filter('footer.bcl-footer--ec'));
$rows = $crawler->filter('.row');
$this->assertCount(2, $rows);
$borderedSections = $crawler->filter('.bcl-footer__bordered-row');
......@@ -98,6 +95,7 @@ class FooterBlockTest extends SparqlKernelTestBase {
$crawler = new Crawler($render->__toString());
// For now we assert only minimal till we have a footer component.
$this->assertCount(1, $crawler->filter('footer.bcl-footer--eu'));
$rows = $crawler->filter('.row');
$this->assertCount(2, $rows);
$borderedSections = $crawler->filter('.bcl-footer__bordered-row');
......@@ -108,4 +106,36 @@ class FooterBlockTest extends SparqlKernelTestBase {
$this->assertCount(10, $sectionLinks);
}
/**
* Tests the rendering of blocks.
*/
public function testNeutralFooterBlockRendering(): void {
$entity_type_manager = $this->container
->get('entity_type.manager')
->getStorage('block');
$entity = $entity_type_manager->create([
'id' => 'neutralfooterblock',
'theme' => 'oe_whitelabel',
'plugin' => 'oe_corporate_blocks_neutral_footer',
'settings' => [
'id' => 'oe_corporate_blocks_neutral_footer',
'label' => 'Neutral Footer block',
'provider' => 'oe_corporate_blocks',
'label_display' => '0',
],
]);
$entity->save();
$builder = \Drupal::entityTypeManager()->getViewBuilder('block');
$build = $builder->view($entity, 'block');
$render = $this->container->get('renderer')->renderRoot($build);
$crawler = new Crawler($render->__toString());
// For now we assert only minimal till we have a footer component.
$this->assertCount(1, $crawler->filter('footer.bcl-footer--neutral'));
$rows = $crawler->filter('.row');
$this->assertCount(1, $rows);
$sectionTitles = $crawler->filter('p.fw-bold.mb-2');
$this->assertCount(1, $sectionTitles);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment