forked from carbon-design-system/carbon
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(togglesmallskeleton): add test coverage (carbon-design-system#17674
- Loading branch information
1 parent
561e9eb
commit 09e0b63
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
packages/react/src/components/ToggleSmall/ToggleSmall.skeleton-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
}); | ||
}); |