Skip to content

Commit

Permalink
add test spec for HTMLHint.format
Browse files Browse the repository at this point in the history
  • Loading branch information
yaniswang committed Oct 11, 2015
1 parent a02384e commit 189f0fd
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion test/core-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,23 @@ describe('Core', function(){
expect(messages.length).to.be(0);
});

});
it('Show formated result should not result in an error', function(){
var code = 'tttttttttttttttttttttttttttttttttttt<div>中文<img src="test.gif" />tttttttttttttttttttttttttttttttttttttttttttttt';
var messages = HTMLHint.verify(code, {
'tag-pair': true,
'alt-require': true
});
var arrLogs = HTMLHint.format(messages);
expect(arrLogs.length).to.be(4);

arrLogs = HTMLHint.format(messages, {
colors: true,
indent: 4
});
var log = arrLogs[0];
expect(/\[37m/.test(log)).to.be(true);
expect(/ L1 /.test(log)).to.be(true);
expect(/|\.\.\./.test(log)).to.be(true);
expect(/t\.\.\./.test(log)).to.be(true);
});
});

0 comments on commit 189f0fd

Please sign in to comment.