def test_bind_completion(qtmodeltester, cmdutils_stub, config_stub, key_config_stub, configdata_stub, info): """Test the results of keybinding command completion. Validates that: - only non-deprecated commands are included - the command description is shown in the desc column - the binding (if any) is shown in the misc column - aliases are included """ model = configmodel.bind('ZQ', info=info) model.set_pattern('') qtmodeltester.check(model) _check_completions(model, { "Current/Default": [ ('quit', '(Current) quit glimpsebrowser', 'ZQ'), ], "Commands": [ ('open', 'open a url', ''), ('q', "Alias for 'quit'", ''), ('quit', 'quit glimpsebrowser', 'ZQ, <Ctrl+q>'), ('scroll', 'Scroll the current tab in the given direction.', ''), ('tab-close', 'Close the current tab.', ''), ], })
def test_bind_completion_no_binding(qtmodeltester, cmdutils_stub, config_stub, key_config_stub, configdata_stub, info): """Test keybinding completion with no current or default binding.""" model = configmodel.bind('x', info=info) model.set_pattern('') qtmodeltester.check(model) _check_completions(model, { "Commands": [ ('open', 'open a url', ''), ('q', "Alias for 'quit'", ''), ('quit', 'quit glimpsebrowser', 'ZQ, <Ctrl+q>'), ('scroll', 'Scroll the current tab in the given direction.', ''), ('tab-close', 'Close the current tab.', ''), ], })
def test_bind_completion_invalid(cmdutils_stub, config_stub, key_config_stub, configdata_stub, info): """Test command completion with an invalid command bound.""" model = configmodel.bind('I', info=info) model.set_pattern('') _check_completions(model, { "Current/Default": [ ('invalid', '(Current) Invalid command!', 'I'), ], "Commands": [ ('open', 'open a url', ''), ('q', "Alias for 'quit'", ''), ('quit', 'quit glimpsebrowser', 'ZQ, <Ctrl+q>'), ('scroll', 'Scroll the current tab in the given direction.', ''), ('tab-close', 'Close the current tab.', ''), ], })