mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 23:50:36 -05:00
- more_menu helper (menu / menu-item styles): each section keeps its main action as a button; imports, exports, printing and tools move under More (flights, logbook, logbook entry, documents, inspections, fleet) - Aircraft header: More with status report and, for owners, access & sharing, edit, .sam.zip and records package; Access & Sharing and Oil Analysis tabs removed (oil analysis is under Oil & Fuel with a switch) - Logbook: Print selected appears once an entry is ticked; filters apply on change; dates use fmt_date (also AirTrail, notes, audits, About) - Header shows the role on the aircraft and hides the usual Available badge; no second Grounded badge on the Overview; AD DRS import listed once - Flights: stat cards 2x2 on phones; By year opens visibly, only with more than one year; duplicate + Log Flight removed - Remove unused hello_controller.js; guide and README updated Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
47 lines
2.1 KiB
Ruby
47 lines
2.1 KiB
Ruby
require "test_helper"
|
|
|
|
# Each section shows its main action; imports, exports, printing and the
|
|
# aircraft's own settings are under a "More" menu.
|
|
class MoreMenuTest < ActionDispatch::IntegrationTest
|
|
setup do
|
|
@owner = create_user("owner@example.com")
|
|
@pilot = create_user("pilot@example.com")
|
|
@a = create_aircraft(owner: @owner, pilot: @pilot)
|
|
end
|
|
|
|
test "secondary actions are in the More menu and the main action stays a button" do
|
|
sign_in @owner
|
|
get aircraft_flight_logs_path(@a)
|
|
assert_select "details summary", /More/
|
|
assert_select ".menu a.menu-item[href='#{new_aircraft_flight_import_path(@a)}']", "Import from spreadsheet"
|
|
assert_select ".menu a.menu-item[href='#{new_aircraft_air_trail_export_path(@a)}']", "Export for AirTrail"
|
|
|
|
get aircraft_logbook_entries_path(@a)
|
|
assert_select "a.btn-primary[href='#{new_aircraft_logbook_entry_path(@a)}']", "+ New Entry"
|
|
assert_select ".menu a.menu-item[href='#{new_aircraft_logbook_import_path(@a)}']", "Import scans"
|
|
end
|
|
|
|
test "the aircraft's More menu has access and downloads for owners only" do
|
|
sign_in @owner
|
|
get aircraft_path(@a)
|
|
assert_select "nav[aria-label='Aircraft sections'] a", text: "Access & Sharing", count: 0
|
|
assert_select ".menu a.menu-item[href='#{aircraft_aircraft_roles_path(@a)}']", "Access & sharing"
|
|
assert_select ".menu a.menu-item[href='#{aircraft_export_path(@a)}']", "Download .sam.zip"
|
|
|
|
sign_in @pilot
|
|
get aircraft_path(@a)
|
|
assert_select ".menu a.menu-item[href='#{aircraft_report_path(@a)}']", "Status report"
|
|
assert_select ".menu a[href='#{aircraft_aircraft_roles_path(@a)}']", count: 0
|
|
assert_select ".menu a[href='#{aircraft_export_path(@a)}']", count: 0
|
|
end
|
|
|
|
test "the header shows the role on the aircraft, and Available only when it isn't the usual" do
|
|
admin = create_user("admin@example.com", admin: true)
|
|
@a.roles.create!(user: admin, role: "owner")
|
|
sign_in admin
|
|
get aircraft_path(@a)
|
|
assert_select "span[title='Your access to this aircraft']", "Owner"
|
|
assert_select "span.badge-green", text: "Available", count: 0
|
|
end
|
|
end
|