瀏覽代碼

#251 add pytest

Falko Schindler 2 年之前
父節點
當前提交
438b1f1fb1
共有 1 個文件被更改,包括 20 次插入0 次删除
  1. 20 0
      tests/test_tabs.py

+ 20 - 0
tests/test_tabs.py

@@ -0,0 +1,20 @@
+from nicegui import ui
+
+from .screen import Screen
+
+
+def test_tabs(screen: Screen):
+    with ui.tabs() as tabs:
+        ui.tab('One')
+        ui.tab('Two')
+
+    with ui.tab_panels(tabs, value='One'):
+        with ui.tab_panel('One'):
+            ui.label('First tab')
+        with ui.tab_panel('Two'):
+            ui.label('Second tab')
+
+    screen.open('/')
+    screen.should_contain('First tab')
+    screen.click('Two')
+    screen.should_contain('Second tab')