From 59bd99c2437d656aa0a8f286abbc20b3462d47e4 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Mon, 13 Sep 2010 11:04:03 -0700 Subject: [PATCH] Allow users to enter 24:00:00 by hand, and have the Event handle it correctly. Fixes bug #11788 --- docs/changelog/7.x.x.txt | 1 + t/Asset/Event.t | 20 ++++++++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index f20908c74..7dc1bd7af 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -3,6 +3,7 @@ - fixed #11854: CS doesn't return Not Found page - fixed #11746: Thingy import CSV only supports one line ending - fixed #11833: Recheck for losing Product Images + - fixed #11788: Calendar - Can't enter Midnight - Broke page layout 7.10.0 - fixed #11812: Checking www_ajaxSave's response in the cart js, urlencoding post parameters diff --git a/t/Asset/Event.t b/t/Asset/Event.t index fd9fa8d2d..38c566693 100644 --- a/t/Asset/Event.t +++ b/t/Asset/Event.t @@ -17,7 +17,6 @@ use WebGUI::Asset::Event; use Test::More; # increment this value for each test you create use Test::Deep; -plan tests => 20; my $session = WebGUI::Test->session; @@ -120,9 +119,7 @@ my $eventStorage = WebGUI::Storage->create($session); WebGUI::Test->addToCleanup($eventStorage); $properties3->{storageId} = $eventStorage->getId; -my $event6 = $cal->addChild($properties3, $properties3->{id}); - -sleep 2; +my $event6 = $cal->addChild($properties3, $properties3->{id}, time()-5); my $event6a = $event6->addRevision({ title => 'Event with storage', }, undef, { skipAutoCommitWorkflows => 1, }); ok($session->id->valid($event6a->get('storageId')), 'addRevision gives the new revision a valid storageId'); @@ -149,3 +146,18 @@ is $event7->isHidden, 1, 'isHidden set to 1 by default'; $event7->isHidden(0); is $event7->isHidden, 1, 'isHidden cannot be set to 0'; +my $event7 = $cal->addChild({ + className => 'WebGUI::Asset::Event', + startDate => '2000-08-31', + startTime => '24:00:00', + endDate => '2000-09-01', + endTime => '24:00:00', +}); + +is ($event7->get('startTime'), '00:00:00', 'startTime set to 00:00:00 if the hour is more than 23'); +is ($event7->get('startDate'), '2000-09-01', 'startDate bumped by 1 day'); + +is ($event7->get('endTime'), '00:00:00', 'endTime set to 00:00:00 if the hour is more than 23'); +is ($event7->get('endDate'), '2000-09-02', 'endDate bumped by 1 day'); + +done_testing;