mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-24 07:39:39 +02:00
Rework account views and addition flow (#1324)
* Move accountable partials * Split accountables into separate view partials * Fix test * Add form to permitted partials * Fix failing system tests * Update new account modal views * New sync algorithm implementation * Update account system test assertions to match new behavior * Fix off by 1 date error * Revert new balance sync algorithm * Add missing account overviews
This commit is contained in:
parent
c7c281073f
commit
e8e100e1d8
88 changed files with 763 additions and 526 deletions
|
@ -80,19 +80,15 @@ class AccountsTest < ApplicationSystemTestCase
|
|||
end
|
||||
|
||||
def assert_account_created(accountable_type, &block)
|
||||
click_link humanized_accountable(accountable_type)
|
||||
click_link "Enter account balance manually"
|
||||
click_link "Enter account manually"
|
||||
|
||||
account_name = "[system test] #{accountable_type} Account"
|
||||
|
||||
select accountable_type.titleize, from: "Account type"
|
||||
fill_in "Account name", with: account_name
|
||||
fill_in "account[balance]", with: 100.99
|
||||
fill_in "Start date (optional)", with: 10.days.ago.to_date
|
||||
fill_in "account[start_balance]", with: 95.25
|
||||
|
||||
yield if block_given?
|
||||
|
||||
click_button "Add #{humanized_accountable(accountable_type).downcase}"
|
||||
click_button "Create Account"
|
||||
|
||||
find("details", text: humanized_accountable(accountable_type)).click
|
||||
assert_text account_name
|
||||
|
@ -107,8 +103,10 @@ class AccountsTest < ApplicationSystemTestCase
|
|||
click_on "Edit"
|
||||
end
|
||||
|
||||
yield if block_given?
|
||||
|
||||
fill_in "Account name", with: "Updated account name"
|
||||
click_button "Update #{humanized_accountable(accountable_type).downcase}"
|
||||
click_button "Update Account"
|
||||
assert_selector "h2", text: "Updated account name"
|
||||
end
|
||||
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
require "application_system_test_case"
|
||||
|
||||
class TooltipsTest < ApplicationSystemTestCase
|
||||
include ActionView::Helpers::NumberHelper
|
||||
include ApplicationHelper
|
||||
|
||||
setup do
|
||||
sign_in @user = users(:family_admin)
|
||||
@account = accounts(:investment)
|
||||
end
|
||||
|
||||
test "can see account information tooltip" do
|
||||
visit account_path(@account)
|
||||
tooltip_element = find('[data-controller="tooltip"]')
|
||||
tooltip_element.hover
|
||||
tooltip_contents = find('[data-tooltip-target="tooltip"]')
|
||||
assert tooltip_contents.visible?
|
||||
within tooltip_contents do
|
||||
assert_text I18n.t("accounts.tooltip.total_value_tooltip")
|
||||
assert_text I18n.t("accounts.tooltip.holdings")
|
||||
assert_text format_money(@account.investment.holdings_value, precision: 0)
|
||||
assert_text I18n.t("accounts.tooltip.cash")
|
||||
assert_text format_money(@account.balance_money, precision: 0)
|
||||
end
|
||||
find("body").click
|
||||
assert find('[data-tooltip-target="tooltip"]', visible: false)
|
||||
end
|
||||
end
|
|
@ -62,6 +62,6 @@ class TradesTest < ApplicationSystemTestCase
|
|||
end
|
||||
|
||||
def visit_account_trades
|
||||
visit account_url(@account, tab: "trades")
|
||||
visit account_url(@account, tab: "transactions")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -156,6 +156,7 @@ class TransactionsTest < ApplicationSystemTestCase
|
|||
|
||||
test "can create deposit transaction for investment account" do
|
||||
investment_account = accounts(:investment)
|
||||
investment_account.entries.create!(name: "Investment account", date: Date.current, amount: 1000, currency: "USD", entryable: Account::Transaction.new)
|
||||
transfer_date = Date.current
|
||||
visit account_path(investment_account)
|
||||
click_on "New transaction"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue