fix: scrolling on suggestions
This commit is contained in:
@@ -85,6 +85,27 @@ func TestDetailRendersSuggestionAsRemovalAndAddition(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestRenderedSuggestionsAreCachedWithoutSharingMutableLines(t *testing.T) {
|
||||
renderedSuggestions.clear()
|
||||
reviewed := []string{"old_value = compute()", "return old_value"}
|
||||
first := renderSuggestion(
|
||||
"example.py", reviewed, "new_value = compute()\nreturn new_value", 50,
|
||||
)
|
||||
if len(renderedSuggestions.entries) != 1 {
|
||||
t.Fatalf("suggestion cache entries = %d, want 1", len(renderedSuggestions.entries))
|
||||
}
|
||||
first.removed[0].rail = "mutated"
|
||||
second := renderSuggestion(
|
||||
"example.py", reviewed, "new_value = compute()\nreturn new_value", 50,
|
||||
)
|
||||
if second.removed[0].rail != "" {
|
||||
t.Fatal("caller mutation changed cached suggestion lines")
|
||||
}
|
||||
if len(renderedSuggestions.entries) != 1 {
|
||||
t.Fatalf("cache miss for unchanged suggestion: %d entries", len(renderedSuggestions.entries))
|
||||
}
|
||||
}
|
||||
|
||||
func TestSuggestionBackgroundIsDirectionalWithoutTextUnderline(t *testing.T) {
|
||||
removed := suggestionHighlight(" - ", "old", 12, '-')
|
||||
added := suggestionHighlight(" + ", "new", 12, '+')
|
||||
|
||||
Reference in New Issue
Block a user