Socket
Socket
Sign inDemoInstall

@testing-library/jest-dom

Package Overview
Dependencies
Maintainers
12
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@testing-library/jest-dom - npm Package Compare versions

Comparing version 5.7.0 to 5.8.0

dist/to-be-partially-checked.js

8

dist/matchers.js

@@ -126,2 +126,8 @@ "use strict";

});
Object.defineProperty(exports, "toBePartiallyChecked", {
enumerable: true,
get: function () {
return _toBePartiallyChecked.toBePartiallyChecked;
}
});
Object.defineProperty(exports, "toHaveDescription", {

@@ -170,2 +176,4 @@ enumerable: true,

var _toBePartiallyChecked = require("./to-be-partially-checked");
var _toHaveDescription = require("./to-have-description");

2

package.json
{
"name": "@testing-library/jest-dom",
"version": "5.7.0",
"version": "5.8.0",
"description": "Custom jest matchers to test the state of the DOM",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -49,3 +49,2 @@ <div align="center">

- [Installation](#installation)

@@ -73,2 +72,3 @@ - [Usage](#usage)

- [`toBeChecked`](#tobechecked)
- [`toBePartiallyChecked`](#tobepartiallychecked)
- [`toHaveDescription`](#tohavedescription)

@@ -900,2 +900,48 @@ - [Deprecated matchers](#deprecated-matchers)

### `toBePartiallyChecked`
```typescript
toBePartiallyChecked()
```
This allows you to check whether the given element is partially checked. It
accepts an `input` of type `checkbox` and elements with a `role` of `checkbox`
with a `aria-checked="mixed"`, or `input` of type `checkbox` with
`indeterminate` set to `true`
#### Examples
```html
<input type="checkbox" aria-checked="mixed" data-testid="aria-checkbox-mixed" />
<input type="checkbox" checked data-testid="input-checkbox-checked" />
<input type="checkbox" data-testid="input-checkbox-unchecked" />
<div role="checkbox" aria-checked="true" data-testid="aria-checkbox-checked" />
<div
role="checkbox"
aria-checked="false"
data-testid="aria-checkbox-unchecked"
/>
<input type="checkbox" data-testid="input-checkbox-indeterminate" />
```
```javascript
const ariaCheckboxMixed = getByTestId('aria-checkbox-mixed')
const inputCheckboxChecked = getByTestId('input-checkbox-checked')
const inputCheckboxUnchecked = getByTestId('input-checkbox-unchecked')
const ariaCheckboxChecked = getByTestId('aria-checkbox-checked')
const ariaCheckboxUnchecked = getByTestId('aria-checkbox-unchecked')
const inputCheckboxIndeterminate = getByTestId('input-checkbox-indeterminate')
expect(ariaCheckboxMixed).toBePartiallyChecked()
expect(inputCheckboxChecked).not.toBePartiallyChecked()
expect(inputCheckboxUnchecked).not.toBePartiallyChecked()
expect(ariaCheckboxChecked).not.toBePartiallyChecked()
expect(ariaCheckboxUnchecked).not.toBePartiallyChecked()
inputCheckboxIndeterminate.indeterminate = true
expect(inputCheckboxIndeterminate).toBePartiallyChecked()
```
<hr />
### `toHaveDescription`

@@ -902,0 +948,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc