Skip to content
This repository was archived by the owner on Jun 21, 2022. It is now read-only.

Commit b59c9a4

Browse files
committed
Fix test 'change item total' from controler_Item.t
1 parent 90aef6a commit b59c9a4

File tree

4 files changed

+13
-14
lines changed

4 files changed

+13
-14
lines changed

lib/Coocook/Controller/Recipe.pm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ sub edit : GET HEAD Chained('base') PathPart('') Args(0) RequiresCapability('vie
100100
);
101101

102102
$recipe->project->is_public
103-
and $c->stash( public_url => $c->uri_for_action( '/browse/recipe/show', [ $recipe->id, $recipe->url_name ] ) );
103+
and $c->stash(
104+
public_url => $c->uri_for_action( '/browse/recipe/show', [ $recipe->id, $recipe->url_name ] ) );
104105

105106
for my $ingredient ( @{ $c->stash->{ingredients} } ) {
106107
$ingredient->{reposition_url} = $c->project_uri( '/recipe/reposition', $ingredient->{id} );

root/templates/purchase_list/edit.tt

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,24 +44,22 @@ html_title = html_title _ ' for ' _ display_date(list.date, {html=>1});
4444
<option value="[% item.next_higher_value %]">
4545
<option value="[% item.next_lower_value%]">
4646
</datalist>
47-
<form id="total-[% loop.count %]" name="total" method="post" action="[% item.update_offset_url %]"></form>
48-
<form id="units-[% loop.count %]" method="post" action="[% item.convert_url %]"></form>
49-
<div class="d-flex justify-content-between">
47+
<form id="total-[% loop.count %]" class="d-flex justify-content-between" name="total" method="post" action="[% item.update_offset_url %]">
5048
<div class="input-group flex-nowrap">
5149
[% IF item.offset %]<span class="input-group-text px-1">ca.</span>[% END %]
5250
<input id="total" class="form-control" form="total-[% loop.count %]" type="number" min="0" step="any" name="total" list="values-[% loop.count %]" value="[% item.value + item.offset %]">
5351
<span class="input-group-text">[% display_unit( item.unit, {html=>1} ) %]</span>
5452
</div>
5553
<button class="btn btn-outline-primary ms-1 material-icons" form="total-[% loop.count %]" type="submit" title="Update amount">sync</button>
56-
</div>
54+
</form>
5755
[% IF item.convert_url %]
58-
<div class="d-flex flex-wrap border rounded my-1 w-100">
56+
<form id="units-[% loop.count %]" class="d-flex flex-wrap border rounded my-1 w-100" name="convert" method="post" action="[% item.convert_url %]">
5957
[% idx = loop.count;
6058
FOREACH unit IN item.convertible_into %]
6159
<button class="btn btn-outline-secondary btn-sm m-1" form="units-[% idx %]" type="submit" name="unit" value="[% unit.id %]">[% unit.short_name | html %]</button>
62-
[% END;
63-
END %]
64-
</div>
60+
[% END %]
61+
</form>
62+
[% END %]
6563
</td>
6664
<td rowspan="[% rowspan %]">[% item.article.name | html %]</td>
6765

root/templates/purchase_list/snippet_dish.tt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
2-
31
<td style="text-align:right;">[% display_value_unit( ingredient.value, ingredient.unit, {html=>1} ) %]</td>
42
<td style="text-align:center;">[% ingredient.dish.meal.date.strftime('%a, %F') %]</td>
53
<td>[% ingredient.dish.meal.name | html %]</td>

t/controller_Item.t

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ subtest "change item total" => sub {
6969
$t->submit_form_ok(
7070
{
7171
form_name => 'remove-offset',
72-
form_number => 10,
72+
form_number => 11,
73+
button => 'offset',
7374
},
7475
"Remove offset"
7576
);
@@ -86,7 +87,7 @@ subtest "change item total" => sub {
8687

8788
$t->submit_form_ok(
8889
{
89-
form_number => 8,
90+
form_number => 9,
9091
},
9192
"Remove ingredient"
9293
);
@@ -101,7 +102,8 @@ subtest "change item total" => sub {
101102

102103
$t->submit_form_ok(
103104
{
104-
form_number => 5,
105+
form_number => 3,
106+
button => 'unit',
105107
},
106108
"Convert item to kg"
107109
);

0 commit comments

Comments
 (0)