Skip to content

Commit a5537b4

Browse files
committed
Add test for altField focus redirection
1 parent e806222 commit a5537b4

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

test/.jshintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"jQuery",
1616
"$",
1717
"QUnit",
18+
"jasmine",
1819
"module",
1920
"test",
2021
"asyncTest",

test/jquery-ui-timepicker-addon_spec.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -661,4 +661,28 @@ describe('datetimepicker', function() {
661661
});
662662
});
663663
});
664+
665+
describe('altField', function() {
666+
var $input;
667+
var $altField;
668+
var inputFocusSpy;
669+
670+
beforeEach(function() {
671+
$input = affix('input');
672+
$altField = affix('input');
673+
674+
inputFocusSpy = jasmine.createSpy();
675+
$input.focus(inputFocusSpy);
676+
});
677+
678+
it('should redirect focus to main field', function() {
679+
$input.datetimepicker({
680+
showOn: 'button',
681+
altField: $altField,
682+
});
683+
684+
$altField.trigger('focus');
685+
expect(inputFocusSpy).toHaveBeenCalled();
686+
});
687+
});
664688
});

0 commit comments

Comments
 (0)