Skip to content

Commit

Permalink
Merge pull request #119 from oddbird/multi-adjust
Browse files Browse the repository at this point in the history
Multi adjust
  • Loading branch information
jgerigmeyer authored Jul 20, 2022
2 parents c220bf4 + 1be3568 commit 37c2523
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Accoutrement Changelog

## UNRELEASED

- INTERNAL:

- Fixed a bug with [`tokens.get()`](https://www.oddbird.net/accoutrement/docs/token-api#function--get) that didn't allow per-property inline functional adjustments ([#117](https://github.com/oddbird/accoutrement/issues/117))

## 4.0.2 - 07/18/22

- INTERNAL:
Expand Down
2 changes: 1 addition & 1 deletion sass/tokens/_parse.scss
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ $_stack: ();

// handle each item in the list…
@each $bit in $value {
$new: list.append($new, _resolve-value($map, $bit));
$new: list.append($new, compile-token($map, $bit));
}

@return $new;
Expand Down
50 changes: 50 additions & 0 deletions test/tokens/_parse.scss
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,21 @@ $scale: function.get('color.scale');
@include describe('compile-token [function]') {
$map: (
simple: 'hello world',
spacers: (
'sm': '#spacers->md'
(
'-': 1em,
),
'md': 2em,
'lg': '#spacers->md'
(
'+': 1em,
),
'xl': '#spacers->lg'
(
'+': 1em,
),
),
a: (
b: (
c: 'world',
Expand All @@ -300,6 +315,30 @@ $scale: function.get('color.scale');
worse: '#bad',
h: 'hello',
w: 'world',
margin: (
1em
(
'+': '#spacers->sm',
),
)
(
1em
(
'+': '#spacers->md',
),
)
(
1em
(
'+': '#spacers->lg',
),
)
(
1em
(
'+': '#spacers->xl',
),
),
);

@include it('Has no impact on a token without references') {
Expand Down Expand Up @@ -423,6 +462,17 @@ $scale: function.get('color.scale');
);
}

@include it('Can perform multiple functional adjustments in one token') {
@include assert-equal(
parse.compile-token(
$map,
(1em ('+': '#spacers->sm')) (1em ('+': '#spacers->md'))
(1em ('+': '#spacers->lg')) (1em ('+': '#spacers->xl'))
),
2em 3em 4em 5em
);
}

@include it('Allows alias references inside functional arguments') {
$shadow: rgba(black, 0.5);

Expand Down

0 comments on commit 37c2523

Please sign in to comment.