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',
32 while ( my( $label, $data ) = each %$cfs ) {
33 my $cf = $data->{obj} = RT::Test->load_or_create_custom_field(
34 Name => $data->{name},
35 Type => $data->{type},
37 LookupType => 'RT::Queue-RT::Ticket',
39 ok $cf && $cf->id, "Created $data->{type} CF";
41 # get cf input field name
42 $data->{input} = RT::Interface::Web::GetCustomFieldInputName(
48 # open ticket "Basics" page
49 $m->get_ok($EditUrl, "Fetched $EditUrl");
50 $m->content_contains($_->{name} . ':') for ( values %$cfs );
54 $cfs->{area}{input} => $content,
55 $cfs->{area}{input} . '-Magic' => "1",
56 $cfs->{text}{input} => 'value a',
57 $cfs->{text}{input} . '-Magic' => "1",
59 }, 'submitted form to initially set CFs');
60 $m->content_contains('<li>TheControlField value a added</li>');
61 $m->content_contains("<li>TheTextarea $content added</li>", 'content found');
63 # http://issues.bestpractical.com/Ticket/Display.html?id=30378
64 # #30378: RT 4.2.6 - Very long text fields get updated even when they haven't changed
67 $cfs->{text}{input} => 'value b',
68 $cfs->{text}{input} . '-Magic' => "1",
70 }, 'submitted form to initially set CFs');
71 $m->content_contains('<li>TheControlField value a changed to value b</li>');
72 $m->content_lacks("<li>TheTextarea $content changed to $content</li>", 'textarea wasnt updated');