Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/tasks/buildThemes.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module.exports = function({workspace, dependencies, options}) {
}

return Promise.all(promises).then(([allResources, availableLibraries]) => {
if (!availableLibraries) {
if (!availableLibraries || availableLibraries.length === 0) {
// Try to build all themes
return allResources;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.someClass{color:black}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.someClass {
color: #000000;
}

/* Inline theming parameters */
#sap-ui-theme-theme\.j{background-image:url('data:text/plain;utf-8,%7B%7D')}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.someClass {
color: #000000;
}

/* Inline theming parameters */
#sap-ui-theme-theme\.j{background-image:url('data:text/plain;utf-8,%7B%7D')}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import "Button.less";
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.someClass{color:black}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import "Button.less";
51 changes: 50 additions & 1 deletion test/lib/builder/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const libraryEPath = path.join(__dirname, "..", "..", "fixtures", "library.e");
const libraryIPath = path.join(__dirname, "..", "..", "fixtures", "library.i");
const libraryHPath = path.join(__dirname, "..", "..", "fixtures", "library.h");
const libraryCore = path.join(__dirname, "..", "..", "fixtures", "sap.ui.core-evo");
const themeJPath = path.join(__dirname, "..", "..", "fixtures", "theme.j");

const recursive = require("recursive-readdir");

Expand All @@ -31,12 +32,14 @@ const findFiles = (folder) => {

function cloneProjectTree(tree) {
const clone = JSON.parse(JSON.stringify(tree));

function increaseDepth(node) {
node._level++;
if ( Array.isArray(node.dependencies) ) {
if (Array.isArray(node.dependencies)) {
node.dependencies.forEach(increaseDepth);
}
}

increaseDepth(clone);
return clone;
}
Expand Down Expand Up @@ -253,6 +256,27 @@ test("Build library.i with manifest info taken from .library and library.js", (t
});
});

test("Build theme.j even without an library", (t) => {
const destPath = "./test/tmp/build/theme.j/dest";
const expectedPath = "./test/expected/build/theme.j/dest";
return builder.build({
tree: themeJTree,
destPath
}).then(() => {
return findFiles(expectedPath);
}).then((expectedFiles) => {
// Check for all directories and files
assert.directoryDeepEqual(destPath, expectedPath);

// Check for all file contents
expectedFiles.forEach((expectedFile) => {
const relativeFile = path.relative(expectedPath, expectedFile);
const destFile = path.join(destPath, relativeFile);
assert.fileEqual(destFile, expectedFile);
t.pass();
});
});
});

const applicationATree = {
"id": "application.a",
Expand Down Expand Up @@ -737,3 +761,28 @@ const libraryITree = {
}
};

const themeJTree = {
"id": "library.i",
"version": "1.0.0",
"path": themeJPath,
"dependencies": [],
"_level": 0,
"specVersion": "0.1",
"type": "library",
"metadata": {
"name": "theme.j",
"copyright": "Some fancy copyright"
},
"resources": {
"configuration": {
"paths": {
"src": "main/src",
"test": "main/test"
}
},
"pathMappings": {
"/resources/": "main/src",
"/test-resources/": "main/test"
}
}
};