4 use RT::Test tests => 'no_declare';
6 my $content = join ' ', ('The quick brown fox jumps over the lazy dog.') x 5;
7 $content = join "\n\n", $content, $content, $content;
9 my ($base, $m) = RT::Test->started_ok;
13 my $ticket = RT::Test->create_ticket(
15 Subject => 'a test ticket',
17 ok $ticket && $ticket->id, "Created ticket";
19 my $EditUrl = "/Ticket/Modify.html?id=" . $ticket->id;
24 name => 'TheTextarea',
27 type => 'FreeformSingle',
28 name => 'TheControlField',
31 type => 'FreeformSingle',
36 while ( my( $label, $data ) = each %$cfs ) {
37 my $cf = $data->{obj} = RT::Test->load_or_create_custom_field(
38 Name => $data->{name},
39 Type => $data->{type},
41 LookupType => 'RT::Queue-RT::Ticket',
43 ok $cf && $cf->id, "Created $data->{type} CF";
45 # get cf input field name
46 $data->{input} = RT::Interface::Web::GetCustomFieldInputName(
52 # open ticket "Basics" page
53 $m->get_ok($EditUrl, "Fetched $EditUrl");
54 $m->content_contains($_->{name} . ':') for ( values %$cfs );
58 $cfs->{area}{input} => $content,
59 $cfs->{area}{input} . '-Magic' => "1",
60 $cfs->{text}{input} => 'value a',
61 $cfs->{text}{input} . '-Magic' => "1",
62 $cfs->{zero}{input} => '0',
63 $cfs->{zero}{input} . '-Magic' => "1",
65 }, 'submitted form to initially set CFs');
66 $m->content_contains('<li>TheControlField value a added</li>');
67 $m->content_contains("<li>TheTextarea $content added</li>", 'content found');
68 $m->content_contains("<li>Zero 0 added</li>", 'zero field found');
70 # http://issues.bestpractical.com/Ticket/Display.html?id=30378
71 # #30378: RT 4.2.6 - Very long text fields get updated even when they haven't changed
74 $cfs->{text}{input} => 'value b',
75 $cfs->{text}{input} . '-Magic' => "1",
77 }, 'submitted form to initially set CFs');
78 $m->content_contains('<li>TheControlField value a changed to value b</li>');
79 $m->content_lacks("<li>TheTextarea $content changed to $content</li>", 'textarea wasnt updated');
81 # http://issues.bestpractical.com/Ticket/Display.html?id=32440
82 # #32440: Spurious "CF changed from 0 to 0"
83 $m->content_lacks("<li>Zero 0 changed to 0</li>", "Zero wasn't updated");