@@ -29,7 +29,7 @@ describe('mdIcon directive', function() {
29
29
el = make ( '<md-icon md-font-icon="android"></md-icon>' ) ;
30
30
31
31
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 " ) ;
33
33
34
34
} ) ;
35
35
@@ -47,7 +47,13 @@ describe('mdIcon directive', function() {
47
47
expect ( el . html ( ) ) . toEqual ( '' ) ;
48
48
} ) ;
49
49
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
+
51
57
el = make ( '\
52
58
<md-icon \
53
59
md-font-icon="{{ font.name }}" \
@@ -56,20 +62,12 @@ describe('mdIcon directive', function() {
56
62
</md-icon> \
57
63
' ) ;
58
64
59
- $scope . $apply ( function ( ) {
60
- $scope . font = {
61
- name : 'icon-home' ,
62
- color : "#777" ,
63
- size : 48
64
- } ;
65
- } ) ;
66
-
67
65
expect ( el . attr ( 'md-font-icon' ) ) . toBe ( $scope . font . name ) ;
68
66
expect ( el . hasClass ( 'step' ) ) . toBe ( true ) ;
69
67
expect ( el . hasClass ( 'material-icons' ) ) . toBe ( true ) ;
70
68
expect ( el . attr ( 'aria-label' ) ) . toBe ( $scope . font . name + $scope . font . size ) ;
71
69
expect ( el . attr ( 'role' ) ) . toBe ( 'img' ) ;
72
- } )
70
+ } ) ;
73
71
74
72
} ) ;
75
73
@@ -146,9 +144,9 @@ describe('mdIcon directive', function() {
146
144
el = make ( '<md-icon></md-icon>' ) ;
147
145
expect ( clean ( el . attr ( 'class' ) ) ) . toEqual ( "fa" ) ;
148
146
149
- el = make ( '<md-icon>apple</md-icon>' ) ;
147
+ el = make ( '<md-icon md-font-icon="fa-apple" >apple</md-icon>' ) ;
150
148
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" ) ;
152
150
153
151
} ) ;
154
152
@@ -175,22 +173,23 @@ describe('mdIcon directive', function() {
175
173
var $q ;
176
174
177
175
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 ( '' ) ;
188
185
}
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 ) ;
194
193
} ) ;
195
194
196
195
inject ( function ( $rootScope , _$compile_ , _$q_ ) {
0 commit comments