Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions docs/ecosystem-riot-testing-library.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
id: ecosystem-riot-testing-library
title: riot-testing-library
---

[`riot-testing-library`][gh] builds on top of [DOM Testing Library](https://github.com/testing-library/dom-testing-library) by adding APIs for working with [Riot.js](https://riot.js.org/) components.

```
npm install --save-dev riot-testing-library
```

```javascript
import render, { fireEvent } from 'riot-testing-library'
import TestTag from './test.tag'

test('should show count text when rendered', () => {
const { queryByTestId } = render(TestTag, {count: 10});
expect(queryByTestId('count').textContent).toBe("10");
})

test('should add count when click add button text', () => {
const { queryByTestId } = render(TestTag, {count: 1});
expect(queryByTestId('count').textContent).toBe("1");
fireEvent.click(queryByTestId('button'))
expect(queryByTestId('count').textContent).toBe("2");
})
```


- [riot-testing-library on GitHub][gh]

[gh]: https://github.com/ariesjia/riot-testing-library
3 changes: 2 additions & 1 deletion website/sidebars.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@
"ecosystem-bs-jest-dom",
"ecosystem-jest-native",
"ecosystem-react-select-event",
"ecosystem-eslint-plugin-testing-library"
"ecosystem-eslint-plugin-testing-library",
"ecosystem-riot-testing-library"
],
"Help": ["faq", "learning", "contributing"]
},
Expand Down