Skip to content

Commit

Permalink
[FIX] Add inline parameters on empty CSS
Browse files Browse the repository at this point in the history
  • Loading branch information
matz3 committed Oct 29, 2019
1 parent 490d476 commit bc59d58
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ Builder.prototype.build = function(options) {

// embed parameter variables as plain-text string into css
result.css += parameterStyleRule;
if (result.cssRtl) {
if (options.rtl) {
result.cssRtl += parameterStyleRule;
}
}
Expand Down
3 changes: 3 additions & 0 deletions test/expected/libraries/empty/library-RTL.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

/* Inline theming parameters */
#sap-ui-theme-my\.empty\.lib{background-image:url('data:text/plain;utf-8,%7B%7D')}
1 change: 1 addition & 0 deletions test/expected/libraries/empty/library-parameters.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
3 changes: 3 additions & 0 deletions test/expected/libraries/empty/library.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

/* Inline theming parameters */
#sap-ui-theme-my\.empty\.lib{background-image:url('data:text/plain;utf-8,%7B%7D')}
Empty file.
22 changes: 22 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,28 @@ describe("libraries (my/ui/lib)", function() {
], "import list should be correct.");
});
});

it("should create correct files on empty less input", function() {
return new Builder().build({
lessInputPath: "empty.less",
rootPaths: [
"test/fixtures/libraries/empty"
],
library: {
name: "my.empty.lib"
}
}).then(function(result) {
const oVariablesExpected = {};

assert.equal(result.css, readFile("test/expected/libraries/empty/library.css"), "css should be correctly generated.");
assert.equal(result.cssRtl, readFile("test/expected/libraries/empty/library-RTL.css"), "rtl css should be correctly generated.");
assert.deepEqual(result.variables, oVariablesExpected, "variables should be correctly collected.");
assert.deepEqual(result.allVariables, oVariablesExpected, "allVariables should be correctly collected.");
assert.deepEqual(result.imports, [
path.join("test", "fixtures", "libraries", "empty", "empty.less"),
], "import list should be correct.");
});
});
});

describe("libraries (my/other/ui/lib)", function() {
Expand Down

0 comments on commit bc59d58

Please sign in to comment.