test_bindings.py 691 B

1234567891011121314151617181920212223242526
  1. import pytest
  2. from nicegui import ui
  3. from selenium.webdriver.common.action_chains import ActionChains
  4. from selenium.webdriver.common.by import By
  5. from .screen import Screen
  6. def test_binding_ui_select_with_tuple_as_key(screen: Screen):
  7. class Model():
  8. selection = None
  9. data = Model()
  10. options = {
  11. (1, 1): 'option A',
  12. (1, 2): 'option B',
  13. }
  14. data.selection = list(options.keys())[0]
  15. ui.select(options).bind_value(data, 'selection')
  16. screen.open('/')
  17. screen.should_not_contain('option B')
  18. element = screen.click('option A')
  19. screen.click_at_position(element, x=20, y=100)
  20. screen.wait(0.3)
  21. screen.should_contain('option B')