diff options
author | Trent Richardson <trentdrichardson@gmail.com> | 2014-05-26 15:01:26 -0400 |
---|---|---|
committer | Trent Richardson <trentdrichardson@gmail.com> | 2014-05-26 15:01:26 -0400 |
commit | 69348fdf773353b260cf021d237d2f10b08cc511 (patch) | |
tree | 04f07b22951107c502265947254250993767cc54 /test/jquery-ui-timepicker-addon_spec.js | |
parent | dbc3869e2ade99bec28054e823b63253a825f7f0 (diff) | |
parent | ea8b4103380e1afb1420a77b9411969be0317d22 (diff) | |
download | jQuery-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.js | 35 |
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(); + }); + }); }); |