Skip to content

Commit b6771cd

Browse files
committed
Test multi-line sub attribute handling.
Test the changes to allow multi-line sub attributes on handlers, and that normal ones (with and without a value) continue to work as expected.
1 parent 709597a commit b6771cd

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

t/aggregate/live_component_controller_action_action.t

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,14 @@ sub run_tests {
190190
my $action = eval $response->content;
191191
is_deeply $action->attributes->{extra_attribute}, [13];
192192
is_deeply $action->attributes->{another_extra_attribute}, ['foo'];
193+
194+
# Test a multi-line attribute on the action comes through as expected
195+
is_deeply $action->attributes->{MultiLineAttr}, ["one\ntwo\nthree"];
196+
# and a normal one e.g. `Foo('bar')`
197+
is_deeply $action->attributes->{Foo}, ['bar'];
198+
# and one without a value, e.g. `Baz` - note that the presence of
199+
# the arrayref shows it was there
200+
is_deeply $action->attributes->{Baz}, [undef];
193201
}
194202
{
195203
ok( my $response = request('http://localhost/action_action_nine'),

t/lib/TestApp/Controller/Action/Action.pm

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,11 @@ sub action_action_seven : Global : ActionClass('~TestExtraArgsAction') {
5353
$c->forward('TestApp::View::Dump::Request');
5454
}
5555

56-
sub action_action_eight : Global {
56+
sub action_action_eight : Global Foo('bar') MultiLineAttr(
57+
one
58+
two
59+
three
60+
) Baz {
5761
my ( $self, $c ) = @_;
5862
$c->forward('TestApp::View::Dump::Action');
5963
}
@@ -62,4 +66,5 @@ sub action_action_nine : Global : ActionClass('~TestActionArgsFromConstructor')
6266
my ( $self, $c ) = @_;
6367
$c->forward('TestApp::View::Dump::Request');
6468
}
69+
6570
1;

0 commit comments

Comments
 (0)