test_colors.py 600 B

12345678910111213141516171819
  1. from nicegui import ui
  2. from nicegui.testing import Screen
  3. def test_replace_colors(screen: Screen):
  4. with ui.row() as container:
  5. ui.colors(primary='blue')
  6. def replace():
  7. container.clear()
  8. with container:
  9. ui.colors(primary='red')
  10. ui.button('Replace', on_click=replace)
  11. screen.open('/')
  12. assert screen.find_by_tag('button').value_of_css_property('background-color') == 'rgba(0, 0, 255, 1)'
  13. screen.click('Replace')
  14. screen.wait(0.5)
  15. assert screen.find_by_tag('button').value_of_css_property('background-color') == 'rgba(255, 0, 0, 1)'