|
@@ -0,0 +1,33 @@
|
|
|
|
+from nicegui import ui
|
|
|
|
+
|
|
|
|
+from .screen import Screen
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+def test_select(screen: Screen):
|
|
|
|
+ ui.select(['A', 'B', 'C'], value='A')
|
|
|
|
+
|
|
|
|
+ screen.open('/')
|
|
|
|
+ screen.should_contain('A')
|
|
|
|
+ screen.should_not_contain('B')
|
|
|
|
+ screen.should_not_contain('C')
|
|
|
|
+
|
|
|
|
+ screen.click('A') # open the dropdown
|
|
|
|
+ screen.click('B') # close the dropdown
|
|
|
|
+ screen.wait(0.5)
|
|
|
|
+ screen.should_not_contain('A')
|
|
|
|
+ screen.should_contain('B')
|
|
|
|
+ screen.should_not_contain('C')
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+def test_select_with_input(screen: Screen):
|
|
|
|
+ ui.select(['A', 'AB', 'XYZ'], with_input=True)
|
|
|
|
+
|
|
|
|
+ screen.open('/')
|
|
|
|
+ screen.find_by_tag('input').click()
|
|
|
|
+ screen.should_contain('XYZ')
|
|
|
|
+
|
|
|
|
+ screen.find_by_tag('input').send_keys('A')
|
|
|
|
+ screen.wait(0.5)
|
|
|
|
+ screen.should_contain('A')
|
|
|
|
+ screen.should_contain('AB')
|
|
|
|
+ screen.should_not_contain('XYZ')
|