@@ -257,6 +257,27 @@ describe( 'AngularWizard', function() {
257257 $timeout . flush ( ) ;
258258 expect ( scope . referenceCurrentStep ) . toEqual ( 'More steps' ) ;
259259 } ) ;
260+ it ( "should go to the next step because the promise that the evaluated string of CANENTER resolves to true" , function ( done ) {
261+ var scope = $rootScope . $new ( ) ;
262+ scope . dynamicStepDisabled = 'Y' ;
263+ var view = createGenericView ( scope ) ;
264+ scope . enterValidation = 'stringEnterValidation()'
265+ scope . stringEnterValidation = function ( ) {
266+ var deferred = $q . defer ( ) ;
267+ $timeout ( function ( ) {
268+ deferred . resolve ( true ) ;
269+ done ( ) ;
270+ } ) ;
271+ return deferred . promise ;
272+ } ;
273+ expect ( scope . referenceCurrentStep ) . toEqual ( 'Starting' ) ;
274+ WizardHandler . wizard ( ) . next ( ) ;
275+ $rootScope . $digest ( ) ;
276+ expect ( scope . referenceCurrentStep ) . toEqual ( 'Continuing' ) ;
277+ WizardHandler . wizard ( ) . next ( ) ;
278+ $timeout . flush ( ) ;
279+ expect ( scope . referenceCurrentStep ) . toEqual ( 'More steps' ) ;
280+ } ) ;
260281 it ( "should go to the next step because CANEXIT is set to true" , function ( ) {
261282 var scope = $rootScope . $new ( ) ;
262283 scope . dynamicStepDisabled = 'Y' ;
@@ -270,6 +291,27 @@ describe( 'AngularWizard', function() {
270291 $rootScope . $digest ( ) ;
271292 expect ( scope . referenceCurrentStep ) . toEqual ( 'More steps' ) ;
272293 } ) ;
294+ it ( "should go to the next step because the promise that the evaluated string of CANEXIT resolves to true" , function ( done ) {
295+ var scope = $rootScope . $new ( ) ;
296+ scope . dynamicStepDisabled = 'Y' ;
297+ var view = createGenericView ( scope ) ;
298+ scope . stepValidation = 'stringStepValidation()'
299+ scope . stringStepValidation = function ( ) {
300+ var deferred = $q . defer ( ) ;
301+ $timeout ( function ( ) {
302+ deferred . resolve ( true ) ;
303+ done ( ) ;
304+ } ) ;
305+ return deferred . promise ;
306+ } ;
307+ expect ( scope . referenceCurrentStep ) . toEqual ( 'Starting' ) ;
308+ WizardHandler . wizard ( ) . next ( ) ;
309+ $rootScope . $digest ( ) ;
310+ expect ( scope . referenceCurrentStep ) . toEqual ( 'Continuing' ) ;
311+ WizardHandler . wizard ( ) . next ( ) ;
312+ $timeout . flush ( ) ;
313+ expect ( scope . referenceCurrentStep ) . toEqual ( 'More steps' ) ;
314+ } ) ;
273315 it ( "should finish" , function ( ) {
274316 var scope = $rootScope . $new ( ) ;
275317 scope . dynamicStepDisabled = 'Y' ;
0 commit comments