From d69f2ecb1273f382d83b13c349a8c76b17bee2a6 Mon Sep 17 00:00:00 2001 From: pheiberg Date: Sun, 21 Nov 2010 22:06:23 +0100 Subject: Datepicker: changed setDate not to modify the passed date argument. Fixes #6671 - setDate manipulates its argument --- tests/unit/datepicker/datepicker_options.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tests/unit/datepicker') diff --git a/tests/unit/datepicker/datepicker_options.js b/tests/unit/datepicker/datepicker_options.js index 5b5f252cc..af561a783 100644 --- a/tests/unit/datepicker/datepicker_options.js +++ b/tests/unit/datepicker/datepicker_options.js @@ -470,6 +470,10 @@ test('setDate', function() { equalsDate(inp.datepicker('getDate'), minDate, 'Set date min/max - setDate < min'); inp.datepicker('setDate', date2); equalsDate(inp.datepicker('getDate'), maxDate, 'Set date min/max - setDate > max'); + var dateAndTimeToSet = new Date(2008, 3 - 1, 28, 1, 11, 0); + var dateAndTimeClone = new Date(2008, 3 - 1, 28, 1, 11, 0); + inp.datepicker('setDate', dateAndTimeToSet); + equals(dateAndTimeToSet.getTime(), dateAndTimeClone.getTime(), 'Date object passed should not be changed by setDate'); }); test('altField', function() { -- cgit v1.2.3