@@ -35,6 +35,10 @@ describe("alert", function () {
35
35
return element . find ( '.close' ) . eq ( index ) ;
36
36
}
37
37
38
+ function findContent ( index ) {
39
+ return element . find ( 'span' ) . eq ( index ) ;
40
+ }
41
+
38
42
it ( "should generate alerts using ng-repeat" , function ( ) {
39
43
var alerts = createAlerts ( ) ;
40
44
expect ( alerts . length ) . toEqual ( 3 ) ;
@@ -44,11 +48,15 @@ describe("alert", function () {
44
48
var alerts = createAlerts ( ) ;
45
49
expect ( alerts . eq ( 0 ) ) . toHaveClass ( 'alert-success' ) ;
46
50
expect ( alerts . eq ( 1 ) ) . toHaveClass ( 'alert-error' ) ;
51
+ expect ( alerts . eq ( 2 ) ) . toHaveClass ( 'alert-warning' ) ;
52
+ } ) ;
47
53
48
- //defaults
49
- expect ( alerts . eq ( 2 ) ) . toHaveClass ( 'alert' ) ;
50
- expect ( alerts . eq ( 2 ) ) . not . toHaveClass ( 'alert-info' ) ;
51
- expect ( alerts . eq ( 2 ) ) . not . toHaveClass ( 'alert-block' ) ;
54
+ it ( 'should show the alert content' , function ( ) {
55
+ var alerts = createAlerts ( ) ;
56
+
57
+ for ( var i = 0 , n = alerts . length ; i < n ; i ++ ) {
58
+ expect ( findContent ( i ) . text ( ) ) . toBe ( scope . alerts [ i ] . msg ) ;
59
+ }
52
60
} ) ;
53
61
54
62
it ( "should show close buttons" , function ( ) {
@@ -79,7 +87,7 @@ describe("alert", function () {
79
87
expect ( findCloseButton ( 0 ) . css ( 'display' ) ) . toBe ( 'none' ) ;
80
88
} ) ;
81
89
82
- it ( 'it should be possible to add additional classes for alert' , function ( ) {
90
+ it ( 'should be possible to add additional classes for alert' , function ( ) {
83
91
var element = $compile ( '<alert class="alert-block" type="\'info\'">Default alert!</alert>' ) ( scope ) ;
84
92
scope . $digest ( ) ;
85
93
expect ( element ) . toHaveClass ( 'alert-block' ) ;
0 commit comments