@@ -29,7 +29,7 @@ describe('mdIcon directive', function() {
2929 el = make ( '<md-icon md-font-icon="android"></md-icon>' ) ;
3030
3131 expect ( el . html ( ) ) . toEqual ( '' ) ;
32- expect ( clean ( el . attr ( 'class' ) ) ) . toEqual ( "md-font android" ) ;
32+ expect ( clean ( el . attr ( 'class' ) ) ) . toEqual ( "md-font android material-icons " ) ;
3333
3434 } ) ;
3535
@@ -47,7 +47,13 @@ describe('mdIcon directive', function() {
4747 expect ( el . html ( ) ) . toEqual ( '' ) ;
4848 } ) ;
4949
50- it ( '' , function ( ) {
50+ it ( 'should apply default fontset "material-icons" when not specified.' , function ( ) {
51+ $scope . font = {
52+ name : 'icon-home' ,
53+ color : "#777" ,
54+ size : 48
55+ } ;
56+
5157 el = make ( '\
5258 <md-icon \
5359 md-font-icon="{{ font.name }}" \
@@ -56,20 +62,12 @@ describe('mdIcon directive', function() {
5662 </md-icon> \
5763 ' ) ;
5864
59- $scope . $apply ( function ( ) {
60- $scope . font = {
61- name : 'icon-home' ,
62- color : "#777" ,
63- size : 48
64- } ;
65- } ) ;
66-
6765 expect ( el . attr ( 'md-font-icon' ) ) . toBe ( $scope . font . name ) ;
6866 expect ( el . hasClass ( 'step' ) ) . toBe ( true ) ;
6967 expect ( el . hasClass ( 'material-icons' ) ) . toBe ( true ) ;
7068 expect ( el . attr ( 'aria-label' ) ) . toBe ( $scope . font . name + $scope . font . size ) ;
7169 expect ( el . attr ( 'role' ) ) . toBe ( 'img' ) ;
72- } )
70+ } ) ;
7371
7472 } ) ;
7573
@@ -146,9 +144,9 @@ describe('mdIcon directive', function() {
146144 el = make ( '<md-icon></md-icon>' ) ;
147145 expect ( clean ( el . attr ( 'class' ) ) ) . toEqual ( "fa" ) ;
148146
149- el = make ( '<md-icon>apple</md-icon>' ) ;
147+ el = make ( '<md-icon md-font-icon="fa-apple" >apple</md-icon>' ) ;
150148 expect ( el . text ( ) ) . toEqual ( 'apple' ) ;
151- expect ( clean ( el . attr ( 'class' ) ) ) . toEqual ( "fa" ) ;
149+ expect ( clean ( el . attr ( 'class' ) ) ) . toEqual ( "md-font fa-apple fa" ) ;
152150
153151 } ) ;
154152
@@ -175,22 +173,23 @@ describe('mdIcon directive', function() {
175173 var $q ;
176174
177175 module ( function ( $provide ) {
178- $provide . value ( '$mdIcon' , function $mdIconMock ( id ) {
179-
180- function getIcon ( id ) {
181- switch ( id ) {
182- case 'android' : return '<svg><g id="android"></g></svg>' ;
183- case 'cake' : return '<svg><g id="cake"></g></svg>' ;
184- case 'android.svg' : return '<svg><g id="android"></g></svg>' ;
185- case 'cake.svg' : return '<svg><g id="cake"></g></svg>' ;
186- case 'image:android' : return '' ;
187- }
176+ var $mdIconMock = function ( id ) {
177+ return {
178+ then : function ( fn ) {
179+ switch ( id ) {
180+ case 'android' : fn ( '<svg><g id="android"></g></svg>' ) ;
181+ case 'cake' : fn ( '<svg><g id="cake"></g></svg>' ) ;
182+ case 'android.svg' : fn ( '<svg><g id="android"></g></svg>' ) ;
183+ case 'cake.svg' : fn ( '<svg><g id="cake"></g></svg>' ) ;
184+ case 'image:android' : fn ( '' ) ;
188185 }
189-
190- return $q ( function ( resolve ) {
191- resolve ( getIcon ( id ) ) ;
192- } ) ;
193- } ) ;
186+ }
187+ }
188+ } ;
189+ $mdIconMock . fontSet = function ( ) {
190+ return 'material-icons' ;
191+ } ;
192+ $provide . value ( '$mdIcon' , $mdIconMock ) ;
194193 } ) ;
195194
196195 inject ( function ( $rootScope , _$compile_ , _$q_ ) {
0 commit comments