@@ -103,18 +103,42 @@ describe('External Links Data Directive', function() {
103
103
expect ( element . isolateScope ( ) . linkedAccountsData ) . to . have . length ( 8 ) ;
104
104
} ) ;
105
105
106
- it ( 'should mark the account for deletion and open the popup ' , function ( ) {
107
- var account = { key : 'somekey' , provider : 'stackoverflow ' } ;
106
+ it ( 'should open the confirmation popup ' , function ( ) {
107
+ var account = { key : 'somekey' , provider : 'weblink ' } ;
108
108
element . isolateScope ( ) . confirmDeletion ( account ) ;
109
109
scope . $digest ( ) ;
110
110
// should open the popup
111
111
expect ( ngDialogSvc . open ) . to . be . called ;
112
- // should not remove anythign from the array of accounts/links
112
+ // should not remove anything from the array of accounts/links
113
113
expect ( element . isolateScope ( ) . linkedAccountsData ) . to . have . length ( 8 ) ;
114
114
// $scope.deletionDialog should exist
115
115
expect ( element . isolateScope ( ) . deletionDialog ) . to . exist ;
116
116
ngDialogSvc . close ( ) ;
117
117
} ) ;
118
118
119
+ it ( 'should NOT open the popup for pending state card ' , function ( ) {
120
+ var account = { key : 'somekey' , provider : 'weblink' , status : 'PENDING' } ;
121
+ element . isolateScope ( ) . confirmDeletion ( account ) ;
122
+ scope . $digest ( ) ;
123
+ // should NOT open the popup
124
+ expect ( ngDialogSvc . open ) . not . to . be . called ;
125
+ // should not remove anything from the array of accounts/links
126
+ expect ( element . isolateScope ( ) . linkedAccountsData ) . to . have . length ( 8 ) ;
127
+ // $scope.deletionDialog should not exist
128
+ expect ( element . isolateScope ( ) . deletionDialog ) . not . to . exist ;
129
+ } ) ;
130
+
131
+ it ( 'should NOT open the popup for non weblink external link ' , function ( ) {
132
+ var account = { key : 'somekey' , provider : 'stackoverflow' } ;
133
+ element . isolateScope ( ) . confirmDeletion ( account ) ;
134
+ scope . $digest ( ) ;
135
+ // should NOT open the popup
136
+ expect ( ngDialogSvc . open ) . not . to . be . called ;
137
+ // should not remove anything from the array of accounts/links
138
+ expect ( element . isolateScope ( ) . linkedAccountsData ) . to . have . length ( 8 ) ;
139
+ // $scope.deletionDialog should not exist
140
+ expect ( element . isolateScope ( ) . deletionDialog ) . not . to . exist ;
141
+ } ) ;
142
+
119
143
} ) ;
120
144
} ) ;
0 commit comments