Commit 7736ba08 authored by alexpott's avatar alexpott

Issue #2411597 by idebr, davidhernandez, Gábor Hojtsy: Class 'path-frontpage' missing from <body>

parent 8e0bcfef
......@@ -1347,7 +1347,7 @@ function template_preprocess_html(&$variables) {
$is_front_page = \Drupal::service('path.matcher')->isFrontPage();
if ($is_front_page) {
$variables['root_path'] = TRUE;
$variables['root_path'] = FALSE;
}
else {
$system_path = \Drupal::request()->attributes->get('_system_path');
......
......@@ -256,15 +256,31 @@ function testLanguageBodyClass() {
$edit = array('language_interface[enabled][language-url]' => '1');
$this->drupalPostForm('admin/config/regional/language/detection', $edit, t('Save settings'));
// Go to admin/config, check the class on default language.
// Check if the default (English) admin/config page has the right class.
$this->drupalGet('admin/config');
$class = $this->xpath('//body[contains(@class, :class)]', array(':class' => $searched_class));
$this->assertTrue(isset($class[0]), t('The path-admin class appears on default language.'));
// Go to admin/config, check the class on french language.
// Check if the French admin/config page has the right class.
$this->drupalGet('fr/admin/config');
$class = $this->xpath('//body[contains(@class, :class)]', array(':class' => $searched_class));
$this->assertTrue(isset($class[0]), t('The path-admin class same as on default language.'));
// The testing profile sets the user/login page as the frontpage. That
// redirects authenticated users to their profile page, so check with an
// anonymous user instead.
$this->drupalLogout();
// Check if the default (English) frontpage has the right class.
$this->drupalGet('<front>');
$class = $this->xpath('//body[contains(@class, :class)]', array(':class' => 'path-frontpage'));
$this->assertTrue(isset($class[0]), 'path-frontpage class found on the body tag');
// Check if the French frontpage has the right class.
$this->drupalGet('fr');
$class = $this->xpath('//body[contains(@class, :class)]', array(':class' => 'path-frontpage'));
$this->assertTrue(isset($class[0]), 'path-frontpage class found on the body tag with french as the active language');
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment