aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTJ VanToll <tj.vantoll@gmail.com>2013-11-20 08:53:02 -0500
committerScott González <scott.gonzalez@gmail.com>2015-01-29 17:47:48 -0500
commitbfd8f26bb4de432cbf79a507a458a7530ea8c39b (patch)
tree045e5ece7c22ebebddb09ac17253710433fab7d0
parentab94999105868ff7780f2a788452748c4e952be9 (diff)
downloadjquery-ui-bfd8f26bb4de432cbf79a507a458a7530ea8c39b.tar.gz
jquery-ui-bfd8f26bb4de432cbf79a507a458a7530ea8c39b.zip
Datepicker: Add test to ensure the `<input>`'s value is preselected
-rw-r--r--tests/unit/datepicker/datepicker_core.js29
1 files changed, 18 insertions, 11 deletions
diff --git a/tests/unit/datepicker/datepicker_core.js b/tests/unit/datepicker/datepicker_core.js
index 8795b5a7e..cd1a64939 100644
--- a/tests/unit/datepicker/datepicker_core.js
+++ b/tests/unit/datepicker/datepicker_core.js
@@ -1,17 +1,24 @@
-/*
- * datepicker_core.js
- */
+(function( $ ) {
-(function($) {
-
-module( "datepicker: core", {
- setup: function() {
- $( "body" ).focus();
- }
-});
+module( "datepicker: core" );
TestHelpers.testJshint( "datepicker" );
+test( "input's value determines starting date", function() {
+ expect( 3 );
+
+ var input = $( "#datepicker" ).val( "1/1/2014" ).datepicker(),
+ picker = input.datepicker( "widget" );
+
+ input.datepicker( "open" );
+
+ equal( picker.find( ".ui-datepicker-month" ).html(), "January", "correct month displayed" );
+ equal( picker.find( ".ui-datepicker-year" ).html(), "2014", "correct year displayed" );
+ equal( picker.find( ".ui-state-focus" ).html(), "1", "correct day highlighted" );
+
+ input.val( "" ).datepicker( "destroy" );
+});
+
asyncTest( "baseStructure", function() {
expect( 42 );
var header, title, table, thead, week, panel, inl, child,
@@ -485,4 +492,4 @@ test( "mouse", function() {
"Mouse click inline - next" );
});
-})(jQuery);
+})( jQuery );