expect-html-equal
Extension to expect to compares two HTML snippets
Last updated 5 years ago by rstacruz .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install expect-html-equal 
SYNC missed versions from official npm registry.

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

Current Tags

  • 1.1.0                                ...           latest (5 years ago)

3 Versions

  • 1.1.0                                ...           5 years ago
  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (5)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |