-
Notifications
You must be signed in to change notification settings - Fork 273
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(theming): fix icons version display for custom themes (built via …
…the ThemeDesigner) (#6815) Currently, for older themes (sap_belize, sap_fiori_3) we display old icon fonts, while for sap_horizon - the latest icon fonts. This applies for all icon collections. And, to do that we check if the current theme is part of the sap_horizon theme family or not. However, once an app is using custom theme, the current theme has a custom theme and by default we will enforce the old icon fonts, because the custom theme name won't match "sap_horizon". With this change, when the current theme name is not part of the built-in theme families, we now look for an custom theme and check the base theme that the custom theme is built upon: rename isThemeFamily to isLegacyThemeFamily and adopt it in the code (all isThemeFamily("sap_horizon") calls are replaced with !isLegacyThemeFamily) isLegacyThemeFamily now checks the baseTheme of the custom theme if present add test (one when built-in theme is set and when theme designer custom theme is used) Related to: #6758
- Loading branch information
Showing
10 changed files
with
183 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<!DOCTYPE html> | ||
<html lang="EN"> | ||
|
||
<head> | ||
<title>ui5 webcomponents</title> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> | ||
<meta charset="utf-8"> | ||
|
||
<script src="../../../bundle.esm.js" type="module"></script> | ||
|
||
<script data-ui5-config type="application/json"> | ||
{ | ||
"theme": "sap_fiori_3_dark" | ||
} | ||
</script> | ||
</head> | ||
|
||
<body> | ||
|
||
<ui5-icon name="home"></ui5-icon> | ||
</body> | ||
</html> |
23 changes: 23 additions & 0 deletions
23
packages/main/test/pages/base/IconCollectionInCustomTheme.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!DOCTYPE html> | ||
<html lang="EN"> | ||
|
||
<head> | ||
<title>ui5 webcomponents</title> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> | ||
<meta charset="utf-8"> | ||
|
||
<link rel="stylesheet" type="text/css" href="../css/css_variables.horizon.css"> | ||
<script src="../../../bundle.esm.js" type="module"></script> | ||
|
||
<script data-ui5-config type="application/json"> | ||
{ | ||
"theme": "readfish" | ||
} | ||
</script> | ||
</head> | ||
|
||
<body> | ||
|
||
<ui5-icon name="home"></ui5-icon> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* Copyright (c) 2012-2020 SAP SE or an SAP affiliate company. All rights reserved. | ||
* | ||
* Theming Engine 1.60.0 | ||
* data:{"Path": "Base.baseLib.redfish.css_variables", "PathPattern": "/%frameworkId%/%libId%/%themeId%/%fileId%.css", "Extends": ["sap_horizon","sap_base_fiori","baseTheme"], "Tags": ["Horizon","LightColorScheme"], "Version": { "Build":"11.1.27.20210312160011", "Source": "11.1.27", "Engine": "1.60.0"}} | ||
*/ | ||
.sapThemeMetaData-Base-baseLib{background-image: url('data:text/plain;utf-8,{"Path": "Base.baseLib.redfish.css_variables", "PathPattern": "/%frameworkId%/%libId%/%themeId%/%fileId%.css", "Extends": ["sap_horizon","sap_base_fiori","baseTheme"], "Tags": ["Horizon","LightColorScheme"], "Version": { "Build":"11.1.27.20210312160011", "Source": "11.1.27", "Engine": "1.60.0"}}');} | ||
:root { | ||
--sapBrandColor: #f42015; | ||
--sapHighlightColor: #f42015; | ||
--sapBaseColor: #fff; | ||
--sapShellColor: #f42015; | ||
--sapBackgroundColor: #f7f7f7; | ||
--sapFontFamily: "72", "72full", Arial, Helvetica, sans-serif; | ||
--sapFontSize: .875rem; | ||
--sapTextColor: #000; | ||
--sapLinkColor: #f42015; | ||
--sapLink_Hover_Color: #0854a0; | ||
--sapLink_Active_Color: #f42015; | ||
--sapLink_Visited_Color: #f42015; | ||
--sapLink_InvertedColor: #d3e8fd; | ||
--sapLink_SubtleColor: #074888; | ||
--sapCompanyLogo: none; | ||
--sapBackgroundImage: none; | ||
--sapBackgroundImageOpacity: 1.0; | ||
--sapBackgroundImageRepeat: false; | ||
--sapSelectedColor: #f42015; | ||
--sapActiveColor: #f42015; | ||
--sapHighlightTextColor: #fff; | ||
--sapTitleColor: #8c0d24; | ||
--sapNegativeColor: #f42015; | ||
--sapCriticalColor: #e9730c; | ||
--sapPositiveColor: #1c5032; | ||
--sapInformativeColor: #f42015; | ||
--sapNeutralColor: #716a71; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
const assert = require("chai").assert; | ||
|
||
describe("Icon collection", () => { | ||
before(async () => { | ||
await browser.url("test/pages/base/IconCollection.html"); | ||
}); | ||
|
||
it("Tests the icon collection in built-in themes", async () => { | ||
const result = await browser.executeAsync(done => { | ||
const bundle = window['sap-ui-webcomponents-bundle']; | ||
|
||
const res = {}; | ||
res.iconCollection = bundle.getEffectiveIconCollection(); | ||
res.isLegacyThemeFamily = bundle.configuration.isLegacyThemeFamily(); | ||
done(res); | ||
}); | ||
|
||
// assert: "SAP-icons-v4" is used in legacy "sap_fiori_3_dark" theme | ||
assert.strictEqual(result.iconCollection, "SAP-icons-v4", | ||
"The 'SAP-icons-v4' collection is correctly used in 'sap_fiori_3_dark' theme"); | ||
assert.strictEqual(result.isLegacyThemeFamily, true, | ||
"The 'sap_fiori_3_dark' is part of legacy theme family"); | ||
|
||
|
||
// act: setTheme("sap_horizon") | ||
await browser.executeAsync(async (done) => { | ||
await window['sap-ui-webcomponents-bundle'].configuration.setTheme("sap_horizon"); | ||
done(); | ||
}); | ||
|
||
const result2 = await browser.executeAsync(done => { | ||
const bundle = window['sap-ui-webcomponents-bundle']; | ||
|
||
const res = {}; | ||
res.iconCollection = bundle.getEffectiveIconCollection(); | ||
res.isLegacyThemeFamily = bundle.configuration.isLegacyThemeFamily(); | ||
done(res); | ||
}); | ||
|
||
// assert: "SAP-icons-v5" is used in latest "sap_horizon" theme | ||
assert.strictEqual(result2.iconCollection, "SAP-icons-v5", | ||
"The 'SAP-icons-v5' collection is correctly used in 'sap_horizon' theme"); | ||
assert.strictEqual(result2.isLegacyThemeFamily, false, | ||
"The 'sap_horizon' is not part of legacy theme family, it's the latest one"); | ||
}); | ||
}); | ||
|
||
describe("Icon collection in Custom Theme", () => { | ||
before(async () => { | ||
// The test page is using custom theme (based on "sap_horizon") | ||
await browser.url("test/pages/base/IconCollectionInCustomTheme.html"); | ||
}); | ||
|
||
it("Tests the icon collection in a custom theme", async () => { | ||
const result = await browser.executeAsync(done => { | ||
const bundle = window['sap-ui-webcomponents-bundle']; | ||
|
||
const res = {}; | ||
res.iconCollection = bundle.getEffectiveIconCollection(); | ||
res.isLegacyThemeFamily = bundle.configuration.isLegacyThemeFamily(); | ||
|
||
done(res); | ||
}); | ||
|
||
assert.strictEqual(result.iconCollection, "SAP-icons-v5", | ||
"The 'SAP-icons-v5' collection is correctly used in 'redfish' - extending 'sap_horizon'"); | ||
assert.strictEqual(result.isLegacyThemeFamily, false, | ||
"The 'redfish' custom theme is not part of legacy theme family, as it's extending 'sap_horizon'."); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters