From 9c9f5b90fc7de5723e74f0a4283486f9ebf743d6 Mon Sep 17 00:00:00 2001 From: Justin Duncan <54837882+justin-duncan@users.noreply.github.com> Date: Tue, 19 Jul 2022 11:25:51 +0200 Subject: [PATCH 1/5] Fixed inline function adjustments --- sass/tokens/_parse.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sass/tokens/_parse.scss b/sass/tokens/_parse.scss index 6a02b528..c01973d9 100644 --- a/sass/tokens/_parse.scss +++ b/sass/tokens/_parse.scss @@ -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; From c32f33f39b2d06e4e3ae4d3503e4bf4086702b36 Mon Sep 17 00:00:00 2001 From: Justin Duncan <54837882+justin-duncan@users.noreply.github.com> Date: Tue, 19 Jul 2022 15:37:46 +0200 Subject: [PATCH 2/5] Updated changelogs --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b105b17..6b08a087 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,9 @@ # 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 From 541325d74aaafb0fa73c70f0e05513c2dc891a46 Mon Sep 17 00:00:00 2001 From: Justin Duncan <54837882+justin-duncan@users.noreply.github.com> Date: Tue, 19 Jul 2022 19:50:52 +0200 Subject: [PATCH 3/5] Added new unit test --- test/tokens/_parse.scss | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/tokens/_parse.scss b/test/tokens/_parse.scss index 238ade3c..56d494da 100644 --- a/test/tokens/_parse.scss +++ b/test/tokens/_parse.scss @@ -283,6 +283,12 @@ $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', @@ -300,6 +306,7 @@ $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') { @@ -422,6 +429,21 @@ $scale: function.get('color.scale'); color.scale(color.mix(mediumvioletred, $shadow, 20%), $alpha: 50%) ); } + + @include it('Can perform multiple functional adjustments in one token') { + $shadow: rgba(black, 0.5); + + @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); From 5d3b152c8ea0f4a41aef796944805eb07726c247 Mon Sep 17 00:00:00 2001 From: Justin Duncan <54837882+justin-duncan@users.noreply.github.com> Date: Tue, 19 Jul 2022 19:56:05 +0200 Subject: [PATCH 4/5] Removed extra variable. --- test/tokens/_parse.scss | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/tokens/_parse.scss b/test/tokens/_parse.scss index 56d494da..3535f472 100644 --- a/test/tokens/_parse.scss +++ b/test/tokens/_parse.scss @@ -431,8 +431,6 @@ $scale: function.get('color.scale'); } @include it('Can perform multiple functional adjustments in one token') { - $shadow: rgba(black, 0.5); - @include assert-equal( parse.compile-token( $map, From 1be3568ff60b2a797c8590a6e4806e543efdc1b0 Mon Sep 17 00:00:00 2001 From: Miriam Suzanne Date: Tue, 19 Jul 2022 16:53:04 -0600 Subject: [PATCH 5/5] Lint --- CHANGELOG.md | 1 + test/tokens/_parse.scss | 48 +++++++++++++++++++++++++++++++++-------- 2 files changed, 40 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b08a087..52690731 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ # Accoutrement Changelog + ## UNRELEASED - INTERNAL: diff --git a/test/tokens/_parse.scss b/test/tokens/_parse.scss index 3535f472..feeb0574 100644 --- a/test/tokens/_parse.scss +++ b/test/tokens/_parse.scss @@ -284,10 +284,19 @@ $scale: function.get('color.scale'); $map: ( simple: 'hello world', spacers: ( - 'sm': '#spacers->md' ('-': 1em), + 'sm': '#spacers->md' + ( + '-': 1em, + ), 'md': 2em, - 'lg': '#spacers->md' ('+': 1em), - 'xl': '#spacers->lg' ('+': 1em), + 'lg': '#spacers->md' + ( + '+': 1em, + ), + 'xl': '#spacers->lg' + ( + '+': 1em, + ), ), a: ( b: ( @@ -306,7 +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')) + margin: ( + 1em + ( + '+': '#spacers->sm', + ), + ) + ( + 1em + ( + '+': '#spacers->md', + ), + ) + ( + 1em + ( + '+': '#spacers->lg', + ), + ) + ( + 1em + ( + '+': '#spacers->xl', + ), + ), ); @include it('Has no impact on a token without references') { @@ -429,15 +461,13 @@ $scale: function.get('color.scale'); color.scale(color.mix(mediumvioletred, $shadow, 20%), $alpha: 50%) ); } - + @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')) + (1em ('+': '#spacers->sm')) (1em ('+': '#spacers->md')) + (1em ('+': '#spacers->lg')) (1em ('+': '#spacers->xl')) ), 2em 3em 4em 5em );