summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmil Lundberg <lundberg.emil@gmail.com>2014-05-11 23:05:25 +0200
committerEmil Lundberg <lundberg.emil@gmail.com>2014-05-12 00:51:09 +0200
commita5537b4904c861351962c09063a6d549c3542f88 (patch)
treeb4d42992154d623fd09e9965246c66b775ee69a8
parente806222ef2167936042a9d706340975b0e6ecb9a (diff)
downloadjQuery-Timepicker-Addon-a5537b4904c861351962c09063a6d549c3542f88.zip
jQuery-Timepicker-Addon-a5537b4904c861351962c09063a6d549c3542f88.tar.gz
jQuery-Timepicker-Addon-a5537b4904c861351962c09063a6d549c3542f88.tar.bz2
Add test for altField focus redirection
-rw-r--r--test/.jshintrc1
-rw-r--r--test/jquery-ui-timepicker-addon_spec.js24
2 files changed, 25 insertions, 0 deletions
diff --git a/test/.jshintrc b/test/.jshintrc
index 744a6f2..391bd7f 100644
--- a/test/.jshintrc
+++ b/test/.jshintrc
@@ -15,6 +15,7 @@
"jQuery",
"$",
"QUnit",
+ "jasmine",
"module",
"test",
"asyncTest",
diff --git a/test/jquery-ui-timepicker-addon_spec.js b/test/jquery-ui-timepicker-addon_spec.js
index 7da1ecf..4600a4f 100644
--- a/test/jquery-ui-timepicker-addon_spec.js
+++ b/test/jquery-ui-timepicker-addon_spec.js
@@ -661,4 +661,28 @@ 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();
+ });
+ });
});