Skip to content

Commit

Permalink
test(togglesmallskeleton): add test coverage (#17674)
Browse files Browse the repository at this point in the history
* test(togglesmallskeleton): add test coverage

* chore: fix copyright date

* chore: fix date
  • Loading branch information
alisonjoseph authored Oct 9, 2024
1 parent debdc21 commit 9a231fa
Showing 1 changed file with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* Copyright IBM Corp. 2016, 2024
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/

import React from 'react';
import { ToggleSmallSkeleton } from './ToggleSmall.Skeleton';
import { render } from '@testing-library/react';

describe('ToggleSmallSkeleton', () => {
it('should support a custom `className` prop on the outermost element', () => {
const { container } = render(
<ToggleSmallSkeleton aria-label="test" className="test" />
);
expect(container.firstChild).toHaveClass('test');
});

it('should spread additional props on the outermost element', () => {
const { container } = render(
<ToggleSmallSkeleton aria-label="test" data-testid="test" />
);
expect(container.firstChild).toHaveAttribute('data-testid', 'test');
});

it('should render the `labelText` prop correctly', () => {
const { getByText } = render(
<ToggleSmallSkeleton aria-label="test" labelText="Toggle Label" />
);
expect(getByText('Toggle Label')).toBeInTheDocument();
});
});

0 comments on commit 9a231fa

Please sign in to comment.