var expect = require('expect.js'),
fixtures = require('./fixtures'),
$ = require('../');
describe('$', function() {
describe('.html', function() {
it('() : should return innerHTML; $.html(obj) should return outerHTML', function() {
var $div = $('div', '
foobar
');
var span = $div.children()[1];
expect($(span).html()).to.equal('bar');
expect($.html(span)).to.equal('bar');
});
it('() : should accept an object, an array, or a cheerio object', function() {
var $span = $('foo');
expect($.html($span[0])).to.equal('foo');
expect($.html($span)).to.equal('foo');
});
it('() : should be able to set to an empty string', function() {
var $elem = $('foo').html('');
expect($.html($elem)).to.equal('');
});
it('() : of empty cheerio object should return null', function() {
expect($().html()).to.be(null);
});
it('(selector) : should return the outerHTML of the selected element', function() {
var _$ = $.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 = $.load('');
expect($html('body')).to.have.length(1);
$html('