Skip to content

Commit

Permalink
fix: panel: body padding prop on panel does not work (#569)
Browse files Browse the repository at this point in the history
* fix: panel: body padding prop on panel does not work

* chore: panel: add padding unit tests and snaps
  • Loading branch information
dkilgore-eightfold authored Mar 22, 2023
1 parent 4f7ca8c commit f3ddff5
Show file tree
Hide file tree
Showing 3 changed files with 3,402 additions and 11 deletions.
33 changes: 27 additions & 6 deletions src/components/Panel/Panel.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ describe('Panel', () => {
);
});

test('panel visibility', () => {
test('Panel visibility', () => {
expect(wrapper.hasClass('visible')).not.toEqual(true);
wrapper.setProps({
visible: true,
});
expect(wrapper.hasClass('visible')).toBe(false);
});

test('panel content', () => {
test('Panel content', () => {
wrapper.setProps({
visible: true,
title,
Expand All @@ -47,7 +47,7 @@ describe('Panel', () => {
expect(wrapper.find('.header').text()).toBe(title);
});

test('panel actions', () => {
test('Panel actions', () => {
const onClose = jest.fn();
wrapper.setProps({
visible: true,
Expand All @@ -65,7 +65,7 @@ describe('Panel', () => {
expect(onClose).toHaveBeenCalledTimes(2);
});

test('panel header actions exist', () => {
test('Panel header actions exist', () => {
wrapper.setProps({
visible: true,
headerButtonProps: {
Expand All @@ -91,15 +91,36 @@ describe('Panel', () => {
expect(wrapper.find('.header-action-button-3').length).toBeTruthy();
});

test('panel no body padding', () => {
test('Panel no body padding', () => {
wrapper.setProps({
visible: true,
bodyPadding: false,
});
expect(wrapper.find('.no-body-padding').length).toBeTruthy();
expect(wrapper.render()).toMatchSnapshot();
});

test('panel overlay is hidden', () => {
test('Panel no header padding', () => {
wrapper.setProps({
visible: true,
headerPadding: false,
});
expect(wrapper.find('.no-header-padding').length).toBeTruthy();
expect(wrapper.render()).toMatchSnapshot();
});

test('Panel no body and header padding', () => {
wrapper.setProps({
visible: true,
bodyPadding: false,
headerPadding: false,
});
expect(wrapper.find('.no-body-padding').length).toBeTruthy();
expect(wrapper.find('.no-header-padding').length).toBeTruthy();
expect(wrapper.render()).toMatchSnapshot();
});

test('Panel overlay is hidden', () => {
wrapper.setProps({
visible: true,
overlay: false,
Expand Down
Loading

0 comments on commit f3ddff5

Please sign in to comment.