bdd: Allow multiple "When I open" suffixes

This commit is contained in:
Florian Bruhin 2016-11-04 07:20:48 +01:00
parent a16d41333b
commit fb9415a809

View File

@ -188,19 +188,21 @@ def open_path(quteproc, path):
do_not_wait_suffix = ' without waiting' do_not_wait_suffix = ' without waiting'
as_url_suffix = ' as a URL' as_url_suffix = ' as a URL'
if path.endswith(new_tab_suffix): while True:
path = path[:-len(new_tab_suffix)] if path.endswith(new_tab_suffix):
new_tab = True path = path[:-len(new_tab_suffix)]
elif path.endswith(new_window_suffix): new_tab = True
path = path[:-len(new_window_suffix)] elif path.endswith(new_window_suffix):
new_window = True path = path[:-len(new_window_suffix)]
elif path.endswith(as_url_suffix): new_window = True
path = path[:-len(as_url_suffix)] elif path.endswith(as_url_suffix):
as_url = True path = path[:-len(as_url_suffix)]
as_url = True
if path.endswith(do_not_wait_suffix): elif path.endswith(do_not_wait_suffix):
path = path[:-len(do_not_wait_suffix)] path = path[:-len(do_not_wait_suffix)]
wait = False wait = False
else:
break
quteproc.open_path(path, new_tab=new_tab, new_window=new_window, quteproc.open_path(path, new_tab=new_tab, new_window=new_window,
as_url=as_url, wait=wait) as_url=as_url, wait=wait)