diff options
author | Trent Richardson <trentdrichardson@gmail.com> | 2013-12-20 16:46:37 -0500 |
---|---|---|
committer | Trent Richardson <trentdrichardson@gmail.com> | 2013-12-20 16:46:37 -0500 |
commit | bdb22f5fd085a3240f85ffda98bc9abea272c113 (patch) | |
tree | 29c944578be2d14c6fadcc5d94ae29ed9232f3c2 /src | |
parent | 655a8ec0ed0024dea3d4bc87f70e6885a6ea9071 (diff) | |
download | jQuery-Impromptu-bdb22f5fd085a3240f85ffda98bc9abea272c113.zip jQuery-Impromptu-bdb22f5fd085a3240f85ffda98bc9abea272c113.tar.gz jQuery-Impromptu-bdb22f5fd085a3240f85ffda98bc9abea272c113.tar.bz2 |
Adds some Jasmine testing
Diffstat (limited to 'src')
-rw-r--r-- | src/jquery-impromptu.js | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/src/jquery-impromptu.js b/src/jquery-impromptu.js index 09f0ffe..f84cc01 100644 --- a/src/jquery-impromptu.js +++ b/src/jquery-impromptu.js @@ -54,6 +54,7 @@ buttons: opts.buttons,
position: opts.position,
focus: opts.focus,
+ defaultButton: opts.defaultButton,
submit: opts.submit
}
};
@@ -458,7 +459,7 @@ state += '" name="' + opts.prefix + '_' + statename + '_button' + v.title.replace(/[^a-z0-9]+/gi,'') + '" id="' + opts.prefix + '_' + statename + '_button' + v.title.replace(/[^a-z0-9]+/gi,'') + '" value="' + v.value + '">' + v.title + '</button>';
} else {
- state += '<button class="'+ $.prompt.currentPrefix + 'button '+ opts.classes.button +' '+ defbtn +'" name="' + opts.prefix + '_' + statename + '_button' + k + '" id="' + opts.prefix + '_' + statename + '_button' + k + '" value="' + v + '">' + k + '</button>';
+ state += '<button class="'+ $.prompt.currentPrefix + 'button '+ opts.classes.button +' '+ defbtn +'" name="' + opts.prefix + '_' + statename + '_button' + k.replace(/[^a-z0-9]+/gi,'') + '" id="' + opts.prefix + '_' + statename + '_button' + k.replace(/[^a-z0-9]+/gi,'') + '" value="' + v + '">' + k + '</button>';
}
i++;
@@ -618,7 +619,10 @@ */
$.prompt.nextState = function(callback) {
var $next = $('#'+ $.prompt.currentPrefix +'state_'+ $.prompt.getCurrentStateName()).next();
- return $.prompt.goToState( $next.attr('id').replace($.prompt.currentPrefix +'state_',''), callback );
+ if($next.length > 0){
+ $.prompt.goToState( $next.attr('id').replace($.prompt.currentPrefix +'state_',''), callback );
+ }
+ return $next;
};
/**
@@ -628,7 +632,10 @@ */
$.prompt.prevState = function(callback) {
var $prev = $('#'+ $.prompt.currentPrefix +'state_'+ $.prompt.getCurrentStateName()).prev();
- $.prompt.goToState( $prev.attr('id').replace($.prompt.currentPrefix +'state_',''), callback );
+ if($prev.length > 0){
+ $.prompt.goToState( $prev.attr('id').replace($.prompt.currentPrefix +'state_',''), callback );
+ }
+ return $prev;
};
/**
@@ -645,15 +652,17 @@ $.prompt.timeout = false;
}
- $.prompt.jqib.fadeOut('fast',function(){
+ if($.prompt.jqib){
+ $.prompt.jqib.fadeOut('fast',function(){
- if(callCallback) {
- $.prompt.jqib.trigger('impromptu:close', [clicked,msg,formvals]);
- }
- $.prompt.jqib.remove();
-
- $(window).off('resize',$.prompt.position);
- });
+ if(callCallback) {
+ $.prompt.jqib.trigger('impromptu:close', [clicked,msg,formvals]);
+ }
+ $.prompt.jqib.remove();
+
+ $(window).off('resize',$.prompt.position);
+ });
+ }
};
/**
|