diff options
author | Keith Wood <kbwood.au@gmail.com> | 2009-07-22 08:37:28 +0000 |
---|---|---|
committer | Keith Wood <kbwood.au@gmail.com> | 2009-07-22 08:37:28 +0000 |
commit | ef4000d9df88a4d9dd3bcae72439c078eff8634b (patch) | |
tree | 098bc2517be617eb5fad6a6bc0feae075e304987 /tests/unit/datepicker | |
parent | d2bd01aecbd71920523dd08788211db037d5bccc (diff) | |
download | jquery-ui-ef4000d9df88a4d9dd3bcae72439c078eff8634b.tar.gz jquery-ui-ef4000d9df88a4d9dd3bcae72439c078eff8634b.zip |
Datepicker: Fixed #3891 Autosize input field
Diffstat (limited to 'tests/unit/datepicker')
-rw-r--r-- | tests/unit/datepicker/datepicker_options.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/unit/datepicker/datepicker_options.js b/tests/unit/datepicker/datepicker_options.js index 768f43c27..c3ffb1d11 100644 --- a/tests/unit/datepicker/datepicker_options.js +++ b/tests/unit/datepicker/datepicker_options.js @@ -509,6 +509,44 @@ test('altField', function() { equals(alt.val(), '2008-06-04', 'Alt field - manual entry - not updated'); }); +test('autoSize', function() { + var inp = init('#inp'); + equals(inp.attr('size'), 0, 'Auto size - default'); + inp.datepicker('option', 'autoSize', true); + equals(inp.attr('size'), 10, 'Auto size - mm/dd/yy'); + inp.datepicker('option', 'dateFormat', 'm/d/yy'); + equals(inp.attr('size'), 10, 'Auto size - m/d/yy'); + inp.datepicker('option', 'dateFormat', 'D M d yy'); + equals(inp.attr('size'), 15, 'Auto size - D M d yy'); + inp.datepicker('option', 'dateFormat', 'DD, MM dd, yy'); + equals(inp.attr('size'), 29, 'Auto size - DD, MM dd, yy'); + inp.removeAttr('size'); + // French + inp.datepicker('option', $.extend({autoSize: false}, $.datepicker.regional['fr'])); + equals(inp.attr('size'), 0, 'Auto size - fr - default'); + inp.datepicker('option', 'autoSize', true); + equals(inp.attr('size'), 10, 'Auto size - fr - dd/mm/yy'); + inp.datepicker('option', 'dateFormat', 'm/d/yy'); + equals(inp.attr('size'), 10, 'Auto size - fr - m/d/yy'); + inp.datepicker('option', 'dateFormat', 'D M d yy'); + equals(inp.attr('size'), 15, 'Auto size - fr - D M d yy'); + inp.datepicker('option', 'dateFormat', 'DD, MM dd, yy'); + equals(inp.attr('size'), 28, 'Auto size - fr - DD, MM dd, yy'); + inp.removeAttr('size'); + // Hebrew + inp.datepicker('option', $.extend({autoSize: false}, $.datepicker.regional['he'])); + equals(inp.attr('size'), 0, 'Auto size - he - default'); + inp.datepicker('option', 'autoSize', true); + equals(inp.attr('size'), 10, 'Auto size - he - dd/mm/yy'); + inp.datepicker('option', 'dateFormat', 'm/d/yy'); + equals(inp.attr('size'), 10, 'Auto size - he - m/d/yy'); + inp.datepicker('option', 'dateFormat', 'D M d yy'); + equals(inp.attr('size'), 14, 'Auto size - he - D M d yy'); + inp.datepicker('option', 'dateFormat', 'DD, MM dd, yy'); + equals(inp.attr('size'), 23, 'Auto size - he - DD, MM dd, yy'); + inp.removeAttr('size'); +}); + test('daylightSaving', function() { var inp = init('#inp'); var dp = $('#ui-datepicker-div'); |