@@ -47,12 +47,19 @@ describe('\'isEqual\'', function () {
4747 } ) ;
4848
4949 it ( 'must sort values of attributes as JSON when the content is not a function' , function ( ) {
50- var htmlDiffer = new HtmlDiffer ( { compareAttributesAsJSON : [ 'a' , { name : 'b' , isFunction : false } ] } ) ,
50+ var htmlDiffer = new HtmlDiffer ( { compareAttributesAsJSON : [ 'a' , { name : 'b' , isFunction : false } ] } ) ,
5151 files = readFiles ( 'sort-values-in-json-format' ) ;
5252
5353 htmlDiffer . isEqual ( files . html1 , files . html2 ) . must . be . true ( ) ;
5454 } ) ;
5555
56+ it ( 'must handle invalid JSON' , function ( ) {
57+ var htmlDiffer = new HtmlDiffer ( { compareAttributesAsJSON : [ 'data-bem' ] } ) ,
58+ files = readFiles ( 'invalid-json' ) ;
59+
60+ htmlDiffer . isEqual ( files . html1 , files . html2 ) . must . be . true ( ) ;
61+ } ) ;
62+
5663 it ( 'must sort values of attributes as JSON when the content is a function' , function ( ) {
5764 var options = {
5865 compareAttributesAsJSON : [
@@ -66,6 +73,14 @@ describe('\'isEqual\'', function () {
6673 htmlDiffer . isEqual ( files . html1 , files . html2 ) . must . be . true ( ) ;
6774 } ) ;
6875
76+ it ( 'must handle invalid function' , function ( ) {
77+ var options = { compareAttributesAsJSON : [ { name : 'onclick' , isFunction : true } ] } ,
78+ htmlDiffer = new HtmlDiffer ( options ) ,
79+ files = readFiles ( 'invalid-function' ) ;
80+
81+ htmlDiffer . isEqual ( files . html1 , files . html2 ) . must . be . true ( ) ;
82+ } ) ;
83+
6984 it ( 'must work option \'ignoreAttributes\'' , function ( ) {
7085 var htmlDiffer = new HtmlDiffer ( { ignoreAttributes : [ 'id' , 'for' ] } ) ,
7186 files = readFiles ( 'ignore-attributes' ) ;
0 commit comments