var expect = require('expect.js'),
parse = require('../lib/parse'),
render = require('../lib/render');
var html = function(str, options) {
options = options || {};
var dom = parse(str, options);
return render(dom);
};
describe('render', function() {
describe('(html)', function() {
it('should render tags correctly', function() {
var str = ' ';
expect(html(str)).to.equal(' ');
});
it('should handle double quotes within single quoted attributes properly', function() {
var str = '
';
expect(html(str)).to.equal('');
});
it('should retain encoded HTML content within attributes', function() {
var str = '';
expect(html(str)).to.equal('');
});
it('should shorten the "checked" attribute when it contains the value "checked"', function() {
var str = '';
expect(html(str)).to.equal('');
});
it('should not shorten the "name" attribute when it contains the value "name"', function() {
var str = '';
expect(html(str)).to.equal('');
});
it('should render comments correctly', function() {
var str = '';
expect(html(str)).to.equal('');
});
it('should render whitespace by default', function() {
var str = 'hiblah';
expect(html(str)).to.equal(str);
});
it('should normalize whitespace if specified', function() {
var str = 'hiblah ';
expect(html(str, { normalizeWhitespace: true })).to.equal('hiblah ');
});
it('should preserve multiple hyphens in data attributes', function() {
var str = '';
expect(html(str)).to.equal('');
});
});
});