Skip to content

Commit b4cedfc

Browse files
committed
quote total turbo update
1 parent 8e98edb commit b4cedfc

File tree

7 files changed

+31
-1
lines changed

7 files changed

+31
-1
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
11
<%= turbo_stream.remove @line_item_date %>
2+
3+
<%= turbo_stream.update dom_id(@quote, :total) do %>
4+
<%= render "quotes/total", quote: @quote %>
5+
<% end %>
6+
27
<%= render_turbo_stream_flash_messages %>

app/views/line_items/create.turbo_stream.erb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,8 @@
66
<%= render @line_item, quote: @quote, line_item_date: @line_item_date %>
77
<% end %>
88

9+
<%= turbo_stream.update dom_id(@quote, :total) do %>
10+
<%= render "quotes/total", quote: @quote %>
11+
<% end %>
12+
913
<%= render_turbo_stream_flash_messages %>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
11
<%= turbo_stream.remove @line_item %>
2+
3+
<%= turbo_stream.update dom_id(@quote, :total) do %>
4+
<%= render "quotes/total", quote: @quote %>
5+
<% end %>
6+
27
<%= render_turbo_stream_flash_messages %>

app/views/line_items/update.turbo_stream.erb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,8 @@
22
<%= render @line_item, quote: @quote, line_item_date: @line_item_date %>
33
<% end %>
44

5+
<%= turbo_stream.update dom_id(@quote, :total) do %>
6+
<%= render "quotes/total", quote: @quote %>
7+
<% end %>
8+
59
<%= render_turbo_stream_flash_messages %>

app/views/quotes/show.html.erb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,6 @@ COMMENT
3333
<% end %>
3434
</main>
3535

36-
<%= render "quotes/total", quote: @quote %>
36+
<%= turbo_frame_tag dom_id(@quote, :total) do %>
37+
<%= render "quotes/total", quote: @quote %>
38+
<% end %>

test/system/line_item_dates_test.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
require "application_system_test_case"
22

33
class LineItemDatesTest < ApplicationSystemTestCase
4+
include ActionView::Helpers::NumberHelper
5+
46
setup do
57
login_as users(:accountant)
68

@@ -46,5 +48,7 @@ class LineItemDatesTest < ApplicationSystemTestCase
4648
end
4749

4850
assert_no_text I18n.l(Date.current, format: :long)
51+
52+
assert_text number_to_currency(@quote.total_price)
4953
end
5054
end

test/system/line_items_test.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ class LineItemSystemTest < ApplicationSystemTestCase
2929
assert_selector "h1", text: "First quote"
3030
assert_text "Animation"
3131
assert_text number_to_currency(1234)
32+
33+
assert_text number_to_currency(@quote.total_price)
3234
end
3335

3436
test "Updating a line item" do
@@ -45,6 +47,8 @@ class LineItemSystemTest < ApplicationSystemTestCase
4547

4648
assert_text "Capybara article"
4749
assert_text number_to_currency(1234)
50+
51+
assert_text number_to_currency(@quote.total_price)
4852
end
4953

5054
test "Destroying a line item" do
@@ -59,5 +63,7 @@ class LineItemSystemTest < ApplicationSystemTestCase
5963
within "##{dom_id(@line_item_date)}" do
6064
assert_no_text @line_item.name
6165
end
66+
67+
assert_text number_to_currency(@quote.total_price)
6268
end
6369
end

0 commit comments

Comments
 (0)