Installations
npm install expect-element
Developer Guide
Typescript
No
Module System
CommonJS, UMD
Node Version
5.3.0
NPM Version
3.3.12
Score
69.7
Supply Chain
98.4
Quality
74.4
Maintenance
100
Vulnerability
100
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
mjackson
Download Statistics
Total Downloads
69,589
Last Day
1
Last Week
5
Last Month
21
Last Year
1,657
GitHub Statistics
61 Stars
48 Commits
2 Forks
3 Watching
192 Branches
3 Contributors
Bundle Size
26.03 kB
Minified
6.46 kB
Minified + Gzipped
Package Meta Information
Latest Version
1.1.1
Package Id
expect-element@1.1.1
Size
18.70 kB
NPM Version
3.3.12
Node Version
5.3.0
Total Downloads
Cumulative downloads
Total Downloads
69,589
Last day
0%
1
Compared to previous day
Last week
25%
5
Compared to previous week
Last month
-89.5%
21
Compared to previous month
Last year
457.9%
1,657
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Peer Dependencies
1
expect-element
![npm package](https://img.shields.io/npm/v/expect-element.svg?style=flat-square)
expect-element is an extension for expect that lets you write better assertions for DOM nodes.
Installation
Using npm:
$ npm install --save expect expect-element
Then, use as you would anything else:
1// using an ES6 transpiler, like babel 2import expect from 'expect' 3import expectElement from 'expect-element' 4expect.extend(expectElement) 5 6// not using an ES6 transpiler 7var expect = require('expect') 8var expectElement = require('expect-element') 9expect.extend(expectElement)
The UMD build is also available on npmcdn:
1<script src="https://npmcdn.com/expect-element/umd/expect-element.min.js"></script>
You can find the library on window.expectElement
.
Assertions
toHaveAttribute
expect(element).toHaveAttribute(name, [value, [message]])
Asserts the given DOM element
has an attribute with the given name
. If value
is given, asserts the value of the attribute as well.
1expect(element).toHaveAttribute('id') 2expect(element).toHaveAttribute('id', 'an-id')
toNotHaveAttribute
expect(object).toNotHaveAttribute(name, [value, [message]])
Asserts the given DOM element
does not have an attribute with the given name
. If value
is given, asserts the value of the attribute as well.
1expect(element).toNotHaveAttribute('id') 2expect(element).toNotHaveAttribute('id', 'an-id')
toHaveAttributes
expect(element).toHaveAttribute(attributes, [message])
Asserts the given DOM element
has attributes with the names and values in attributes
.
1expect(element).toHaveAttributes({
2 id: 'an-id',
3 'class': 'a-class'
4})
toNotHaveAttributes
expect(element).toNotHaveAttribute(attributes, [message])
Asserts the given DOM element
does not have attributes with the names and values in attributes
.
1expect(element).toNotHaveAttributes({
2 id: 'an-id',
3 'class': 'a-class'
4})
toHaveText
expect(element).toHaveText(text, [message])
Asserts the textContent
of the given DOM element
is text
.
1expect(element).toHaveText('hello world')
toNotHaveText
expect(element).toNotHaveText(text, [message])
Asserts the textContent
of the given DOM element
is not text
.
1expect(element).toNotHaveText('hello world')
![Empty State](/_next/static/media/empty.e5fae2e5.png)
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
Found 4/24 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
license file not detected
Details
- Warn: project does not have a license file
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 10 are checked with a SAST tool
Score
2.7
/10
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More