fix: open native directory picker for new instances
This commit is contained in:
@@ -115,3 +115,22 @@ func TestShellIgnoresCancelledPathSearchResult(t *testing.T) {
|
||||
t.Fatal("cancelled result overwrote the editor")
|
||||
}
|
||||
}
|
||||
|
||||
func TestShellAppliesSelectedInstanceDirectory(t *testing.T) {
|
||||
shell := NewShell(material.NewTheme())
|
||||
shell.OnChooseDirectory(func(context.Context) (string, error) {
|
||||
return `C:\profiles\new-instance`, nil
|
||||
}, nil)
|
||||
shell.chooseInstanceDirectory()
|
||||
var result directoryPickResult
|
||||
select {
|
||||
case result = <-shell.directoryResults:
|
||||
case <-time.After(time.Second):
|
||||
t.Fatal("directory picker did not produce a result")
|
||||
}
|
||||
shell.directoryResults <- result
|
||||
shell.consumeDirectoryResults()
|
||||
if got := shell.instanceDir.Text(); got != `C:\profiles\new-instance` {
|
||||
t.Fatalf("instance dir = %q", got)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user