summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2020-12-22 13:24:23 +0100
committerFlorian Bruhin <me@the-compiler.org>2020-12-22 13:24:23 +0100
commit3307df446f18add4b4fba27579178228ceabfc3a (patch)
tree693e3ddbd5b5f5128320868509349f7e5d7a04ec
parentb7d1c4079d2e9d7f63830dd2bd760054839a9f50 (diff)
parentf0ed2063ab81ebf36959dd4cbd40207cf6b33934 (diff)
downloadqutebrowser-3307df446f18add4b4fba27579178228ceabfc3a.tar.gz
qutebrowser-3307df446f18add4b4fba27579178228ceabfc3a.zip
Merge remote-tracking branch 'origin/pr/5964'
-rw-r--r--qutebrowser/completion/models/miscmodels.py2
-rw-r--r--tests/unit/completion/test_models.py24
2 files changed, 25 insertions, 1 deletions
diff --git a/qutebrowser/completion/models/miscmodels.py b/qutebrowser/completion/models/miscmodels.py
index 925f95bbb..d9d386365 100644
--- a/qutebrowser/completion/models/miscmodels.py
+++ b/qutebrowser/completion/models/miscmodels.py
@@ -293,6 +293,6 @@ def undo(*, info):
enumerate(reversed(tabbed_browser.undo_stack), start=1)
]
- cat = listcategory.ListCategory("Closed tabs", entries)
+ cat = listcategory.ListCategory("Closed tabs", entries, sort=False)
model.add_category(cat)
return model
diff --git a/tests/unit/completion/test_models.py b/tests/unit/completion/test_models.py
index 8b4653b58..082cf714a 100644
--- a/tests/unit/completion/test_models.py
+++ b/tests/unit/completion/test_models.py
@@ -1329,6 +1329,30 @@ def test_undo_completion(tabbed_browser_stubs, info):
})
+def undo_completion_retains_sort_order(tabbed_browser_stubs, info):
+ """Test :undo completion sort order with > 10 entries."""
+ created_dt = datetime(2020, 1, 1)
+ created_str = "2020-01-02 00:00"
+
+ tabbed_browser_stubs[0].undo_stack = [
+ tabbedbrowser._UndoEntry(
+ url=QUrl(f'https://example.org/{idx}'),
+ history=None, index=None, pinned=None,
+ created_at=created_dt,
+ )
+ for idx in range(1, 11)
+ ]
+
+ model = miscmodels.undo(info=info)
+ model.set_pattern('')
+
+ expected = [
+ (str(idx), f'https://example.org/{idx}', created_str)
+ for idx in range(1, 11)
+ ]
+ _check_completions(model, {"Closed tabs": expected})
+
+
@hypothesis.given(text=hypothesis.strategies.text())
def test_listcategory_hypothesis(text):
"""Make sure we can't produce invalid patterns."""