Skip to content

Commit

Permalink
Add integration test for library with theme and theme designer resources
Browse files Browse the repository at this point in the history
  • Loading branch information
flovogt committed Apr 12, 2022
1 parent 24c1ee3 commit 2a585e6
Show file tree
Hide file tree
Showing 14 changed files with 78 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"sEntity": "Library",
"sId": "theme/j",
"sVersion": "1.0.0"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"sEntity": "Theme",
"sId": "somefancytheme",
"sVendor": "SAP",
"oExtends": "base"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.someClass {
color: @someColor
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
:root{--someColor:#000}
/* Inline theming parameters */
#sap-ui-theme-theme\.j{background-image:url('data:text/plain;utf-8,%7B%22someColor%22%3A%22%23000%22%7D')}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/* NOTE: This file was generated as an optimized version of "css_variables.source.less" for the Theme Designer. */

@import "../base/css_variables.less";

/* START "css_variables.source.less" */
@someColor: #000000;

:root {
--someColor: @someColor;
}

/* END "css_variables.source.less" */

@import "../../../../sap/ui/core/themes/somefancytheme/global.less";
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@someColor: #000000;

:root {
--someColor: @someColor;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.someClass{color:#000}
/* Inline theming parameters */
#sap-ui-theme-theme\.j{background-image:url('data:text/plain;utf-8,%7B%22someColor%22%3A%22%23000%22%7D')}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"someColor":"#000"}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.someClass{color:#000}
/* Inline theming parameters */
#sap-ui-theme-theme\.j{background-image:url('data:text/plain;utf-8,%7B%22someColor%22%3A%22%23000%22%7D')}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* NOTE: This file was generated as an optimized version of "library.source.less" for the Theme Designer. */

@someColor: black;
/* START "Button.less" */
.someClass {
color: @someColor
}

/* END "Button.less" */

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@someColor: black;
@import "Button.less";
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.someClass{color:var(--someColor)}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.someClass{color:var(--someColor)}
22 changes: 21 additions & 1 deletion test/lib/builder/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -952,6 +952,26 @@ test.serial("Build library with theme configured for CSS variables", (t) => {
});
});

test.serial("Build library with theme configured for CSS variables and theme designer resources", (t) => {
const destPath = "./test/tmp/build/theme.j/dest-css-variables-theme-designer-resources";
const expectedPath = "./test/expected/build/theme.j/dest-css-variables-theme-designer-resources";
return builder.build({
tree: themeJTree,
cssVariables: true,
destPath,
includedTasks: ["generateThemeDesignerResources"]
}).then(() => {
return findFiles(expectedPath);
}).then((expectedFiles) => {
// Check for all directories and files
assert.directoryDeepEqual(destPath, expectedPath);

return checkFileContentsIgnoreLineFeeds(t, expectedFiles, expectedPath, destPath);
}).then(() => {
t.pass();
});
});

test.serial("Build theme-library with CSS variables", (t) => {
const destPath = "./test/tmp/build/theme.library.e/dest-css-variables";
const expectedPath = "./test/expected/build/theme.library.e/dest-css-variables";
Expand All @@ -971,7 +991,7 @@ test.serial("Build theme-library with CSS variables", (t) => {
});
});

test.serial("Build theme-library with CSS variables and Theme Designer Resources", (t) => {
test.serial("Build theme-library with CSS variables and theme designer resources", (t) => {
const destPath = "./test/tmp/build/theme.library.e/dest-css-variables-theme-designer-resources";
const expectedPath = "./test/expected/build/theme.library.e/dest-css-variables-theme-designer-resources";
return builder.build({
Expand Down

0 comments on commit 2a585e6

Please sign in to comment.