fix: mascot animation, makes syntax highlighting blink
This commit is contained in:
@@ -72,6 +72,52 @@ func TestDiffletStylesOnlyDiffSigns(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestDiffletAnimationDoesNotChangeThreadCommentRows(t *testing.T) {
|
||||
if err := applyTheme("dark"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Cleanup(func() { _ = applyTheme("dark") })
|
||||
|
||||
app := NewAppWithSettings(
|
||||
&recordingService{}, "owner", "repository", false, 10, 10,
|
||||
AppSettings{Mascot: true, MascotAnimated: true},
|
||||
)
|
||||
app.screen = threadScreen
|
||||
app.loading = false
|
||||
app.details = PRDetails{
|
||||
PullRequest: PullRequest{
|
||||
Owner: "owner", Repository: "repository",
|
||||
RepoWithOwner: "owner/repository", Number: 42,
|
||||
Title: "Stable highlighted comments",
|
||||
},
|
||||
Threads: []ReviewThread{{
|
||||
ID: "thread", Path: "main.go",
|
||||
Comments: []ReviewComment{{
|
||||
ID: "comment", Author: "reviewer",
|
||||
Body: "```go\nfunc main() {\n\tprintln(\"stable\")\n}\n```",
|
||||
}},
|
||||
}},
|
||||
}
|
||||
updated, _ := app.Update(tea.WindowSizeMsg{Width: 100, Height: 30})
|
||||
app = updated.(App)
|
||||
before := strings.Split(app.View(), "\n")
|
||||
|
||||
generation := app.difflet.generation
|
||||
updated, _ = app.Update(diffletTickMsg{generation: generation})
|
||||
app = updated.(App)
|
||||
after := strings.Split(app.View(), "\n")
|
||||
|
||||
if len(before) != len(after) {
|
||||
t.Fatalf("animation changed frame height from %d to %d", len(before), len(after))
|
||||
}
|
||||
for row := diffletHeight; row < len(before); row++ {
|
||||
if before[row] != after[row] {
|
||||
t.Fatalf("animation changed non-mascot row %d:\nbefore %q\nafter %q",
|
||||
row, before[row], after[row])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestDiffletEnabledSitsRightOfWrappingHeader(t *testing.T) {
|
||||
app := NewAppWithSettings(
|
||||
&recordingService{}, "owner", "repository", false, 10, 10,
|
||||
|
||||
Reference in New Issue
Block a user