summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2022-03-31 15:41:10 +0200
committerFlorian Bruhin <me@the-compiler.org>2022-03-31 15:41:10 +0200
commitaf85f7e6c99a118a2592d02297a14926915be113 (patch)
treeeb76ef8ec4df7118266ca3d3478a8a7c3a7c08e1
parent605a575a7654abe4cc40bbf6ffcf87233070c172 (diff)
parent6223a41a3c61d7eca8021b3bad5f74210eeab052 (diff)
downloadqutebrowser-af85f7e6c99a118a2592d02297a14926915be113.tar.gz
qutebrowser-af85f7e6c99a118a2592d02297a14926915be113.zip
Merge remote-tracking branch 'origin/pr/6599'
-rw-r--r--qutebrowser/mainwindow/prompt.py2
-rw-r--r--tests/unit/mainwindow/test_prompt.py19
2 files changed, 9 insertions, 12 deletions
diff --git a/qutebrowser/mainwindow/prompt.py b/qutebrowser/mainwindow/prompt.py
index 29ea9a45f..21976f383 100644
--- a/qutebrowser/mainwindow/prompt.py
+++ b/qutebrowser/mainwindow/prompt.py
@@ -808,7 +808,7 @@ class DownloadFilenamePrompt(FilenamePrompt):
def __init__(self, question, parent=None):
super().__init__(question, parent)
self._file_model.setFilter(
- QDir.AllDirs | QDir.Drives | QDir.NoDot) # type: ignore[arg-type]
+ QDir.AllDirs | QDir.Drives | QDir.NoDotAndDotDot) # type: ignore[arg-type]
def accept(self, value=None, save=False):
done = super().accept(value, save)
diff --git a/tests/unit/mainwindow/test_prompt.py b/tests/unit/mainwindow/test_prompt.py
index 5b774bdaa..fabf68a89 100644
--- a/tests/unit/mainwindow/test_prompt.py
+++ b/tests/unit/mainwindow/test_prompt.py
@@ -48,9 +48,8 @@ class TestFileCompletion:
return _get_prompt_func
@pytest.mark.parametrize('steps, where, subfolder', [
- (1, 'next', '..'),
- (1, 'prev', 'c'),
- (2, 'next', 'a'),
+ (1, 'next', 'a'),
+ (2, 'next', 'b'),
(2, 'prev', 'b'),
])
def test_simple_completion(self, tmp_path, get_prompt, steps, where,
@@ -84,9 +83,7 @@ class TestFileCompletion:
# For some reason, this isn't always called when using qtbot.keyPress.
prompt._set_fileview_root(prompt._lineedit.text())
- # '..' and 'foo' should get completed from 'f'
- prompt.item_focus('next')
- assert prompt._lineedit.text() == str(tmp_path)
+ # 'foo' should get completed from 'f'
prompt.item_focus('next')
assert prompt._lineedit.text() == str(testdir / 'foo')
@@ -94,15 +91,15 @@ class TestFileCompletion:
for _ in range(3):
qtbot.keyPress(prompt._lineedit, Qt.Key_Backspace)
- # We should now show / again, so tabbing twice gives us .. -> bar
+ # We should now show / again, so tabbing twice gives us bar -> foo
prompt.item_focus('next')
prompt.item_focus('next')
- assert prompt._lineedit.text() == str(testdir / 'bar')
+ assert prompt._lineedit.text() == str(testdir / 'foo')
@pytest.mark.parametrize("keys, expected", [
- ([], ['..', 'bar', 'bat', 'foo']),
- ([Qt.Key_F], ['..', 'foo']),
- ([Qt.Key_A], ['..', 'bar', 'bat']),
+ ([], ['bar', 'bat', 'foo']),
+ ([Qt.Key_F], ['foo']),
+ ([Qt.Key_A], ['bar', 'bat']),
])
def test_filtering_path(self, qtbot, tmp_path, get_prompt, keys, expected):
testdir = tmp_path / 'test'