0.0.21-alpha.0 • Published 11 months ago
@msinnes/dom-testing-library-jest v0.0.21-alpha.0
@msinnes/dom-testing-library-jest
Jest dependent helpers for use in conjunction with @msinnes/dom-testing-library
. The library will not work outside of a jest environment.
Screen Assertions
the render
function in the @msinnes/dom-testing-library
returns a screen objects, and this library adds some jest matching extensions. Matchers can be run against elements on the screen.
- toBeOnScreen
Checks an element against a screen.
const screen = render(/*some application render*/);
const element = screen.getByText('text');
expect(element).toBeOnScreen(screen);
Will pass the assertion if the element is found on the screen, and will throw an assertion error if the element is not found on the screen.
- toHaveAttribute
Checks an html element for an attribute.
const screen = render(/*some application render*/);
const element = screen.getByText('text');
expect(element).toHaveAttribute('class', 'my-class');
- toHaveAttributes
Checks an html element for a map of attributes.
const screen = render(/*some application render*/);
const element = screen.getByText('text');
expect(element).toHaveAttribute({
class: 'my-class',
id: 'element-id',
});
0.0.21-alpha.0
11 months ago
0.0.20-alpha.0
12 months ago
0.0.19-alpha.0
1 year ago
0.0.17-alpha.0
1 year ago
0.0.18-alpha.0
1 year ago
0.0.15-alpha.0
1 year ago
0.0.16-alpha.0
1 year ago
0.0.14-alpha.0
1 year ago
0.0.12-alpha.0
2 years ago
0.0.6-alpha.0
2 years ago
0.0.11-alpha.0
2 years ago
0.0.9-alpha.0
2 years ago
0.0.5-alpha.0
2 years ago
0.0.4-alpha.0
2 years ago