summaryrefslogtreecommitdiff
path: root/tests/unit/completion/test_models.py
diff options
context:
space:
mode:
authorJimmy <jimmy@spalge.com>2020-12-16 21:16:36 +1300
committerJimmy <jimmy@spalge.com>2020-12-16 22:02:54 +1300
commitf0ed2063ab81ebf36959dd4cbd40207cf6b33934 (patch)
tree418d2363a6aaf21f6d762ff17bd5dc7420670e7d /tests/unit/completion/test_models.py
parent8e7f24bc0c6cdb333fef1a4a72d659aaeb7bbf09 (diff)
downloadqutebrowser-f0ed2063ab81ebf36959dd4cbd40207cf6b33934.tar.gz
qutebrowser-f0ed2063ab81ebf36959dd4cbd40207cf6b33934.zip
Retain sort order for undo completion model
Because 10 shouldn't be higher than 2.
Diffstat (limited to 'tests/unit/completion/test_models.py')
-rw-r--r--tests/unit/completion/test_models.py24
1 files changed, 24 insertions, 0 deletions
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."""