Extract app UI action models
This commit is contained in:
+31
-31
@@ -439,14 +439,14 @@ func TestBuildSyncMenuModelForUnboundVault(t *testing.T) {
|
||||
u.state.Section = appstate.SectionEntries
|
||||
|
||||
model := u.buildSyncMenuModel()
|
||||
if !model.showRemoteSyncSetupShortcut() {
|
||||
t.Fatal("model.showRemoteSyncSetupShortcut() = false, want true for an unbound open vault")
|
||||
if !model.ShowRemoteSyncSetupShortcut() {
|
||||
t.Fatal("model.ShowRemoteSyncSetupShortcut() = false, want true for an unbound open vault")
|
||||
}
|
||||
if model.showDirectRemoteSyncShortcut() {
|
||||
t.Fatal("model.showDirectRemoteSyncShortcut() = true, want false without a saved binding")
|
||||
if model.ShowDirectRemoteSyncShortcut() {
|
||||
t.Fatal("model.ShowDirectRemoteSyncShortcut() = true, want false without a saved binding")
|
||||
}
|
||||
if got := model.actionLabels(); !slices.Equal(got, []string{"Open Advanced Sync", "Set Up Remote Sync"}) {
|
||||
t.Fatalf("model.actionLabels() = %v, want [Open Advanced Sync Set Up Remote Sync]", got)
|
||||
if got := model.ActionLabels(); !slices.Equal(got, []string{"Open Advanced Sync", "Set Up Remote Sync"}) {
|
||||
t.Fatalf("model.ActionLabels() = %v, want [Open Advanced Sync Set Up Remote Sync]", got)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -477,30 +477,30 @@ func TestBuildSyncMenuModelForBoundVault(t *testing.T) {
|
||||
u.selectedVaultRemoteSyncMode = appstate.SyncModeAutomaticOnOpenSave
|
||||
|
||||
model := u.buildSyncMenuModel()
|
||||
if model.showRemoteSyncSetupShortcut() {
|
||||
t.Fatal("model.showRemoteSyncSetupShortcut() = true, want false for a bound vault")
|
||||
if model.ShowRemoteSyncSetupShortcut() {
|
||||
t.Fatal("model.ShowRemoteSyncSetupShortcut() = true, want false for a bound vault")
|
||||
}
|
||||
if !model.showDirectRemoteSyncShortcut() {
|
||||
t.Fatal("model.showDirectRemoteSyncShortcut() = false, want true for a bound vault")
|
||||
if !model.ShowDirectRemoteSyncShortcut() {
|
||||
t.Fatal("model.ShowDirectRemoteSyncShortcut() = false, want true for a bound vault")
|
||||
}
|
||||
if !model.showRemoteSyncSettingsShortcut() {
|
||||
t.Fatal("model.showRemoteSyncSettingsShortcut() = false, want true for a bound vault")
|
||||
if !model.ShowRemoteSyncSettingsShortcut() {
|
||||
t.Fatal("model.ShowRemoteSyncSettingsShortcut() = false, want true for a bound vault")
|
||||
}
|
||||
if !model.showRemoveRemoteSyncShortcut() {
|
||||
t.Fatal("model.showRemoveRemoteSyncShortcut() = false, want true for a bound vault")
|
||||
if !model.ShowRemoveRemoteSyncShortcut() {
|
||||
t.Fatal("model.ShowRemoveRemoteSyncShortcut() = false, want true for a bound vault")
|
||||
}
|
||||
summary := model.savedBindingSummary
|
||||
if !summary.ok {
|
||||
t.Fatal("model.savedBindingSummary.ok = false, want true")
|
||||
summary := model.SavedBindingSummary
|
||||
if !summary.OK {
|
||||
t.Fatal("model.SavedBindingSummary.OK = false, want true")
|
||||
}
|
||||
if summary.profileLabel != "Downtown Mint" {
|
||||
t.Fatalf("model.savedBindingSummary.profileLabel = %q, want Downtown Mint", summary.profileLabel)
|
||||
if summary.ProfileLabel != "Downtown Mint" {
|
||||
t.Fatalf("model.SavedBindingSummary.ProfileLabel = %q, want Downtown Mint", summary.ProfileLabel)
|
||||
}
|
||||
if summary.credentialLabel != "Mint Credentials · verbal-kint" {
|
||||
t.Fatalf("model.savedBindingSummary.credentialLabel = %q, want Mint Credentials · verbal-kint", summary.credentialLabel)
|
||||
if summary.CredentialLabel != "Mint Credentials · verbal-kint" {
|
||||
t.Fatalf("model.SavedBindingSummary.CredentialLabel = %q, want Mint Credentials · verbal-kint", summary.CredentialLabel)
|
||||
}
|
||||
if summary.syncLabel != "Syncs automatically on open and save." {
|
||||
t.Fatalf("model.savedBindingSummary.syncLabel = %q, want automatic-sync summary", summary.syncLabel)
|
||||
if summary.SyncLabel != "Syncs automatically on open and save." {
|
||||
t.Fatalf("model.SavedBindingSummary.SyncLabel = %q, want automatic-sync summary", summary.SyncLabel)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -515,8 +515,8 @@ func TestBuildSyncMenuModelShowsSaveCurrentBindingOnlyWithCompleteRemoteInput(t
|
||||
u.state.Section = appstate.SectionEntries
|
||||
|
||||
model := u.buildSyncMenuModel()
|
||||
if model.showSaveCurrentBinding {
|
||||
t.Fatal("model.showSaveCurrentBinding = true, want false without remote input")
|
||||
if model.ShowSaveCurrentBinding {
|
||||
t.Fatal("model.ShowSaveCurrentBinding = true, want false without remote input")
|
||||
}
|
||||
|
||||
u.remoteBaseURL.SetText("https://mint.example.invalid/remote.php/dav")
|
||||
@@ -525,14 +525,14 @@ func TestBuildSyncMenuModelShowsSaveCurrentBindingOnlyWithCompleteRemoteInput(t
|
||||
u.remotePassword.SetText("kobayashi")
|
||||
|
||||
model = u.buildSyncMenuModel()
|
||||
if !model.showSaveCurrentBinding {
|
||||
t.Fatal("model.showSaveCurrentBinding = false, want true with complete remote input")
|
||||
if !model.ShowSaveCurrentBinding {
|
||||
t.Fatal("model.ShowSaveCurrentBinding = false, want true with complete remote input")
|
||||
}
|
||||
if got := model.saveCurrentRemoteBindingHeading(); got != "Bind this local vault to the current remote target" {
|
||||
t.Fatalf("model.saveCurrentRemoteBindingHeading() = %q, want vault binding guidance", got)
|
||||
if got := model.SaveCurrentRemoteBindingHeading(); got != "Bind this local vault to the current remote target" {
|
||||
t.Fatalf("model.SaveCurrentRemoteBindingHeading() = %q, want vault binding guidance", got)
|
||||
}
|
||||
if got := model.saveCurrentRemoteBindingButtonLabel(); got != "Save Remote In Vault" {
|
||||
t.Fatalf("model.saveCurrentRemoteBindingButtonLabel() = %q, want Save Remote In Vault", got)
|
||||
if got := model.SaveCurrentRemoteBindingButtonLabel(); got != "Save Remote In Vault" {
|
||||
t.Fatalf("model.SaveCurrentRemoteBindingButtonLabel() = %q, want Save Remote In Vault", got)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user