diff options
| author | Christian Cleberg <[email protected]> | 2026-07-22 00:47:12 -0500 |
|---|---|---|
| committer | Christian Cleberg <[email protected]> | 2026-07-22 15:04:32 -0500 |
| commit | 7f917e98b929dcf0f7901d0bc4eb05e04db3aa0c (patch) | |
| tree | 6956220f6513e0eb6705b1707b6df9cdeb982ca6 /DomainDig/DomainViewModel.swift | |
| parent | 80cb5d8553d3afd097b10e83cf7af0bf1ba56523 (diff) | |
| download | domain-dig-7f917e98b929dcf0f7901d0bc4eb05e04db3aa0c.tar.gz domain-dig-7f917e98b929dcf0f7901d0bc4eb05e04db3aa0c.tar.bz2 domain-dig-7f917e98b929dcf0f7901d0bc4eb05e04db3aa0c.zip | |
feat(a11y): seeded audit fixtures; fix dense-row reflow they exposed (#21)
The dense rows and portfolio sections never rendered in the audit — the
test simulator has no tracked domains or batch results — so five phases
of row treatment shipped unmeasured. Driving the add-domain UI was tried
earlier and rejected (keyboard contamination, persistent state), so this
adds DOMAIN_DIG_SEED_FIXTURES: DEBUG-only launch argument, same pattern
as DOMAIN_DIG_FORCE_PRO_PLUS, seeding four tracked domains and four
batch results chosen to exercise every badge path, including a failed
lookup and a stress-length domain name.
Fixtures are strictly in-memory. persistTrackedDomains, refreshWidgetData
(App Group file), refreshPersistedData, and refreshMonitoringState are
all guarded while fixtures are active — the last one mattered: it runs
right after seeding in the app task and was reloading the empty disk
over the fixtures, which initially made the seeded watchlist audit pass
by silently auditing the empty state.
Four new audit tests cover the seeded Dashboard, Tracked Domains, and
batch results at default and AccessibilityXXXL.
What they found was real. At XXXL the watchlist row rendered the domain
as "hea lt…" while the Registered badge wrapped one character per line
into a screen-height capsule. Fixes, verified by before/after
screenshots and the XXXL audits dropping to 7-8 findings per screen:
- AppStatusBadgeView gets .fixedSize() — a capsule badge must never
letter-wrap; taking natural width instead forces the row layout to its
stacked alternative.
- WatchlistRowView, BatchResultRowView, and PortfolioExpiryRow headers
use ViewThatFits: domain-beside-badge while it genuinely fits, badge
below the domain at accessibility sizes. Domain titles get
fixedSize(horizontal: false, vertical: true) so they wrap rather than
report a single-line ideal width to ViewThatFits and truncate.
- The watchlist monitoring metadata strip (three texts abreast) stacks
vertically when it no longer fits instead of wrapping mid-word.
Known and deliberate: the seeded default-size audits still report a
contrast/dynamicType wave attributed to "unknown element". Bisecting the
row and badge accessibility modifiers showed most of it is an audit
artifact on children-ignored content (the same rows measure 6-7:1 and
render correctly); the artifact classes get characterised suppressions
when enforcement lands, not blanket ones.
Diffstat (limited to 'DomainDig/DomainViewModel.swift')
| -rw-r--r-- | DomainDig/DomainViewModel.swift | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/DomainDig/DomainViewModel.swift b/DomainDig/DomainViewModel.swift index de17cbc..b5f51c3 100644 --- a/DomainDig/DomainViewModel.swift +++ b/DomainDig/DomainViewModel.swift @@ -1019,6 +1019,11 @@ final class DomainViewModel { } func refreshMonitoringState() { + #if DEBUG + // Runs right after fixture seeding in the app task (and again on every + // scene activation); the disk reload below would wipe the fixtures. + if auditFixturesActive { return } + #endif DataMigrationService.migrateIfNeeded() trackedDomains = Self.loadTrackedDomains() history = Self.loadHistoryEntries() @@ -1036,6 +1041,10 @@ final class DomainViewModel { } func refreshPersistedData() { + #if DEBUG + // A reload from disk would silently replace the in-memory fixtures. + if auditFixturesActive { return } + #endif recentSearches = DomainDataPortabilityService.loadRecentSearches() savedDomains = DomainDataPortabilityService.loadSavedDomains() trackedDomains = Self.loadTrackedDomains() @@ -2614,7 +2623,25 @@ final class DomainViewModel { persistHistory() } + #if DEBUG + /// True when this session was launched with `DOMAIN_DIG_SEED_FIXTURES`. + /// Blocks tracked-domain persistence, widget-store writes, and persisted-data + /// reloads so fixture data stays strictly in-memory — the audit suite relies + /// on every launch starting from the same state. + private(set) var auditFixturesActive = false + + func seedAuditFixturesIfRequested() { + guard AuditFixtures.requested, !auditFixturesActive else { return } + auditFixturesActive = true + trackedDomains = AuditFixtures.trackedDomains + batchResults = AuditFixtures.batchResults + } + #endif + private func persistTrackedDomains() { + #if DEBUG + if auditFixturesActive { return } + #endif if trackedDomainsPersistenceSuspended { trackedDomainsPersistenceDirty = true return |
