@@ -68,11 +68,15 @@ describe('Component: pfWizard', function () {
68
68
69
69
$scope . data = { } ;
70
70
71
+ $scope . wasNextCalled = false ;
71
72
$scope . nextCallback = function ( ) {
73
+ $scope . wasNextCalled = true ;
72
74
return true ;
73
75
} ;
74
76
77
+ $scope . wasBackCalled = false ;
75
78
$scope . backCallback = function ( ) {
79
+ $scope . wasBackCalled = true ;
76
80
return true ;
77
81
} ;
78
82
@@ -150,6 +154,23 @@ describe('Component: pfWizard', function () {
150
154
expect ( stepIndicator . text ( ) ) . toBe ( '1B.' ) ;
151
155
} ) ;
152
156
157
+ it ( 'should call the next callback and back callback when buttons are clicked' , function ( ) {
158
+ setupWizard ( 'test/wizard/wizard-container.html' ) ;
159
+ var nextButton = element . find ( '.wizard-pf-next' ) ;
160
+ var nameBox = element . find ( '#new-name' ) ;
161
+ nameBox . val ( 'test' ) . triggerHandler ( 'input' ) ;
162
+
163
+ expect ( $scope . wasNextCalled ) . toBe ( false ) ;
164
+ eventFire ( nextButton [ 0 ] , 'click' ) ;
165
+ expect ( $scope . wasNextCalled ) . toBe ( true ) ;
166
+
167
+ var backButton = element . find ( '#backButton' ) ;
168
+
169
+ expect ( $scope . wasBackCalled ) . toBe ( false ) ;
170
+ eventFire ( backButton [ 0 ] , 'click' ) ;
171
+ expect ( $scope . wasBackCalled ) . toBe ( true ) ;
172
+ } ) ;
173
+
153
174
it ( 'should have allowed moving back to first page after input and allowed navigation' , function ( ) {
154
175
setupWizard ( 'test/wizard/wizard-container.html' ) ;
155
176
var nextButton = element . find ( '.wizard-pf-next' ) ;
0 commit comments