From 508666df2d0ece2377272dfa02efef75b9940baa Mon Sep 17 00:00:00 2001 From: Mark Date: Thu, 5 Dec 2024 15:46:16 -0500 Subject: [PATCH] Add tests --- .../utilities/test/globalProps/hover.test.js | 15 +++++++++++++++ playbook/spec/playbook/global_props/hover_spec.rb | 8 ++++++++ 2 files changed, 23 insertions(+) diff --git a/playbook/app/pb_kits/playbook/utilities/test/globalProps/hover.test.js b/playbook/app/pb_kits/playbook/utilities/test/globalProps/hover.test.js index 237b279bd4..9a431d5931 100644 --- a/playbook/app/pb_kits/playbook/utilities/test/globalProps/hover.test.js +++ b/playbook/app/pb_kits/playbook/utilities/test/globalProps/hover.test.js @@ -57,6 +57,19 @@ test('Hover Props: returns proper class name', () => { expectedClassName = `hover_scale_xl`; expect(kit).toHaveClass(expectedClassName); + const testIdUnderline = `${testSubject}-hover-underline`; + render( + + ); + + kit = screen.getByTestId(testIdUnderline); + expectedClassName = `hover_underline`; + expect(kit).toHaveClass(expectedClassName); + const testIdMultiple = `${testSubject}-hover-multiple`; render( { background: 'error', shadow: 'deeper', scale: 'xl', + underline: true, }} text="Hi" /> @@ -76,4 +90,5 @@ test('Hover Props: returns proper class name', () => { expect(kit).toHaveClass('hover_background-error'); expect(kit).toHaveClass('hover_shadow_deeper'); expect(kit).toHaveClass('hover_scale_xl'); + expect(kit).toHaveClass('hover_underline'); }); diff --git a/playbook/spec/playbook/global_props/hover_spec.rb b/playbook/spec/playbook/global_props/hover_spec.rb index 7b3be7f19f..95a8238887 100644 --- a/playbook/spec/playbook/global_props/hover_spec.rb +++ b/playbook/spec/playbook/global_props/hover_spec.rb @@ -25,17 +25,25 @@ expect(instance.classname).to include("hover_color-#{value}") end + instance = subject.new({ hover: { underline: true } }) + expect(instance.classname).to include("hover_underline") + + instance = subject.new({ hover: { underline: false } }) + expect(instance.classname).not_to include("hover_underline") + hover_props = { shadow: "deep", scale: "sm", background: "red", color: "blue", + underline: true, } instance = subject.new({ hover: hover_props }) expect(instance.classname).to include("hover_shadow_deep") expect(instance.classname).to include("hover_scale_sm") expect(instance.classname).to include("hover_background-red") expect(instance.classname).to include("hover_color-blue") + expect(instance.classname).to include("hover_underline") end end end