depressingly obscure fix for the done buttong on the identity page never being selectable
but hey, at least i have a nice test!
This commit is contained in:
parent
d1d65288e9
commit
c04927eca6
|
@ -210,7 +210,7 @@ class IdentityView(BaseView):
|
|||
('pack', Text("")),
|
||||
button_pile([self.form.done_btn]),
|
||||
('pack', Text("")),
|
||||
])),
|
||||
], focus_item=1)),
|
||||
])
|
||||
super().__init__(body)
|
||||
|
||||
|
|
|
@ -18,6 +18,9 @@ class IdentityViewTests(unittest.TestCase):
|
|||
controller.signal = mock.create_autospec(spec=Signal)
|
||||
return IdentityView(model, controller, {})
|
||||
|
||||
def enter_valid_data(self, view):
|
||||
view.form.realname.value = view.form.hostname.value = view.form.username.value = view.form.password.value = view.form.confirm_password.value = 'w'
|
||||
|
||||
def test_done_initially_disabled(self):
|
||||
view = self.make_view()
|
||||
self.assertFalse(view.form.done_btn.enabled)
|
||||
|
@ -30,3 +33,15 @@ class IdentityViewTests(unittest.TestCase):
|
|||
return
|
||||
else:
|
||||
self.fail("Realname widget not focus")
|
||||
|
||||
def test_can_tab_to_done_when_valid(self):
|
||||
view = self.make_view()
|
||||
self.enter_valid_data(view)
|
||||
self.assertTrue(view.form.done_btn.enabled)
|
||||
for i in range(10):
|
||||
helpers.keypress(view, 'tab', size=(80, 24))
|
||||
focus_path = helpers.get_focus_path(view)
|
||||
for w in reversed(focus_path):
|
||||
if w is view.form.done_btn:
|
||||
return
|
||||
self.fail("could not tab to done button")
|
||||
|
|
Loading…
Reference in New Issue