Skip to content

Commit fef5f4b

Browse files
authored
fix: Update function call (#65)
## Description Resolves an issue the rem is called when handling mulitple values, rather than the expected toRem function. At the same time a deprecation warning has been addressed when using the sass function `append`.
1 parent 2b1188b commit fef5f4b

File tree

4 files changed

+20
-1
lines changed

4 files changed

+20
-1
lines changed

lib/tools/_rem.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@use 'sass:list';
12
@use 'sass:math';
23
@use 'sass:meta';
34
@use '../settings/globals';
@@ -33,7 +34,7 @@ $gel-tools-rem-enable--fallback: true !default;
3334
$result: ();
3435

3536
@each $e in $value {
36-
$result: append($result, rem($e, $baseline));
37+
$result: list.append($result, toRem($e, $baseline));
3738
}
3839

3940
@return $result;

test/__snapshots__/rem.test.js.snap

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
22

3+
exports[`rem() > function > should return multiple values 1`] = `
4+
".multiples {
5+
padding: 1rem 1.5rem;
6+
}"
7+
`;
8+
39
exports[`rem() > function > should return pixel values converted to rem 1`] = `
410
".demo-1 {
511
font-size: 1rem;

test/data/rem/multiples.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@use '../../../sass-tools';
2+
3+
.multiples {
4+
// Passing a list to toRem triggers the buggy code path
5+
padding: sass-tools.toRem(16px 24px);
6+
}

test/rem.test.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ describe('rem()', () => {
55

66
expect(css).toMatchSnapshot();
77
});
8+
9+
it('should return multiple values', async () => {
10+
const css = await global.compileCSS('test/data/rem/multiples.scss');
11+
12+
expect(css).toMatchSnapshot();
13+
});
814
});
915

1016
describe('mixin', () => {

0 commit comments

Comments
 (0)