From 8612e4dd951c56357d0a7890bc9880f4a75f6c73 Mon Sep 17 00:00:00 2001 From: Joshua Fernandes Date: Wed, 12 Jul 2023 13:31:14 +0530 Subject: [PATCH] [CIVIC-1204] Added SVG support for Logos. --- .../civictheme/includes/system_branding.inc | 1 + .../theme.settings.components.feature | 25 +++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/docroot/themes/contrib/civictheme/includes/system_branding.inc b/docroot/themes/contrib/civictheme/includes/system_branding.inc index 12175305a..4369a39ad 100644 --- a/docroot/themes/contrib/civictheme/includes/system_branding.inc +++ b/docroot/themes/contrib/civictheme/includes/system_branding.inc @@ -16,6 +16,7 @@ use Drupal\Core\Url; * @SuppressWarnings(PHPMD.StaticAccess) * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) + * @SuppressWarnings(ElseExpression) */ function civictheme_preprocess_block__system_branding_block(&$variables) { $variables['show_site_logo'] = !empty($variables['elements']['#configuration']['use_site_logo']); diff --git a/tests/behat/features/theme.settings.components.feature b/tests/behat/features/theme.settings.components.feature index b4b9dcbfb..f72a94213 100644 --- a/tests/behat/features/theme.settings.components.feature +++ b/tests/behat/features/theme.settings.components.feature @@ -217,6 +217,31 @@ Feature: Components settings are available in the theme settings And I check the box "Confirm settings reset" And I press "reset_to_defaults" Then I should see the text "Theme configuration was reset to defaults." + + @api + Scenario: The CivicTheme theme settings verify custom logo configuration with SVG image upload + Given I am logged in as a user with the "Site Administrator" role + And I visit current theme settings page + + When I attach the file "test_svg.svg" to "Upload Primary Light logo for Desktop" + And I attach the file "test_svg.svg" to "Upload Primary Light logo for Mobile" + And I attach the file "test_svg.svg" to "Upload Primary Dark logo for Desktop" + And I attach the file "test_svg.svg" to "Upload Primary Dark logo for Mobile" + And I select the radio button "Light" with the id "edit-components-header-theme-light" + And I select the radio button "Default" with the id "edit-components-header-logo-type-default" + And I select the radio button "Dark" with the id "edit-components-footer-theme-dark" + And I select the radio button "Default" with the id "edit-components-footer-logo-type-default" + And I press "Save configuration" + Then I should see the text "The configuration options have been saved." + + And I go to the homepage + And I should see an ".ct-logo svg.ct-logo__image" element + + # Reset settings. + When I visit current theme settings page + And I check the box "Confirm settings reset" + And I press "reset_to_defaults" + Then I should see the text "Theme configuration was reset to defaults." @api Scenario: The CivicTheme theme settings External Links component validation works.