describe('invalid html', function () {
var
compareStrings = require('dom-compare').compareStrings,
reporter = require('dom-compare').GroupingReporter,
chai = require('chai'),
assert = chai.assert;
var
DomParser = require('../index.js'),
parser = new DomParser();
it('unclosed tag', function(){
var
invalidHTML =
'
\n' +
'
',
validHTML =
'
\n' +
'
\n' +
'
\n' +
' \n' +
' \n' +
'
\n' +
'
';
var
dom = parser.parseFromString(invalidHTML),
ctn = dom.getElementById('root');
var compareResult = compareStrings(ctn.outerHTML, validHTML);
assert.equal(compareResult.getResult(), true, reporter.report(compareResult));
});
it ('excess closing tag', function(){
var
invalidHTML =
'
\n' +
' \n' +
'
\n' +
' \n' +
' \n' +
' \n' +
'\n'
,
validHTML =
'\n' +
'
\n' +
' \n' +
' \n' +
'
\n' +
' \n' +
' \n' +
'
';
var
dom = parser.parseFromString(invalidHTML),
ctn = dom.getElementById('root');
var compareResult = compareStrings(ctn.outerHTML, validHTML);
assert.equal(compareResult.getResult(), true, reporter.report(compareResult));
});
});