diff --git a/packages/react-core/src/components/BackgroundImage/__tests__/BackgroundImage.test.tsx b/packages/react-core/src/components/BackgroundImage/__tests__/BackgroundImage.test.tsx
index ddca7b08c6b..5bed2e3e323 100644
--- a/packages/react-core/src/components/BackgroundImage/__tests__/BackgroundImage.test.tsx
+++ b/packages/react-core/src/components/BackgroundImage/__tests__/BackgroundImage.test.tsx
@@ -1,20 +1,34 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
import { BackgroundImage } from '../BackgroundImage';
+import styles from '@patternfly/react-styles/css/components/BackgroundImage/background-image';
-test('has default className and src URL applied to style', () => {
+test(`renders with default className ${styles.backgroundImage}`, () => {
render();
+ expect(screen.getByTestId('test-id')).toHaveClass(styles.backgroundImage, { exact: true });
+});
+
+test('spreads additional props', () => {
+ render();
+ expect(screen.getByTestId('test-id')).toHaveProperty('lang');
+});
- const backgroundImage = screen.getByTestId('test-id');
- const backgroundImageStyle = backgroundImage.getAttribute('style');
+test('has src URL applied to style', () => {
+ render();
- expect(backgroundImage).toHaveClass('pf-v5-c-background-image');
- expect(backgroundImageStyle).toContain('--pf-v5-c-background-image--BackgroundImage');
- expect(backgroundImageStyle).toContain('/image/url.png');
+ expect(screen.getByTestId('test-id')).toHaveAttribute(
+ 'style',
+ '--pf-v5-c-background-image--BackgroundImage: url(/image/url.png);'
+ );
});
-test('has additional className when one is provided', () => {
+test('renders with custom className when one is provided', () => {
render();
expect(screen.getByTestId('test-id')).toHaveClass('another-class');
});
+
+test('Matches the snapshot', () => {
+ const { asFragment } = render();
+ expect(asFragment()).toMatchSnapshot();
+});
diff --git a/packages/react-core/src/components/BackgroundImage/__tests__/__snapshots__/BackgroundImage.test.tsx.snap b/packages/react-core/src/components/BackgroundImage/__tests__/__snapshots__/BackgroundImage.test.tsx.snap
new file mode 100644
index 00000000000..4fba894cd6b
--- /dev/null
+++ b/packages/react-core/src/components/BackgroundImage/__tests__/__snapshots__/BackgroundImage.test.tsx.snap
@@ -0,0 +1,11 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`Matches the snapshot 1`] = `
+
+
+
+`;