Explorar o código

add test for NoTabCheckBox

Daniel Sheffield hai 1 ano
pai
achega
d899eef80a
Modificáronse 1 ficheiros con 13 adicións e 1 borrados
  1. 13 1
      test/test_widgets.py

+ 13 - 1
test/test_widgets.py

@@ -13,6 +13,7 @@ from app.rest import ALL_UNITS
 from app.widgets import (
     SuggestionPopup,
     FlowBarGraphWithVScale,
+    NoTabCheckBox,
 )
 
 @fixture
@@ -69,4 +70,15 @@ def test_flow_bar_graph_with_vscale(bargraph: FlowBarGraphWithVScale, vscale: Tu
     assert bargraph.total_width == 50
     assert bargraph.canvas_width == 50 - bargraph._vscale_width
     assert bargraph.height == 14
-    bargraph.set_bar_width(2)
+    bargraph.set_bar_width(2)
+
+@fixture
+def notabcheckbox():
+    return NoTabCheckBox('label')
+
+def test_no_tab_checkbox(notabcheckbox: NoTabCheckBox):
+    state = notabcheckbox.get_state()
+    notabcheckbox.keypress((0,0), 'tab')
+    assert notabcheckbox.get_state() == state
+    notabcheckbox.keypress((0,0), 'enter')
+    assert notabcheckbox.get_state() != state