1
- describe ( 'mdIcon directive' , function ( ) {
1
+ ddescribe ( 'mdIcon directive' , function ( ) {
2
2
var el ;
3
3
var $scope ;
4
4
var $compile ;
@@ -11,6 +11,7 @@ describe('mdIcon directive', function() {
11
11
} ) ) ;
12
12
afterEach ( function ( ) {
13
13
$mdIconProvider . defaultFontSet ( 'material-icons' ) ;
14
+ $mdIconProvider . fontSet ( 'fa' , 'fa' ) ;
14
15
} ) ;
15
16
16
17
@@ -21,6 +22,7 @@ describe('mdIcon directive', function() {
21
22
$compile = _$compile_ ;
22
23
} ) ) ;
23
24
25
+
24
26
describe ( 'using font-icons with deprecated md-font-icon=""' , function ( ) {
25
27
26
28
it ( 'should render correct HTML with md-font-icon value as class' , function ( ) {
@@ -64,7 +66,7 @@ describe('mdIcon directive', function() {
64
66
65
67
expect ( el . attr ( 'md-font-icon' ) ) . toBe ( $scope . font . name ) ;
66
68
expect ( el . hasClass ( 'step' ) ) . toBe ( true ) ;
67
- expect ( el . hasClass ( 'material-icons' ) ) . toBe ( true ) ;
69
+ expect ( el . hasClass ( 'material-icons' ) ) . toBe ( false ) ;
68
70
expect ( el . attr ( 'aria-label' ) ) . toBe ( $scope . font . name + $scope . font . size ) ;
69
71
expect ( el . attr ( 'role' ) ) . toBe ( 'img' ) ;
70
72
} )
@@ -77,7 +79,7 @@ describe('mdIcon directive', function() {
77
79
el = make ( '<md-icon class="md-48">face</md-icon>' ) ;
78
80
79
81
expect ( el . text ( ) ) . toEqual ( 'face' ) ;
80
- expect ( el . hasClass ( 'material-icons' ) ) . toBeTruthy ( ) ;
82
+ expect ( el . hasClass ( 'material-icons' ) ) . toBeFalsy ( ) ;
81
83
expect ( el . hasClass ( 'md-48' ) ) . toBeTruthy ( ) ;
82
84
} ) ;
83
85
@@ -90,6 +92,15 @@ describe('mdIcon directive', function() {
90
92
expect ( clean ( el . attr ( 'class' ) ) ) . toEqual ( "fontawesome" ) ;
91
93
} ) ;
92
94
95
+
96
+ it ( 'should render correctly using a md-font-set alias' , function ( ) {
97
+ el = make ( '<md-icon md-font-set="fa" md-font-icon="fa-info"></md-icon>' ) ;
98
+
99
+ expect ( clean ( el . attr ( 'class' ) ) ) . toEqual ( "md-font fa-info fa" ) ;
100
+ } ) ;
101
+
102
+
103
+
93
104
it ( 'should render correctly using md-font-set value as class' , function ( ) {
94
105
95
106
el = make ( '<md-icon md-font-set="fontawesome">email</md-icon>' ) ;
@@ -101,11 +112,19 @@ describe('mdIcon directive', function() {
101
112
102
113
describe ( 'using font-icons with classnames' , function ( ) {
103
114
115
+ it ( 'should auto-add the material-icons style' , function ( ) {
116
+ el = make ( '<md-icon>apple</md-icon>' ) ;
117
+
118
+ expect ( el . text ( ) ) . toEqual ( 'apple' ) ;
119
+ expect ( el . hasClass ( 'material-icons' ) ) . toBeTruthy ( ) ;
120
+ } ) ;
121
+
122
+
104
123
it ( 'should render with icon classname' , function ( ) {
105
124
el = make ( '<md-icon class="custom-cake"></md-icon>' ) ;
106
125
107
126
expect ( el . text ( ) ) . toEqual ( '' ) ;
108
- expect ( el . hasClass ( 'material-icons' ) ) . toBeTruthy ( ) ;
127
+ expect ( el . hasClass ( 'material-icons' ) ) . toBeFalsy ( ) ;
109
128
expect ( el . hasClass ( 'custom-cake' ) ) . toBeTruthy ( ) ;
110
129
} ) ;
111
130
0 commit comments