test_editor.py 429 B

123456789101112131415
  1. from nicegui import ui
  2. from .screen import Screen
  3. def test_editor(screen: Screen):
  4. editor = ui.editor(placeholder='Type something here')
  5. ui.markdown().bind_content_from(editor, 'value', backward=lambda v: f'HTML code:\n```\n{v}\n```')
  6. screen.open('/')
  7. screen.find_by_class('q-editor__content').click()
  8. screen.type('Hello\nworld!')
  9. screen.wait(0.5)
  10. screen.should_contain('Hello<div>world!</div>')