/* eslint-env jest */
import wrapify from '../index'
import $ from 'jquery'
it('simple usage', run(`
simple usage
install
(install)
usage
(usage)
`, $div => {
expect($div.find('.h2-section .h3-section-list .h3-section').length).toEqual(2)
}))
it('h3 with class', run(`
`, $div => {
expect($div.find('div.h3-section.-hello').length).toEqual(1)
expect($div.find('div.h3-section-list.-hello').length).toEqual(1)
}))
it('multiple h2s', run(`
multiple h2
install
(install)
usage
(usage)
getting started
first
(first)
second
(second)
`))
it('h2 + pre', run(`
`))
it('versus mode', run(`
versus
install
(install)
usage
(usage)
`, $div => {
expect($div.find('h2 + div.body.-versus').length).toEqual(1)
}))
/*
* Helper
*/
function run (input, fn) {
return function () {
const $div = $(input)
wrapify($div[0])
expect($div[0]).toMatchSnapshot()
if (fn) fn($div)
}
}