[Rt-commit] rt branch, 4.0/preserve-time-units, updated. rt-4.0.1-222-g0366959

Jason May jasonmay at bestpractical.com
Thu Nov 3 15:55:20 EDT 2011


The branch, 4.0/preserve-time-units has been updated
       via  0366959b4d6ab5a77febfd817d0ca34742c5e9ab (commit)
       via  b176245e27d0e4040c9d4ae6658bc40d8d5261a7 (commit)
       via  cb0477c1518abc340595d6a930303396cf7de9eb (commit)
      from  79ef57d084bb84483b5edae327075e02489d9085 (commit)

Summary of changes:
 share/html/Ticket/ModifyAll.html |    9 +++++-
 t/web/ticket_basics.t            |   54 +++++++++++++++++++++++++++++++++-----
 2 files changed, 54 insertions(+), 9 deletions(-)

- Log -----------------------------------------------------------------
commit cb0477c1518abc340595d6a930303396cf7de9eb
Author: Jason May <jasonmay at bestpractical.com>
Date:   Thu Nov 3 11:42:47 2011 -0400

    Cover more field possibilities in the time unit tests

diff --git a/t/web/ticket_basics.t b/t/web/ticket_basics.t
index ebd06d5..8b08df6 100644
--- a/t/web/ticket_basics.t
+++ b/t/web/ticket_basics.t
@@ -1,7 +1,7 @@
 use strict;
 use warnings;
 
-use RT::Test tests => 14;
+use RT::Test tests => 17;
 
 my $ticket = RT::Test->create_ticket(
     Subject => 'test ticket basics',
@@ -13,14 +13,24 @@ ok( $m->login, 'logged in' );
 
 # Failing test where the time units are not preserved when you
 # click 'Add more files' on Display
-for (qw/Estimated Worked Left/) {
+my @form_tries = (
+    {TimeEstimated => undef},
+    {TimeEstimated => "1"},
+    {TimeWorked    => undef},
+    {TimeWorked    => "1"},
+    {TimeLeft      => undef},
+    {TimeLeft      => "1"},
+);
+for my $try (@form_tries) {
     $m->goto_create_ticket(1);
     $m->form_name('TicketCreate');
-    $m->field("Time${_}" => "1");
-    $m->select("Time${_}-TimeUnits" => 'hours');
-    $m->click('AddMoreAttach');
-    $m->form_name('TicketCreate');
-    is($m->value("Time${_}-TimeUnits"), 'hours', 'time units stayed to "hours" after the form was submitted');
+    for my $field (keys %$try) {
+        $m->select("${field}-TimeUnits" => 'hours');
+        $m->field($field => $try->{$field}) if defined $try->{$field};
+        $m->click('AddMoreAttach');
+        $m->form_name('TicketCreate');
+        is($m->value("${field}-TimeUnits"), 'hours', 'time units stayed to "hours" after the form was submitted');
+    }
 }
 
 $m->goto_update_ticket(ticket => $ticket, action => 'Respond');

commit b176245e27d0e4040c9d4ae6658bc40d8d5261a7
Author: Jason May <jasonmay at bestpractical.com>
Date:   Thu Nov 3 12:03:00 2011 -0400

    Test time unit preservation for tickets on the Jumbo page

diff --git a/share/html/Ticket/ModifyAll.html b/share/html/Ticket/ModifyAll.html
index 9416652..1e37a4d 100755
--- a/share/html/Ticket/ModifyAll.html
+++ b/share/html/Ticket/ModifyAll.html
@@ -51,7 +51,7 @@
 % $m->callback(CallbackName => 'BeforeActionList', Actions => \@results, ARGSRef => \%ARGS, Ticket => $Ticket);
 <& /Elements/ListActions, actions => \@results &>
 
-<form method="post" action="ModifyAll.html" enctype="multipart/form-data">
+<form method="post" name="ModifyTicket" action="ModifyAll.html" enctype="multipart/form-data">
 % $m->callback( CallbackName => 'FormStart', ARGSRef => \%ARGS );
 <input type="hidden" class="hidden" name="id" value="<%$Ticket->Id%>" />
 
diff --git a/t/web/ticket_basics.t b/t/web/ticket_basics.t
index 8b08df6..73c252c 100644
--- a/t/web/ticket_basics.t
+++ b/t/web/ticket_basics.t
@@ -1,7 +1,7 @@
 use strict;
 use warnings;
 
-use RT::Test tests => 17;
+use RT::Test tests => 47;
 
 my $ticket = RT::Test->create_ticket(
     Subject => 'test ticket basics',
@@ -62,3 +62,23 @@ $m->click('SubmitTicket');
 
 $m->form_name('TicketCreate');
 is($m->value("TimeWorked-TimeUnits"), 'hours', 'time units stayed to "hours" after the form was submitted');
+
+
+# Test for time unit preservation in Jumbo
+for my $try (@form_tries) {
+    my $jumbo_ticket = RT::Test->create_ticket(
+        Subject => 'test jumbo ticket basics',
+        Queue   => 1,
+    );
+
+    $m->get_ok( $url . "/Ticket/ModifyAll.html?id=" . $jumbo_ticket->id );
+
+    for my $field (keys %$try) {
+        $m->form_name('ModifyTicket');
+        $m->field("${field}" => "1");
+        $m->select("${field}-TimeUnits" => 'hours');
+        $m->click('AddMoreAttach');
+        $m->form_name('ModifyTicket');
+        is($m->value("${field}-TimeUnits"), 'hours', 'time units stayed to "hours" after the form was submitted');
+    }
+}

commit 0366959b4d6ab5a77febfd817d0ca34742c5e9ab
Author: Jason May <jasonmay at bestpractical.com>
Date:   Thu Nov 3 15:56:38 2011 -0400

    Preserve time fields in Jumbo by passing the comp args as defaults

diff --git a/share/html/Ticket/ModifyAll.html b/share/html/Ticket/ModifyAll.html
index 1e37a4d..3562486 100755
--- a/share/html/Ticket/ModifyAll.html
+++ b/share/html/Ticket/ModifyAll.html
@@ -56,7 +56,12 @@
 <input type="hidden" class="hidden" name="id" value="<%$Ticket->Id%>" />
 
 <&| /Widgets/TitleBox, title => loc('Modify ticket # [_1]', $Ticket->Id), class=>'ticket-info-basics' &>
-<& Elements/EditBasics, TicketObj => $Ticket &>
+% my @preserve_fields = qw(
+%     TimeWorked TimeEstimated TimeLeft
+% );
+<& Elements/EditBasics,
+    TicketObj => $Ticket,
+    defaults => { map { $_ => $ARGS{$_} } @preserve_fields } &>
 <& Elements/EditCustomFields, TicketObj => $Ticket &>
 </&>
 
diff --git a/t/web/ticket_basics.t b/t/web/ticket_basics.t
index 73c252c..ea3045f 100644
--- a/t/web/ticket_basics.t
+++ b/t/web/ticket_basics.t
@@ -1,7 +1,7 @@
 use strict;
 use warnings;
 
-use RT::Test tests => 47;
+use RT::Test tests => 59;
 
 my $ticket = RT::Test->create_ticket(
     Subject => 'test ticket basics',
@@ -30,6 +30,11 @@ for my $try (@form_tries) {
         $m->click('AddMoreAttach');
         $m->form_name('TicketCreate');
         is($m->value("${field}-TimeUnits"), 'hours', 'time units stayed to "hours" after the form was submitted');
+        is(
+            $m->value($field),
+            defined($try->{$field}) ? $try->{$field} : '',
+            'time value is the same after the form was submitted'
+        );
     }
 }
 
@@ -75,10 +80,15 @@ for my $try (@form_tries) {
 
     for my $field (keys %$try) {
         $m->form_name('ModifyTicket');
-        $m->field("${field}" => "1");
+        $m->field($field => $try->{$field}) if defined $try->{$field};
         $m->select("${field}-TimeUnits" => 'hours');
         $m->click('AddMoreAttach');
         $m->form_name('ModifyTicket');
         is($m->value("${field}-TimeUnits"), 'hours', 'time units stayed to "hours" after the form was submitted');
+        is(
+            $m->value($field),
+            defined($try->{$field}) ? $try->{$field} : '',
+            'time value is the same after the form was submitted'
+        );
     }
 }

-----------------------------------------------------------------------


More information about the Rt-commit mailing list