1.1.5 • Published 7 years ago

assert-html v1.1.5

Weekly downloads
58
License
MIT
Repository
github
Last release
7 years ago

assert-html stability

npm version build status downloads js-standard-style

Assert two HTML strings are equal. Similar to spok but for HTML. Use assert-snapshot if you want an automated workflow.

Usage

var assertHtml = require('assert-html')
var tape = require('tape')
var html = require('bel')

tape('compare two DOM strings', function (assert) {
  var a, b
  a = html`<section>hello planet</section>`.toString()
  b = html`<section>hello world</section>`.toString()
  assertHtml(assert, a, b)

  a = html`<div><b>hello</b> planet</div>`.toString()
  b = html`<div><b>hello</b> planet</div>`.toString()
  assertHtml(assert, a, b)
  assert.end()
})

Outputs:

TAP version 13
# compare two DOM strings
ok 1 <section>
not ok 2 ·· hello world
  ---
    operator: equal
    expected: '·· hello world'
    actual:   '·· hello planet'
    at: assertHtml (/Users/anon/src/shama/assert-html/index.js:59:13)
  ...
ok 3 </section>
ok 4 <div>
ok 5 ·· <b>
ok 6 ·· ·· hello
ok 7 ·· </b>
ok 8 ·· planet
ok 9 </div>

1..9
# tests 9
# pass  8
# fail  1

API

assertHtml(assert, actual, expected)

Assert two DOM strings are equal using a custom assert function. Calls assert.equal() method from the assert function.

See Also

License

MIT

1.1.5

7 years ago

1.1.4

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago