Skip to content

Commit

Permalink
Fix(exporter-scss): Allow negative numbers in unit printer
Browse files Browse the repository at this point in the history
  • Loading branch information
crishpeen committed Oct 26, 2023
1 parent e54e840 commit 9ff78de
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion exporters/scss/exporter.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Jan Kryšpín <[email protected]>",
"organization": "LMC s.r.o.",
"source_dir": "src",
"version": "2.6.0",
"version": "2.6.1",
"usesBrands": true,
"config": {
"sources": "sources.json",
Expand Down
2 changes: 1 addition & 1 deletion exporters/scss/generated/functions.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions exporters/scss/src/js/printers/__tests__/unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ describe('printUnit', () => {
// value, unit, expected
[123, 'Pixels', '123px'],
[123, 'rem', '123rem'],
[-123, 'Pixels', '-123px'],
[-123, 'rem', '-123rem'],
])('should print unit', (value, unit, expected) => {
expect(printUnit(value, unit)).toBe(expected);
});
Expand Down
2 changes: 1 addition & 1 deletion exporters/scss/src/js/printers/unit.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export function printUnit(value: number, unit: string): string {
let result = value.toString();
if (value > 0) {
if (+value !== 0) {
if (unit === 'Pixels') {
result += 'px';
}
Expand Down

0 comments on commit 9ff78de

Please sign in to comment.