var expect = require('expect.js'),
fixtures = require('../fixtures'),
cheerio = require('../..');
describe('cheerio', function() {
describe('.html', function() {
it('() : should return innerHTML; $.html(obj) should return outerHTML', function() {
var $div = cheerio('div', '
foobar
');
var span = $div.children()[1];
expect(cheerio(span).html()).to.equal('bar');
expect(cheerio.html(span)).to.equal('bar');
});
it('() : should accept an object, an array, or a cheerio object', function() {
var $span = cheerio('foo');
expect(cheerio.html($span[0])).to.equal('foo');
expect(cheerio.html($span)).to.equal('foo');
});
it('() : should be able to set to an empty string', function() {
var $elem = cheerio('foo').html('');
expect(cheerio.html($elem)).to.equal('');
});
it('() : of empty cheerio object should return null', function() {
expect(cheerio().html()).to.be(null);
});
it('(selector) : should return the outerHTML of the selected element', function() {
var $ = cheerio.load(fixtures.fruits);
expect($.html('.pear')).to.equal('Pear');
});
});
describe('.load', function() {
it('(html) : should retain original root after creating a new node', function() {
var $html = cheerio.load('');
expect($html('body')).to.have.length(1);
$html('