feat: add compact instance actions
This commit is contained in:
@@ -21,7 +21,7 @@ func TestShellStartsWithSemanticInstanceStatuses(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestShellInstanceRowsContainRequiredColumnsAndIndependentStartControls(t *testing.T) {
|
||||
func TestShellInstanceRowsContainRequiredColumnsAndIndependentActionControls(t *testing.T) {
|
||||
shell := NewShell(material.NewTheme())
|
||||
if len(shell.rows) < 2 {
|
||||
t.Fatal("expected fixture rows")
|
||||
@@ -36,18 +36,49 @@ func TestShellInstanceRowsContainRequiredColumnsAndIndependentStartControls(t *t
|
||||
if first == second {
|
||||
t.Fatal("rows share a start button state")
|
||||
}
|
||||
if shell.deleteClickFor(shell.rows[0].ID) == shell.deleteClickFor(shell.rows[1].ID) {
|
||||
t.Fatal("rows share a delete button state")
|
||||
}
|
||||
}
|
||||
|
||||
func TestInstanceListColumnWeightsPrioritizeDirectoryAndCompactAction(t *testing.T) {
|
||||
got := instanceNameColumnWeight + instanceBrowserColumnWeight + instanceDirectoryColumnWeight + instanceStatusColumnWeight + instanceStartColumnWeight
|
||||
got := instanceNameColumnWeight + instanceBrowserColumnWeight + instanceDirectoryColumnWeight + instanceStatusColumnWeight + instanceActionColumnWeight
|
||||
if got != 100 {
|
||||
t.Fatalf("instance column weights = %d, want 100", got)
|
||||
}
|
||||
if instanceDirectoryColumnWeight <= instanceNameColumnWeight {
|
||||
t.Fatal("user data directory must have the widest instance-list column")
|
||||
}
|
||||
if instanceStartColumnWeight >= instanceStatusColumnWeight {
|
||||
t.Fatal("start action column must remain compact")
|
||||
if instanceActionColumnWeight <= instanceStatusColumnWeight {
|
||||
t.Fatal("actions column must fit both compact icon commands")
|
||||
}
|
||||
}
|
||||
|
||||
func TestShellDeletesOnlyTheRequestedInstance(t *testing.T) {
|
||||
shell := NewShell(material.NewTheme())
|
||||
target := shell.rows[1]
|
||||
remaining := shell.rows[2].ID
|
||||
shell.startClickFor(target.ID)
|
||||
shell.deleteClickFor(target.ID)
|
||||
|
||||
shell.deleteInstance(target.ID)
|
||||
|
||||
if len(shell.rows) != 3 {
|
||||
t.Fatalf("instance count = %d, want 3", len(shell.rows))
|
||||
}
|
||||
for _, row := range shell.rows {
|
||||
if row.ID == target.ID {
|
||||
t.Fatalf("deleted instance %q remains in the list", target.ID)
|
||||
}
|
||||
}
|
||||
if _, exists := shell.startClicks[target.ID]; exists {
|
||||
t.Fatal("deleted instance start control was not released")
|
||||
}
|
||||
if _, exists := shell.deleteClicks[target.ID]; exists {
|
||||
t.Fatal("deleted instance delete control was not released")
|
||||
}
|
||||
if shell.rows[1].ID != remaining {
|
||||
t.Fatalf("remaining instance id = %q, want %q", shell.rows[1].ID, remaining)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user