From 53b67f606d0531cbf43e0dc77a6964b098c8e584 Mon Sep 17 00:00:00 2001 From: Manuel Puyol Date: Fri, 19 Feb 2021 09:43:42 -0600 Subject: [PATCH 1/2] early return when classify value is an empty string --- lib/primer/classify.rb | 2 +- test/primer/classify_test.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/primer/classify.rb b/lib/primer/classify.rb index 884fc1ddd2..054355d7cb 100644 --- a/lib/primer/classify.rb +++ b/lib/primer/classify.rb @@ -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) diff --git a/test/primer/classify_test.rb b/test/primer/classify_test.rb index 34961f0065..75b77e7604 100644 --- a/test/primer/classify_test.rb +++ b/test/primer/classify_test.rb @@ -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 }) From c7906b7aa555838679e296ed46d41f42fddaa9b3 Mon Sep 17 00:00:00 2001 From: Manuel Puyol Date: Fri, 19 Feb 2021 09:44:21 -0600 Subject: [PATCH 2/2] update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e5437c43ab..6e82a2d8d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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.