test_editor.py 436 B

1234567891011121314
  1. from nicegui import ui
  2. from nicegui.testing 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>')