@@ -28,9 +28,10 @@ describe("A Body", function () {
2828 expect ( body . el . tagName ) . toBe ( "TBODY" ) ;
2929 var $trs = body . $el . children ( ) ;
3030 expect ( $trs . length ) . toBe ( 3 ) ;
31- expect ( body . el . innerHTML ) . toBe ( '<tr><td class="integer-cell editable sortable renderable">2</td></tr>' +
32- '<tr><td class="integer-cell editable sortable renderable">1</td></tr>' +
33- '<tr><td class="integer-cell editable sortable renderable">3</td></tr>' ) ;
31+ expect ( $ ( body . el ) . html ( ) . toLowerCase ( ) . replace ( / \s * < / g, '<' ) )
32+ . toBe ( '<tr><td class="integer-cell editable sortable renderable">2</td></tr>' +
33+ '<tr><td class="integer-cell editable sortable renderable">1</td></tr>' +
34+ '<tr><td class="integer-cell editable sortable renderable">3</td></tr>' ) ;
3435 } ) ;
3536
3637 it ( "will render a new row if a new model is added to its collection" , function ( ) {
@@ -39,14 +40,16 @@ describe("A Body", function () {
3940 } ) ;
4041 var $trs = body . $el . children ( ) ;
4142 expect ( $trs . length ) . toBe ( 4 ) ;
42- expect ( $trs [ 3 ] . outerHTML ) . toBe ( '<tr><td class="integer-cell editable sortable renderable">4</td></tr>' ) ;
43+ expect ( $ ( "<div>" ) . append ( $trs . eq ( 3 ) . clone ( ) ) . html ( ) . toLowerCase ( ) . replace ( / \s * < / g, '<' ) )
44+ . toBe ( '<tr><td class="integer-cell editable sortable renderable">4</td></tr>' ) ;
4345
4446 body . collection . add ( {
4547 id : 5
4648 } , { at : 1 } ) ;
4749 $trs = body . $el . children ( ) ;
4850 expect ( $trs . length ) . toBe ( 5 ) ;
49- expect ( $trs [ 1 ] . outerHTML ) . toBe ( '<tr><td class="integer-cell editable sortable renderable">5</td></tr>' ) ;
51+ expect ( $ ( "<div>" ) . append ( $trs . eq ( 1 ) . clone ( ) ) . html ( ) . toLowerCase ( ) . replace ( / \s * < / g, '<' ) )
52+ . toBe ( '<tr><td class="integer-cell editable sortable renderable">5</td></tr>' ) ;
5053 } ) ;
5154
5255 it ( "will render a new row by calling insertRow directly with a new model" , function ( ) {
@@ -67,32 +70,36 @@ describe("A Body", function () {
6770
6871 var $trs = body . $el . children ( ) ;
6972 expect ( $trs . length ) . toBe ( 1 ) ;
70- expect ( $trs [ 0 ] . outerHTML ) . toBe ( '<tr><td class="integer-cell editable sortable renderable">4</td></tr>' ) ;
73+ expect ( $ ( "<div>" ) . append ( $trs . eq ( 0 ) . clone ( ) ) . html ( ) . toLowerCase ( ) . replace ( / \s * < / g, '<' ) )
74+ . toBe ( '<tr><td class="integer-cell editable sortable renderable">4</td></tr>' ) ;
7175
7276 body . insertRow ( {
7377 id : 5
7478 } , { at : 0 } ) ;
7579 $trs = body . $el . children ( ) ;
7680 expect ( $trs . length ) . toBe ( 2 ) ;
77- expect ( $trs [ 0 ] . outerHTML ) . toBe ( '<tr><td class="integer-cell editable sortable renderable">5</td></tr>' ) ;
81+ expect ( $ ( "<div>" ) . append ( $trs . eq ( 0 ) . clone ( ) ) . html ( ) . toLowerCase ( ) . replace ( / \s * < / g, '<' ) )
82+ . toBe ( '<tr><td class="integer-cell editable sortable renderable">5</td></tr>' ) ;
7883 } ) ;
7984
8085 it ( "will remove a row from the DOM if a model is removed from its collection" , function ( ) {
8186 var m1 = body . collection . at ( 1 ) ;
8287 body . collection . remove ( m1 ) ;
8388 var $trs = body . $el . children ( ) ;
8489 expect ( $trs . length ) . toBe ( 2 ) ;
85- expect ( body . el . innerHTML ) . toBe ( '<tr><td class="integer-cell editable sortable renderable">2</td></tr>' +
86- '<tr><td class="integer-cell editable sortable renderable">3</td></tr>' ) ;
90+ expect ( $ ( body . el ) . html ( ) . toLowerCase ( ) . replace ( / \s + < / g, '<' ) )
91+ . toBe ( '<tr><td class="integer-cell editable sortable renderable">2</td></tr>' +
92+ '<tr><td class="integer-cell editable sortable renderable">3</td></tr>' ) ;
8793 } ) ;
8894
8995 it ( "will remove a row from the DOM is removeRow is called directly with a model" , function ( ) {
9096 var m1 = body . collection . at ( 1 ) ;
9197 body . removeRow ( m1 ) ;
9298 var $trs = body . $el . children ( ) ;
9399 expect ( $trs . length ) . toBe ( 2 ) ;
94- expect ( body . el . innerHTML ) . toBe ( '<tr><td class="integer-cell editable sortable renderable">2</td></tr>' +
95- '<tr><td class="integer-cell editable sortable renderable">3</td></tr>' ) ;
100+ expect ( $ ( body . el ) . html ( ) . toLowerCase ( ) . replace ( / \s + < / g, '<' ) )
101+ . toBe ( '<tr><td class="integer-cell editable sortable renderable">2</td></tr>' +
102+ '<tr><td class="integer-cell editable sortable renderable">3</td></tr>' ) ;
96103 } ) ;
97104
98105 it ( "will refresh if its collection is reset" , function ( ) {
@@ -108,7 +115,8 @@ describe("A Body", function () {
108115 expect ( eventFired ) . toBe ( true ) ;
109116 var $trs = body . $el . children ( ) ;
110117 expect ( $trs . length ) . toBe ( 1 ) ;
111- expect ( body . el . innerHTML ) . toBe ( '<tr><td class="integer-cell editable sortable renderable">6</td></tr>' ) ;
118+ expect ( $ ( body . el ) . html ( ) . toLowerCase ( ) . replace ( / \s + < / g, '<' ) )
119+ . toBe ( '<tr><td class="integer-cell editable sortable renderable">6</td></tr>' ) ;
112120 } ) ;
113121
114122 it ( "will render rows using the Row class supplied in the constructor options" , function ( ) {
@@ -265,11 +273,11 @@ describe("A Body", function () {
265273 body . collection . trigger ( "backgrid:sort" , body . columns . at ( 0 ) , "ascending" ) ;
266274 expect ( body . collection . toJSON ( ) ) . toEqual ( [ { id : 1 } , { id : 2 } , { id : 3 } ] ) ;
267275 expect ( body . columns . at ( 0 ) . get ( "direction" ) , "ascending" ) ;
268-
276+
269277 body . collection . trigger ( "backgrid:sort" , body . columns . at ( 0 ) , "descending" ) ;
270278 expect ( body . collection . toJSON ( ) ) . toEqual ( [ { id : 3 } , { id : 2 } , { id : 1 } ] ) ;
271279 expect ( body . columns . at ( 0 ) . get ( "direction" ) , "descending" ) ;
272-
280+
273281 col . at ( 0 ) . cid = "c100" ;
274282 col . at ( 1 ) . cid = "c1" ;
275283 col . at ( 2 ) . cid = "c10" ;
0 commit comments