Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

chai-dom

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chai-dom - npm Package Compare versions

Comparing version 1.8.1 to 1.8.2

12

chai-dom.js

@@ -346,2 +346,14 @@ (function(chaiDom) {

})
chai.Assertion.addMethod('tagName', function(tagName) {
var el = flag(this, 'object'),
actual = el.tagName;
this.assert(
actual.toUpperCase() === tagName.toUpperCase()
, 'expected ' + elToString(el) + ' to have tagName ' + tagName + ', but it was ' + actual
, 'expected ' + elToString(el) + ' to not have tagName ' + tagName + ', but it was ' + actual
, actual
)
})
}));

3

package.json

@@ -16,3 +16,4 @@ {

],
"version": "1.8.1",
"version": "1.8.2",
"license": "MIT",
"repository": {

@@ -19,0 +20,0 @@ "type": "git",

@@ -167,2 +167,10 @@ # chai-dom

### `tagName(name)`
Assert that the [HTMLElement][] has the given tagName.
```js
document.querySelector('.container').should.have.tagName('div')
expect(document.querySelector('.container')).not.to.have.tagName('span')
```
## Installation

@@ -169,0 +177,0 @@

@@ -859,2 +859,28 @@ describe('DOM assertions', function() {

describe('tagName', function() {
var div = document.createElement('div'),
divWithContent = parse('<div><span>test</span></div>'),
span = parse('<span>Test</span>')
it('passes when the tagName is equal', function() {
div.should.have.tagName('div')
divWithContent.should.have.tagName('div')
span.should.have.tagName('span')
})
it('passes case insensitive', function() {
div.should.have.tagName('DIV')
div.should.have.tagName('diV')
})
it('passes negated', function() {
div.should.not.have.tagName('somethingelse')
span.should.not.have.tagName('div')
})
it('should be chainable', function() {
div.should.have.tagName('div').and.exist.and.be.ok
})
})
describe('util.elToString', function() {

@@ -861,0 +887,0 @@ it('should give a friendly name for a HTMLElement', function() {

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