From 00c5b89b04dcfb1448679370b443e2f763b8f4be Mon Sep 17 00:00:00 2001 From: Augusto Mallmann Date: Fri, 5 Aug 2022 14:21:08 -0400 Subject: [PATCH] [PLAY-235] BUGFIX - Classnames and global props in the list kit for rails (#1981) * Fix not generating classnames in list kit * Fix tests not expecting dark class Co-authored-by: Jasper Furniss --- playbook/app/pb_kits/playbook/pb_list/list.rb | 14 ++++++-------- playbook/spec/pb_kits/playbook/kits/list_spec.rb | 4 ++-- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/playbook/app/pb_kits/playbook/pb_list/list.rb b/playbook/app/pb_kits/playbook/pb_list/list.rb index 7b5f247b44..d1dd2fd128 100755 --- a/playbook/app/pb_kits/playbook/pb_list/list.rb +++ b/playbook/app/pb_kits/playbook/pb_list/list.rb @@ -19,14 +19,12 @@ class List < Playbook::KitBase prop :tabindex def list_classname - [ - "pb_list_kit", - xpadding_class, - borderless_class, - dark_class, - size_class, - layout_class, - ].compact.join("_") + generate_classname("pb_list_kit", + xpadding_class, + borderless_class, + dark_class, + size_class, + layout_class) end def ordered_class diff --git a/playbook/spec/pb_kits/playbook/kits/list_spec.rb b/playbook/spec/pb_kits/playbook/kits/list_spec.rb index 7f98813a4f..831debb6d8 100644 --- a/playbook/spec/pb_kits/playbook/kits/list_spec.rb +++ b/playbook/spec/pb_kits/playbook/kits/list_spec.rb @@ -31,12 +31,12 @@ describe "#classname" do it "returns namespaced class name", :aggregate_failures do expect(subject.new({}).list_classname).to eq "pb_list_kit_" - expect(subject.new(dark: true).list_classname).to eq "pb_list_kit_dark_" + expect(subject.new(dark: true).list_classname).to eq "pb_list_kit_dark_ dark" expect(subject.new(borderless: true).list_classname).to eq "pb_list_kit_borderless_" expect(subject.new(xpadding: true).list_classname).to eq "pb_list_kit_xpadding_" expect(subject.new(size: "large").list_classname).to eq "pb_list_kit_large_" expect(subject.new(layout: "right").list_classname).to eq "pb_list_kit_layout_right" - expect(subject.new(dark: true, xpadding: true, size: "large", borderless: true, layout: "left").list_classname).to eq "pb_list_kit_xpadding_borderless_dark_large_layout_left" + expect(subject.new(dark: true, xpadding: true, size: "large", borderless: true, layout: "left").list_classname).to eq "pb_list_kit_xpadding_borderless_dark_large_layout_left dark" end end end