diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockSystemBrandingTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockSystemBrandingTest.php index 9c34670..4d8ca07 100644 --- a/core/modules/block/lib/Drupal/block/Tests/BlockSystemBrandingTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/BlockSystemBrandingTest.php @@ -8,7 +8,7 @@ namespace Drupal\block\Tests; /** - * Provides testing for the branding block module functionality. + * Provides testing for the branding block functionality. */ class BlockSystemBrandingTest extends BlockTestBase { @@ -41,62 +41,71 @@ function setUp() { * Tests system branding block configuration. */ function testSystemBrandingSettings() { - // Set default block settings and test that all branding elements are displayed. + $site_logo_xpath = '//div[@id="block-site-branding"]//a[@class="site-logo"]'; + $site_name_xpath = '//div[@id="block-site-branding"]//strong[@class="site-name"]'; + $site_slogan_xpath = '//div[@id="block-site-branding"]//div[@class="site-slogan"]'; + + // Set default block settings. $this->drupalGet(''); - $site_logo_element = $this->xpath('//div[@id="block-site-branding"]//a[@class="site-logo"]'); - $site_name_element = $this->xpath('//div[@id="block-site-branding"]//strong[@class="site-name"]'); - $site_slogan_element = $this->xpath('//div[@id="block-site-branding"]//div[@class="site-slogan"]'); + $site_logo_element = $this->xpath($site_logo_xpath); + $site_name_element = $this->xpath($site_name_xpath); + $site_slogan_element = $this->xpath($site_slogan_xpath); + // Test that all branding elements are displayed. $this->assertTrue(!empty($site_logo_element), 'The branding block logo was found.'); $this->assertTrue(!empty($site_name_element), 'The branding block site name was found.'); $this->assertTrue(!empty($site_slogan_element), 'The branding block slogan was found.'); - // Turn just the logo off, and re-test all branding elements. + // Turn just the logo off. \Drupal::config('block.block.site-branding') ->set('settings.use_site_logo', 0) ->save(); $this->drupalGet(''); - $site_logo_element = $this->xpath('//div[@id="block-site-branding"]//a[@class="site-logo"]'); - $site_name_element = $this->xpath('//div[@id="block-site-branding"]//strong[@class="site-name"]'); - $site_slogan_element = $this->xpath('//div[@id="block-site-branding"]//div[@class="site-slogan"]'); + $site_logo_element = $this->xpath($site_logo_xpath); + $site_name_element = $this->xpath($site_name_xpath); + $site_slogan_element = $this->xpath($site_slogan_xpath); + // Re-test all branding elements. $this->assertTrue(empty($site_logo_element), 'The branding block logo was disabled.'); $this->assertTrue(!empty($site_name_element), 'The branding block site name was found.'); $this->assertTrue(!empty($site_slogan_element), 'The branding block slogan was found.'); - // Turn just the site name off, and re-test all branding elements. + // Turn just the site name off. \Drupal::config('block.block.site-branding') ->set('settings.use_site_logo', 1) ->set('settings.use_site_name', 0) ->save(); $this->drupalGet(''); - $site_logo_element = $this->xpath('//div[@id="block-site-branding"]//a[@class="site-logo"]'); - $site_name_element = $this->xpath('//div[@id="block-site-branding"]//strong[@class="site-name"]'); - $site_slogan_element = $this->xpath('//div[@id="block-site-branding"]//div[@class="site-slogan"]'); + $site_logo_element = $this->xpath($site_logo_xpath); + $site_name_element = $this->xpath($site_name_xpath); + $site_slogan_element = $this->xpath($site_slogan_xpath); + // Re-test all branding elements. $this->assertTrue(!empty($site_logo_element), 'The branding block logo was found.'); $this->assertTrue(empty($site_name_element), 'The branding block site name was disabled.'); $this->assertTrue(!empty($site_slogan_element), 'The branding block slogan was found.'); - // Turn just the site slogan off, and re-test all branding elements. + // Turn just the site slogan off. \Drupal::config('block.block.site-branding') ->set('settings.use_site_name', 1) ->set('settings.use_site_slogan', 0) ->save(); $this->drupalGet(''); - $site_logo_element = $this->xpath('//div[@id="block-site-branding"]//a[@class="site-logo"]'); - $site_name_element = $this->xpath('//div[@id="block-site-branding"]//strong[@class="site-name"]'); - $site_slogan_element = $this->xpath('//div[@id="block-site-branding"]//div[@class="site-slogan"]'); + $site_logo_element = $this->xpath($site_logo_xpath); + $site_name_element = $this->xpath($site_name_xpath); + $site_slogan_element = $this->xpath($site_slogan_xpath); + // Re-test all branding elements. $this->assertTrue(!empty($site_logo_element), 'The branding block logo was found.'); $this->assertTrue(!empty($site_name_element), 'The branding block site name was found.'); $this->assertTrue(empty($site_slogan_element), 'The branding block slogan was disabled.'); - // Turn the site name and the site slogan off, and re-test all branding elements. + // Turn the site name and the site slogan off. \Drupal::config('block.block.site-branding') ->set('settings.use_site_name', 0) ->set('settings.use_site_slogan', 0) ->save(); $this->drupalGet(''); - $site_logo_element = $this->xpath('//div[@id="block-site-branding"]//a[@class="site-logo"]'); - $site_name_element = $this->xpath('//div[@id="block-site-branding"]//strong[@class="site-name"]'); - $site_slogan_element = $this->xpath('//div[@id="block-site-branding"]//div[@class="site-slogan"]'); + $site_logo_element = $this->xpath($site_logo_xpath); + $site_name_element = $this->xpath($site_name_xpath); + $site_slogan_element = $this->xpath($site_slogan_xpath); + // Re-test all branding elements. $this->assertTrue(!empty($site_logo_element), 'The branding block logo was found.'); $this->assertTrue(empty($site_name_element), 'The branding block site name was disabled.'); $this->assertTrue(empty($site_slogan_element), 'The branding block slogan was disabled.'); diff --git a/core/modules/system/templates/branding.html.twig b/core/modules/system/templates/branding.html.twig index 652ce6c..4b760be 100644 --- a/core/modules/system/templates/branding.html.twig +++ b/core/modules/system/templates/branding.html.twig @@ -24,11 +24,11 @@
{% if use_site_name %} - {{ site_name|e|t }} + {{ site_name|e }} {% endif %} {% if use_site_slogan and site_slogan %} -
{{ site_slogan|t }}
+
{{ site_slogan }}
{% endif %}
{% endif %}