@@ -68,11 +68,15 @@ describe('Component: pfWizard', function () {
6868
6969 $scope . data = { } ;
7070
71+ $scope . wasNextCalled = false ;
7172 $scope . nextCallback = function ( ) {
73+ $scope . wasNextCalled = true ;
7274 return true ;
7375 } ;
7476
77+ $scope . wasBackCalled = false ;
7578 $scope . backCallback = function ( ) {
79+ $scope . wasBackCalled = true ;
7680 return true ;
7781 } ;
7882
@@ -150,6 +154,23 @@ describe('Component: pfWizard', function () {
150154 expect ( stepIndicator . text ( ) ) . toBe ( '1B.' ) ;
151155 } ) ;
152156
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+
153174 it ( 'should have allowed moving back to first page after input and allowed navigation' , function ( ) {
154175 setupWizard ( 'test/wizard/wizard-container.html' ) ;
155176 var nextButton = element . find ( '.wizard-pf-next' ) ;
0 commit comments