summaryrefslogtreecommitdiffstats
path: root/test/jquery-ui-timepicker-addon_spec.js
diff options
context:
space:
mode:
authorTrent Richardson <trentdrichardson@gmail.com>2014-05-26 15:01:26 -0400
committerTrent Richardson <trentdrichardson@gmail.com>2014-05-26 15:01:26 -0400
commit69348fdf773353b260cf021d237d2f10b08cc511 (patch)
tree04f07b22951107c502265947254250993767cc54 /test/jquery-ui-timepicker-addon_spec.js
parentdbc3869e2ade99bec28054e823b63253a825f7f0 (diff)
parentea8b4103380e1afb1420a77b9411969be0317d22 (diff)
downloadjQuery-Timepicker-Addon-69348fdf773353b260cf021d237d2f10b08cc511.zip
jQuery-Timepicker-Addon-69348fdf773353b260cf021d237d2f10b08cc511.tar.gz
jQuery-Timepicker-Addon-69348fdf773353b260cf021d237d2f10b08cc511.tar.bz2
Merge branch 'dev'
Diffstat (limited to 'test/jquery-ui-timepicker-addon_spec.js')
-rw-r--r--test/jquery-ui-timepicker-addon_spec.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/jquery-ui-timepicker-addon_spec.js b/test/jquery-ui-timepicker-addon_spec.js
index 7da1ecf..b5d8507 100644
--- a/test/jquery-ui-timepicker-addon_spec.js
+++ b/test/jquery-ui-timepicker-addon_spec.js
@@ -661,4 +661,39 @@ describe('datetimepicker', function() {
});
});
});
+
+ describe('altField', function() {
+ var $input;
+ var $altField;
+ var inputFocusSpy;
+
+ beforeEach(function() {
+ $input = affix('input');
+ $altField = affix('input');
+
+ inputFocusSpy = jasmine.createSpy();
+ $input.focus(inputFocusSpy);
+ });
+
+ it('should redirect focus to main field', function() {
+ $input.datetimepicker({
+ showOn: 'button',
+ altField: $altField
+ });
+
+ $altField.trigger('focus');
+ expect(inputFocusSpy).toHaveBeenCalled();
+ });
+
+ it('should not redirect focus to main field if altRedirectFocus is false', function() {
+ $input.datetimepicker({
+ showOn: 'button',
+ altField: $altField,
+ altRedirectFocus: false
+ });
+
+ $altField.trigger('focus');
+ expect(inputFocusSpy).not.toHaveBeenCalled();
+ });
+ });
});