Fix test_quickcomplete_flicker

The test needed to be fixed because of how the completer behaviour
changed.

Before:
completer always scheduled a completion update on selection changed,
but the updates themselves were ignored if not needed.

Now:
completer only schedules completion updates when actually needed, but
never ignores a completion update.

So, before it was correct to check whether `set_model` was called, now
we must check if the completion was actually scheduled. This can be
done by checking the parameters with which `_change_completed_part`
is called, since a completion is scheduled only when `immediate=True`
This commit is contained in:
Luca Benci 2017-10-27 22:25:41 +02:00
parent f5f11f7f4e
commit 249164eb9b

View File

@ -299,6 +299,12 @@ def test_quickcomplete_flicker(status_command_stub, completer_obj,
config_stub.val.completion.quick = True
_set_cmd_prompt(status_command_stub, ':open |')
completer_obj.on_selection_changed('http://example.com')
completer_obj.schedule_completion_update()
assert not completion_widget_stub.set_model.called
url = 'http://example.com'
completer_obj._change_completed_part = unittest.mock.Mock()
completer_obj.on_selection_changed(url)
# no immediate (default is false)
completer_obj._change_completed_part.assert_called_with(url, # text
['open'], # before
[]) # after