@@ -541,6 +541,14 @@ describe('$compile', function() {
541
541
replace : true ,
542
542
template : '<tfoot><tr><td>TD</td></tr></tfoot>'
543
543
} ) ) ;
544
+ directive ( 'replaceWithOption' , valueFn ( {
545
+ replace : true ,
546
+ template : '<option>OPTION</option>'
547
+ } ) ) ;
548
+ directive ( 'replaceWithOptgroup' , valueFn ( {
549
+ replace : true ,
550
+ template : '<optgroup>OPTGROUP</optgroup>'
551
+ } ) ) ;
544
552
} ) ) ;
545
553
546
554
@@ -746,6 +754,20 @@ describe('$compile', function() {
746
754
} ) . not . toThrow ( ) ;
747
755
expect ( nodeName_ ( element ) ) . toMatch ( / t f o o t / i) ;
748
756
} ) ) ;
757
+
758
+ it ( 'should support templates with root <option> tags' , inject ( function ( $compile , $rootScope ) {
759
+ expect ( function ( ) {
760
+ element = $compile ( '<div replace-with-option></div>' ) ( $rootScope ) ;
761
+ } ) . not . toThrow ( ) ;
762
+ expect ( nodeName_ ( element ) ) . toMatch ( / o p t i o n / i) ;
763
+ } ) ) ;
764
+
765
+ it ( 'should support templates with root <optgroup> tags' , inject ( function ( $compile , $rootScope ) {
766
+ expect ( function ( ) {
767
+ element = $compile ( '<div replace-with-optgroup></div>' ) ( $rootScope ) ;
768
+ } ) . not . toThrow ( ) ;
769
+ expect ( nodeName_ ( element ) ) . toMatch ( / o p t g r o u p / i) ;
770
+ } ) ) ;
749
771
} ) ;
750
772
751
773
@@ -867,6 +889,14 @@ describe('$compile', function() {
867
889
replace : true ,
868
890
templateUrl : 'tfoot.html'
869
891
} ) ) ;
892
+ directive ( 'replaceWithOption' , valueFn ( {
893
+ replace : true ,
894
+ templateUrl : 'option.html'
895
+ } ) ) ;
896
+ directive ( 'replaceWithOptgroup' , valueFn ( {
897
+ replace : true ,
898
+ templateUrl : 'optgroup.html'
899
+ } ) ) ;
870
900
}
871
901
) ) ;
872
902
@@ -1556,6 +1586,24 @@ describe('$compile', function() {
1556
1586
$rootScope . $digest ( ) ;
1557
1587
expect ( nodeName_ ( element ) ) . toMatch ( / t f o o t / i) ;
1558
1588
} ) ) ;
1589
+
1590
+ it ( 'should support templates with root <option> tags' , inject ( function ( $compile , $rootScope , $templateCache ) {
1591
+ $templateCache . put ( 'option.html' , '<option>OPTION</option>' ) ;
1592
+ expect ( function ( ) {
1593
+ element = $compile ( '<div replace-with-option></div>' ) ( $rootScope ) ;
1594
+ } ) . not . toThrow ( ) ;
1595
+ $rootScope . $digest ( ) ;
1596
+ expect ( nodeName_ ( element ) ) . toMatch ( / o p t i o n / i) ;
1597
+ } ) ) ;
1598
+
1599
+ it ( 'should support templates with root <optgroup> tags' , inject ( function ( $compile , $rootScope , $templateCache ) {
1600
+ $templateCache . put ( 'optgroup.html' , '<optgroup>OPTGROUP</optgroup>' ) ;
1601
+ expect ( function ( ) {
1602
+ element = $compile ( '<div replace-with-optgroup></div>' ) ( $rootScope ) ;
1603
+ } ) . not . toThrow ( ) ;
1604
+ $rootScope . $digest ( ) ;
1605
+ expect ( nodeName_ ( element ) ) . toMatch ( / o p t g r o u p / i) ;
1606
+ } ) ) ;
1559
1607
} ) ;
1560
1608
1561
1609
0 commit comments