Skip to content

Commit

Permalink
Merge pull request #255 from primer/fix-classify-empty-color
Browse files Browse the repository at this point in the history
Early return when classify value is an empty string
  • Loading branch information
manuelpuyol authored Feb 19, 2021
2 parents dfaafdd + c7906b7 commit ab8932c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## main

* Fix bug when empty string was passed to Classify.

*Manuel Puyol*

## 0.0.19

* Add support for functional colors to `color` system argument.
Expand Down
2 changes: 1 addition & 1 deletion lib/primer/classify.rb
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def extract_hash(styles_hash)
end

def extract_value(memo, key, val, breakpoint)
return if val.nil?
return if val.nil? || val == ""

if SPACING_KEYS.include?(key)
if MARGIN_DIRECTION_KEYS.include?(key)
Expand Down
1 change: 1 addition & 0 deletions test/primer/classify_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ def test_underline
end

def test_color
assert_generated_class(nil, { color: "" })
assert_generated_class("text-blue", { color: :blue })
assert_generated_class("text-red", { color: :red })
assert_generated_class("text-gray-light", { color: :gray_light })
Expand Down

1 comment on commit ab8932c

@vercel
Copy link

@vercel vercel bot commented on ab8932c Feb 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.