Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

expect-html-equal

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

expect-html-equal

Extension to expect to compares two HTML snippets

latest
Source
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source

expect-html-equal

Extension to expect to compares two HTML snippets. It normalizes HTML snippets to be cross-compatible with legacy IE.

Status

npm i --save-dev expect expect-html-equal
var expect = require('expect')
require('expect-html-equal')

it('works', function () {
  var input = '<div class="name">Hello</div>'
  expect(input).toHtmlEqual('<DIV CLASS=name>Hello</DIV>')
})

API:

  • expect(actual).toHtmlEqual(other)
  • expect(actual).toNotHtmlEqual(other)
  • expect(needle).toHtmlInclude(haystack)
  • expect(needle).toHtmlExclude(haystack)
  • expect.normalizeHtml

In node/iojs, it expects a global.document to exist, so you might want to do this in a jsdom environment. (eg, mocha-jsdom)

In the browser, you can use the rawgit CDN (change {VERSION}):

<script src='https://cdn.rawgit.com/mjackson/expect/{VERSION}/dist/expect.min.js'></script>
<script src='https://cdn.rawgit.com/rstacruz/expect-html-equal/{VERSION}/index.js'></script>

Thanks

expect-html-equal © 2015+, Rico Sta. Cruz. Released under the MIT License.
Authored and maintained by Rico Sta. Cruz with help from contributors (list).

ricostacruz.com  ·  GitHub @rstacruz  ·  Twitter @rstacruz

Keywords

dom

FAQs

Package last updated on 06 Jul 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts