Replace browser confirm() dialogs with custom modal; add live label preview on battery add form
- base.html: add CSS/HTML/JS for styled in-app confirmation modal (dark-mode compatible via CSS vars) - device_list, battery_detail: convert onsubmit confirm() to declarative data-confirm attributes - dashboard: convert bulk Delete/Install buttons to use modal helpers (submitWithAction pattern) - app.py: pass brand_counts dict to battery_add template - battery_add.html: show live "Will create: Brand 001 → Brand 003" preview as brand/quantity change - tests: add two tests covering brand_counts server-side rendering
This commit is contained in:
@@ -41,6 +41,24 @@ def test_dashboard_loads(seeded_client):
|
||||
assert b"BrandX 002" in resp.data
|
||||
|
||||
|
||||
# ------------------------------------------------------------------ #
|
||||
# Battery add — label preview data
|
||||
# ------------------------------------------------------------------ #
|
||||
|
||||
def test_battery_add_get_renders(client):
|
||||
resp = client.get("/battery/add")
|
||||
assert resp.status_code == 200
|
||||
assert b"brandCounts" in resp.data
|
||||
|
||||
|
||||
def test_battery_add_brand_counts_reflects_existing(seeded_client):
|
||||
# seeded_client has BrandX x2, BrandY x1
|
||||
resp = seeded_client.get("/battery/add")
|
||||
assert resp.status_code == 200
|
||||
assert b'"BrandX": 2' in resp.data or b'"BrandX":2' in resp.data
|
||||
assert b'"BrandY": 1' in resp.data or b'"BrandY":1' in resp.data
|
||||
|
||||
|
||||
# ------------------------------------------------------------------ #
|
||||
# Battery — bulk add
|
||||
# ------------------------------------------------------------------ #
|
||||
|
||||
Reference in New Issue
Block a user