diff --git a/components/lib/button/Button.spec.js b/components/lib/button/Button.spec.js
index 2cd24cc432..4f57fd9bee 100644
--- a/components/lib/button/Button.spec.js
+++ b/components/lib/button/Button.spec.js
@@ -1,8 +1,8 @@
import '@testing-library/jest-dom';
import { fireEvent, render, screen, waitFor } from '@testing-library/react';
-import { Button } from './Button';
-
import { snapshot } from '../../test';
+import PrimeReact from '../api/PrimeReact';
+import { Button } from './Button';
describe('Button', () => {
snapshot(, 'when visible is false Button return null');
@@ -17,6 +17,12 @@ describe('Button', () => {
snapshot(, 'when aria-label prop is not exist aria-label prop should be equal to label prop ');
snapshot(, 'when label prop is not exist label prop should be equal to aria-label prop');
snapshot(, 'when using badge and label the aria-label should contain both values');
+ snapshot(
+ <>
+
+ >,
+ 'when using badge and label the aria-label should contain both values'
+ );
test('when using tooltip make sure the tooltip is rendered', async () => {
// Arrange
const { container } = render();
@@ -51,7 +57,6 @@ describe('Button', () => {
expect(button).toBeEnabled();
expect(clickOn).toHaveBeenCalledTimes(1);
});
-
test('when button is disabled the click event should not fire', () => {
// Arrange
const clickOn = jest.fn();
@@ -65,4 +70,20 @@ describe('Button', () => {
expect(button).toBeDisabled();
expect(clickOn).toHaveBeenCalledTimes(0);
});
+ test('when Ripple is enabled button should have ripple effect', () => {
+ // Arrange
+ const clickOn = jest.fn();
+
+ PrimeReact.ripple = true;
+ const { container } = render();
+ const button = container.getElementsByClassName('p-button')[0];
+
+ // Act
+ fireEvent.click(button);
+
+ // Assert
+ expect(button).toBeEnabled();
+ expect(clickOn).toHaveBeenCalledTimes(1);
+ expect(container).toMatchSnapshot();
+ });
});
diff --git a/components/lib/button/__snapshots__/Button.spec.js.snap b/components/lib/button/__snapshots__/Button.spec.js.snap
index 0e0f2e3e4d..d212210dd9 100644
--- a/components/lib/button/__snapshots__/Button.spec.js.snap
+++ b/components/lib/button/__snapshots__/Button.spec.js.snap
@@ -1,5 +1,23 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
+exports[`Button when Ripple is enabled button should have ripple effect 1`] = `
+
+
+
+`;
+
exports[`Button when aria-label prop is not exist aria-label prop should be equal to label prop 1`] = `