Skip to content

Commit

Permalink
Adding default placement and testing.
Browse files Browse the repository at this point in the history
  • Loading branch information
bapplejax committed Dec 27, 2024
1 parent b71acaa commit 6248f68
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ Default.args = {
id: 'toast-info',
message: 'This is a toast notification',
type: 'info',
placement: 'topRight',
duration: 3000,
allowClose: true,
};
26 changes: 26 additions & 0 deletions packages/comet-extras/src/components/toast/toast.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,32 @@ describe('Toast Component Tests', () => {
expect(container.querySelector('#test-toast')).toHaveClass('toast--info');
});

test('should render a Toast notification from the top left', () => {
const { container } = render(
<Toast
id="test-toast"
placement="topLeft"
message="Testing message for notification"
type="info"
/>,
);
expect(container.querySelector('#test-toast')).toBeTruthy();
expect(container.querySelector('#test-toast')).toHaveClass('toast--topLeft');
});

test('should render a Toast notification from the bottom right', () => {
const { container } = render(
<Toast
id="test-toast"
placement="bottomRight"
message="Testing message for notification"
type="info"
/>,
);
expect(container.querySelector('#test-toast')).toBeTruthy();
expect(container.querySelector('#test-toast')).toHaveClass('toast--bottomRight');
});

test('should render a warning Toast notification', () => {
const { container } = render(
<Toast id="test-toast" message="Testing message for notification" type="warning" />,
Expand Down

0 comments on commit 6248f68

Please sign in to comment.