@@ -1774,6 +1774,59 @@ describe('$mdDialog', function() {
1774
1774
} ) ;
1775
1775
1776
1776
describe ( 'theming' , function ( ) {
1777
+
1778
+ it ( 'should inherit md-theme if the child has a md-theme to inherit' ,
1779
+ inject ( function ( $mdDialog , $mdTheming , $rootScope , $compile ) {
1780
+
1781
+ var template = '<div id="rawContent">Hello</div>' ;
1782
+ var parent = angular . element ( '<div>' ) ;
1783
+
1784
+ var button = $compile (
1785
+ '<button ng-click="showDialog($event)" md-theme="coolTheme">test</button>'
1786
+ ) ( $rootScope ) ;
1787
+
1788
+ $mdTheming ( button ) ;
1789
+
1790
+ $rootScope . showDialog = function ( ev ) {
1791
+ $mdDialog . show ( {
1792
+ template : template ,
1793
+ parent : parent ,
1794
+ targetEvent : ev
1795
+ } ) ;
1796
+ } ;
1797
+
1798
+ button [ 0 ] . click ( ) ;
1799
+
1800
+ var container = angular . element ( parent [ 0 ] . querySelector ( '.md-dialog-container' ) ) ;
1801
+
1802
+ expect ( container . attr ( 'md-theme' ) ) . toEqual ( 'coolTheme' ) ;
1803
+ } ) ) ;
1804
+
1805
+ it ( 'should not set md-theme if the child does not have md-theme to inherit' ,
1806
+ inject ( function ( $mdDialog , $mdTheming , $rootScope , $compile ) {
1807
+
1808
+ var template = '<div id="rawContent">Hello</div>' ;
1809
+ var parent = angular . element ( '<div>' ) ;
1810
+
1811
+ var button = $compile ( '<button ng-click="showDialog($event)">test</button>' ) ( $rootScope ) ;
1812
+
1813
+ $mdTheming ( button ) ;
1814
+
1815
+ $rootScope . showDialog = function ( ev ) {
1816
+ $mdDialog . show ( {
1817
+ template : template ,
1818
+ parent : parent ,
1819
+ targetEvent : ev
1820
+ } ) ;
1821
+ } ;
1822
+
1823
+ button [ 0 ] . click ( ) ;
1824
+
1825
+ var container = angular . element ( parent [ 0 ] . querySelector ( '.md-dialog-container' ) ) ;
1826
+
1827
+ expect ( container . attr ( 'md-theme' ) ) . toBeUndefined ( ) ;
1828
+ } ) ) ;
1829
+
1777
1830
it ( 'should inherit targetElement theme' , inject ( function ( $mdDialog , $mdTheming , $rootScope , $compile ) {
1778
1831
var template = '<div id="rawContent">Hello</div>' ;
1779
1832
var parent = angular . element ( '<div>' ) ;
0 commit comments