Skip to content

Commit 16f3aa3

Browse files
committed
fix: align token-account switcher width and test assertions with display list
Use enabledProvidersForDisplay() for the TokenAccountSwitcherView width calculation (the last remaining UI-path call site) and update two test assertions to match the switcher's actual data source.
1 parent b115568 commit 16f3aa3

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Sources/CodexBar/StatusItemController+Menu.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ extension StatusItemController {
598598
let view = TokenAccountSwitcherView(
599599
accounts: display.accounts,
600600
selectedIndex: display.activeIndex,
601-
width: self.menuCardWidth(for: self.store.enabledProviders(), menu: menu),
601+
width: self.menuCardWidth(for: self.store.enabledProvidersForDisplay(), menu: menu),
602602
onSelect: { [weak self, weak menu] index in
603603
guard let self, let menu else { return }
604604
self.settings.setActiveTokenAccountIndex(index, for: display.provider)

Tests/CodexBarTests/StatusMenuTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ struct StatusMenuTests {
272272
controller.menuWillOpen(menu)
273273

274274
let buttons = self.switcherButtons(in: menu)
275-
#expect(buttons.count == store.enabledProviders().count + 1)
275+
#expect(buttons.count == store.enabledProvidersForDisplay().count + 1)
276276
#expect(buttons.contains(where: { $0.tag == 0 }))
277277
#expect(buttons.first(where: { $0.state == .on })?.tag == 2)
278278
}
@@ -883,7 +883,7 @@ extension StatusMenuTests {
883883

884884
let ids = self.representedIDs(in: menu)
885885
let switcherButtons = self.switcherButtons(in: menu)
886-
#expect(switcherButtons.count == store.enabledProviders().count)
886+
#expect(switcherButtons.count == store.enabledProvidersForDisplay().count)
887887
#expect(switcherButtons.contains(where: { $0.title == "Overview" }) == false)
888888
#expect(switcherButtons.contains(where: { $0.state == .on && $0.tag == 0 }))
889889
#expect(ids.contains("menuCard"))

0 commit comments

Comments
 (0)