@@ -529,10 +529,18 @@ describe('$compile', function() {
529
529
replace : true ,
530
530
template : '<th>TH</th>'
531
531
} ) ) ;
532
+ directive ( 'replaceWithThead' , valueFn ( {
533
+ replace : true ,
534
+ template : '<thead><tr><td>TD</td></tr></thead>'
535
+ } ) ) ;
532
536
directive ( 'replaceWithTbody' , valueFn ( {
533
537
replace : true ,
534
538
template : '<tbody><tr><td>TD</td></tr></tbody>'
535
539
} ) ) ;
540
+ directive ( 'replaceWithTfoot' , valueFn ( {
541
+ replace : true ,
542
+ template : '<tfoot><tr><td>TD</td></tr></tfoot>'
543
+ } ) ) ;
536
544
} ) ) ;
537
545
538
546
@@ -718,12 +726,26 @@ describe('$compile', function() {
718
726
expect ( nodeName_ ( element ) ) . toMatch ( / t h / i) ;
719
727
} ) ) ;
720
728
729
+ it ( 'should support templates with root <thead> tags' , inject ( function ( $compile , $rootScope ) {
730
+ expect ( function ( ) {
731
+ element = $compile ( '<div replace-with-thead></div>' ) ( $rootScope ) ;
732
+ } ) . not . toThrow ( ) ;
733
+ expect ( nodeName_ ( element ) ) . toMatch ( / t h e a d / i) ;
734
+ } ) ) ;
735
+
721
736
it ( 'should support templates with root <tbody> tags' , inject ( function ( $compile , $rootScope ) {
722
737
expect ( function ( ) {
723
738
element = $compile ( '<div replace-with-tbody></div>' ) ( $rootScope ) ;
724
739
} ) . not . toThrow ( ) ;
725
740
expect ( nodeName_ ( element ) ) . toMatch ( / t b o d y / i) ;
726
741
} ) ) ;
742
+
743
+ it ( 'should support templates with root <tfoot> tags' , inject ( function ( $compile , $rootScope ) {
744
+ expect ( function ( ) {
745
+ element = $compile ( '<div replace-with-tfoot></div>' ) ( $rootScope ) ;
746
+ } ) . not . toThrow ( ) ;
747
+ expect ( nodeName_ ( element ) ) . toMatch ( / t f o o t / i) ;
748
+ } ) ) ;
727
749
} ) ;
728
750
729
751
@@ -833,10 +855,18 @@ describe('$compile', function() {
833
855
replace : true ,
834
856
templateUrl : 'th.html'
835
857
} ) ) ;
858
+ directive ( 'replaceWithThead' , valueFn ( {
859
+ replace : true ,
860
+ templateUrl : 'thead.html'
861
+ } ) ) ;
836
862
directive ( 'replaceWithTbody' , valueFn ( {
837
863
replace : true ,
838
864
templateUrl : 'tbody.html'
839
865
} ) ) ;
866
+ directive ( 'replaceWithTfoot' , valueFn ( {
867
+ replace : true ,
868
+ templateUrl : 'tfoot.html'
869
+ } ) ) ;
840
870
}
841
871
) ) ;
842
872
@@ -1500,6 +1530,15 @@ describe('$compile', function() {
1500
1530
expect ( nodeName_ ( element ) ) . toMatch ( / t h / i) ;
1501
1531
} ) ) ;
1502
1532
1533
+ it ( 'should support templates with root <thead> tags' , inject ( function ( $compile , $rootScope , $templateCache ) {
1534
+ $templateCache . put ( 'thead.html' , '<thead><tr><td>TD</td></tr></thead>' ) ;
1535
+ expect ( function ( ) {
1536
+ element = $compile ( '<div replace-with-thead></div>' ) ( $rootScope ) ;
1537
+ } ) . not . toThrow ( ) ;
1538
+ $rootScope . $digest ( ) ;
1539
+ expect ( nodeName_ ( element ) ) . toMatch ( / t h e a d / i) ;
1540
+ } ) ) ;
1541
+
1503
1542
it ( 'should support templates with root <tbody> tags' , inject ( function ( $compile , $rootScope , $templateCache ) {
1504
1543
$templateCache . put ( 'tbody.html' , '<tbody><tr><td>TD</td></tr></tbody>' ) ;
1505
1544
expect ( function ( ) {
@@ -1508,6 +1547,15 @@ describe('$compile', function() {
1508
1547
$rootScope . $digest ( ) ;
1509
1548
expect ( nodeName_ ( element ) ) . toMatch ( / t b o d y / i) ;
1510
1549
} ) ) ;
1550
+
1551
+ it ( 'should support templates with root <tfoot> tags' , inject ( function ( $compile , $rootScope , $templateCache ) {
1552
+ $templateCache . put ( 'tfoot.html' , '<tfoot><tr><td>TD</td></tr></tfoot>' ) ;
1553
+ expect ( function ( ) {
1554
+ element = $compile ( '<div replace-with-tfoot></div>' ) ( $rootScope ) ;
1555
+ } ) . not . toThrow ( ) ;
1556
+ $rootScope . $digest ( ) ;
1557
+ expect ( nodeName_ ( element ) ) . toMatch ( / t f o o t / i) ;
1558
+ } ) ) ;
1511
1559
} ) ;
1512
1560
1513
1561
0 commit comments