-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15594 from doutori/feature/add-unittest-snipet-fo…
…r-preact [Documentation] Add an unit test snipet for preact
- Loading branch information
Showing
2 changed files
with
18 additions
and
0 deletions.
There are no files selected for viewing
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,17 @@ | ||
```js | ||
// Button.test.js | ||
|
||
import { h } from 'preact'; | ||
|
||
import { render, screen } from '@testing-library/preact'; | ||
|
||
import '@testing-library/jest-dom/extend-expect'; | ||
|
||
//👇 Imports a specific story for the test | ||
import { Primary } from './Button.stories'; | ||
|
||
it('renders the button in the primary state', () => { | ||
render(<Primary {...Primary.args} />); | ||
expect(screen.getByRole('button')).toHaveTextContent('Primary'); | ||
}); | ||
``` |
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