@@ -1838,6 +1838,59 @@ describe('$mdDialog', function() {
1838
1838
} ) ;
1839
1839
1840
1840
describe ( 'theming' , function ( ) {
1841
+
1842
+ it ( 'should inherit md-theme if the child has a md-theme to inherit' ,
1843
+ inject ( function ( $mdDialog , $mdTheming , $rootScope , $compile ) {
1844
+
1845
+ var template = '<div id="rawContent">Hello</div>' ;
1846
+ var parent = angular . element ( '<div>' ) ;
1847
+
1848
+ var button = $compile (
1849
+ '<button ng-click="showDialog($event)" md-theme="coolTheme">test</button>'
1850
+ ) ( $rootScope ) ;
1851
+
1852
+ $mdTheming ( button ) ;
1853
+
1854
+ $rootScope . showDialog = function ( ev ) {
1855
+ $mdDialog . show ( {
1856
+ template : template ,
1857
+ parent : parent ,
1858
+ targetEvent : ev
1859
+ } ) ;
1860
+ } ;
1861
+
1862
+ button [ 0 ] . click ( ) ;
1863
+
1864
+ var container = angular . element ( parent [ 0 ] . querySelector ( '.md-dialog-container' ) ) ;
1865
+
1866
+ expect ( container . attr ( 'md-theme' ) ) . toEqual ( 'coolTheme' ) ;
1867
+ } ) ) ;
1868
+
1869
+ it ( 'should not set md-theme if the child does not have md-theme to inherit' ,
1870
+ inject ( function ( $mdDialog , $mdTheming , $rootScope , $compile ) {
1871
+
1872
+ var template = '<div id="rawContent">Hello</div>' ;
1873
+ var parent = angular . element ( '<div>' ) ;
1874
+
1875
+ var button = $compile ( '<button ng-click="showDialog($event)">test</button>' ) ( $rootScope ) ;
1876
+
1877
+ $mdTheming ( button ) ;
1878
+
1879
+ $rootScope . showDialog = function ( ev ) {
1880
+ $mdDialog . show ( {
1881
+ template : template ,
1882
+ parent : parent ,
1883
+ targetEvent : ev
1884
+ } ) ;
1885
+ } ;
1886
+
1887
+ button [ 0 ] . click ( ) ;
1888
+
1889
+ var container = angular . element ( parent [ 0 ] . querySelector ( '.md-dialog-container' ) ) ;
1890
+
1891
+ expect ( container . attr ( 'md-theme' ) ) . toBeUndefined ( ) ;
1892
+ } ) ) ;
1893
+
1841
1894
it ( 'should inherit targetElement theme' , inject ( function ( $mdDialog , $mdTheming , $rootScope , $compile ) {
1842
1895
var template = '<div id="rawContent">Hello</div>' ;
1843
1896
var parent = angular . element ( '<div>' ) ;
0 commit comments