Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
markdoeswork committed Dec 5, 2024
1 parent 6e3bb5d commit 508666d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
<Body
data={{ testid: testIdUnderline }}
hover={{ underline: true }}
text="Hi"
/>
);

kit = screen.getByTestId(testIdUnderline);
expectedClassName = `hover_underline`;
expect(kit).toHaveClass(expectedClassName);

const testIdMultiple = `${testSubject}-hover-multiple`;
render(
<Body
Expand All @@ -66,6 +79,7 @@ test('Hover Props: returns proper class name', () => {
background: 'error',
shadow: 'deeper',
scale: 'xl',
underline: true,
}}
text="Hi"
/>
Expand All @@ -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');
});
8 changes: 8 additions & 0 deletions playbook/spec/playbook/global_props/hover_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 508666d

Please sign in to comment.